Repository navigation
OpportunityInsightsOutcomes_statvar_processor_migration - #2227
Open
balit-raibot wants to merge 48 commits into
Open
balit-raibot wants to merge 48 commits into
balit-raibot wants to merge 48 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request implements a new data import pipeline for the Opportunity Insights Opportunity Atlas Outcomes dataset, including scraping, downloading, preprocessing, and testing scripts. The feedback highlights several opportunities to make the pipeline more robust: explicitly filtering out common missing value placeholders (such as 'NA' or '.'), handling float-like strings when formatting FIPS and CZ codes, raising exceptions instead of warnings when expected files are missing to ensure early pipeline failure, and improving the macOS metadata exclusion logic when extracting ZIP files.
…_statvar_processor_migration
…' of https://github.com/balit-raibot/data into OpportunityInsightsOutcomes_statvar_processor_migration
…' of https://github.com/balit-raibot/data into OpportunityInsightsOutcomes_statvar_processor_migration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the Opportunity Insights: The Opportunity Atlas Outcomes (
OpportunityInsightsOutcomes) import from the legacygoogle3Borg script (//depot/google3/datacommons/mcf/oi_v3/opportunity_atlas_outcomes_v2.py) to an automatedstat_var_processor.py-based pipeline understatvar_imports/opportunity_insights_outcomes/, and expands coverage to include the 2024 Opportunity Atlas data refresh (1984–1989 late-cohort tract outcomes and 1978–1992 single-year birth cohort county/commuting-zone estimates).Bug: b/542866823
What's Added
download.py): Scrapes the Opportunity Insights catalog (https://opportunityinsights.org/data/) with canonical fallback URLs, downloads raw CSV/ZIP archives (cz_outcomes.csv,county_outcomes.zip,tract_outcomes.zip,tract_outcomes_late_simple.csv,Table_3_County_by_Cohort_Estimates.csv,Table_4_cz_by_cohort_estimates.csv), and extracts them intoraw_data/.preprocess.py): Normalizes multi-word column headers, formatsgeoIdDCIDs (geoId/cz{cz:05d},geoId/{state:02d}{county:03d},geoId/{state:02d}{county:03d}{tract:06d}), writes compact seed CSVs intoinput_files/*_cleaned.csvforstat_var_processor.pyheader resolution, and shards the 283.56M observations in parallel intooutput/output_part_*.csv.pvmap.csv,metadata.csv,manifest.json):OpportunityInsightsCohortStatisticalVariableandStatVarObservationproperties across demographic dimensions (race,gender,parentIncome) and statistical types (measuredValue,stdError,meanValue,meanStdError,sampleSize).0 8 1 * *) and resource limits (32CPU,512GB RAM,400GB disk).download_test.py,test_data/): Unit and end-to-end integration tests covering URL discovery, archive extraction, header normalization, wide-CSV sharding, andstat_var_processor.pyoutput equivalence.README.md): Documents source files, pipeline steps, schema/cohort coverage, anddc-import(genmcf) validation results.Validation & Metrics (
dc-import genmcf)NumRowSuccesses):283,560,361NumNodeSuccesses):283,658,48310,596across 741 commuting zones, ~3,221 counties, and ~73,438 census tractsReferences
cl/990390911report.json