Repository navigation
CensusACS5YearSurvey_SubjectTables_S2702 - #2255
shourya116 wants to merge 18 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the US Census ACS5YR S2702 Subject Table import, adding a README with instructions, test data, MCF/tMCF schemas, and a column mapping configuration. The reviewer identified two issues: first, the specification file S2702_spec.json referenced in the documentation is missing from the repository; second, the --all_summaries flag used in the download command is not supported by the downloader script and should be removed.
…_summaries from README
…,999 mapping in README
6368cde to
b7329ea
Compare
| "Margin of Error!!Total Uninsured!!EARNINGS IN THE PAST 12 MONTHS (IN 2019 INFLATION ADJUSTED DOLLARS)!!Civilian noninstitutionalized population 16 years and over with earnings!!Civilian noninstitutionalized population 16 years and over with earnings!!Median earnings (dollars)", | ||
| "Margin of Error!!Total Uninsured!!EARNINGS IN THE PAST 12 MONTHS (IN 2019 INFLATION ADJUSTED DOLLARS)!!Civilian noninstitutionalized population 16 years and over with earnings!!Median earnings (dollars)", |
There was a problem hiding this comment.
I don't see equivalent entry for other years like 2020, 2021 and son on. Can you pls check
There was a problem hiding this comment.
The equivalent entries for 2020–2024 are present right below on lines 292–296:
Margin of Error!!Total Uninsured!!EARNINGS IN THE PAST 12 MONTHS (IN <YEAR> INFLATION ADJUSTED DOLLARS)!!Civilian noninstitutionalized population 16 years and over with earnings!!Median earnings (dollars)
Why 2019 has the extra entry on line 289 (with Civilian noninstitutionalized population 16 years and over with earnings repeated twice) and line 291 (16 years and older):
- Those extra 2019 entries were carried over from the existing baseline spec (
common/testdata/spec_s2702.json). - Line 289 was the post-
find_and_replaceform of line 290 (sincefind_and_replacereplacesMedian earnings (dollars)withCivilian noninstitutionalized population 16 years and over with earnings!!Median earnings (dollars)). - However,
generate_col_map.pychecksignoreColumnsagainst the raw CSV column headers before runningpreprocess.find_and_replace. Because the raw CSV header only has the token once, line 290 (for 2019) and lines 292–296 (for 2020–2024) are the entries that actually match and ignore the column, while lines 289 and 291 are historical no-ops.
(Also, in case this was referring to lines 308–309 for 2019 Household Income $50,000 to $74,999: those are intentionally not ignored for 2020–2024 so they continue mapping to Count_Household_16OrMoreYears_Civilian_NoHealthInsurance_IncomeOf50000To74999USDollar_WithEarnings_NonInstitutionalized for backward compatibility with the 20250211 release, as documented in README.md Note 3.)
Import Name - CensusACS5YearSurvey_SubjectTables_S2702
Summary
Adds the US Census ACS 5-Year Subject Table S2702 (Selected Characteristics of the Uninsured in the United States) import configuration, documentation, and unit test fixtures, refreshed to include the 2024 ACS 5-Year release (
2013–2024) across all US geographic summary levels (country down to census tracts).Files Added
scripts/us_census/acs5yr/subject_tables/S2702/S2702_spec.json(1,172 lines):preprocess.find_and_replace,pvs,measurement,populationType,ignoreTokens,ignoreColumns,denominators, andinferredSpecrules forS2702across2013–2024.2024inflation-adjusted household income entries (IN 2024 INFLATION ADJUSTED DOLLARS) toignoreColumns(forMedian household income of householdersMOE) anddenominators(forUnder $25,000to$100,000 and overhousehold income brackets).2017+age bracket transition (Under 18 years/18 to 64 yearsin2013–2016vs.Under 19 years/19 to 64 yearsin2017–2024).2013–2023preprocessing andignoreColumnsmappings (including the$50,000 to $74,999rule) so all217StatVars and10,624,152historical observations match the previous20250211release with zero deletions or modifications.scripts/us_census/acs5yr/subject_tables/S2702/README.md(57 lines):2013–2024), data download instructions usingcensus_api_data_downloader.py, processing instructions usingprocess.py, and dataset notes.scripts/us_census/acs5yr/subject_tables/S2702/testdata/:S2702_test.zip: Sample Census ACS 5-Year input data covering2013,2017, and2024.column_map.json,S2702_cleaned.csv,S2702_output.mcf,S2702_output.tmcf: Expected golden outputs for unit testing.Dataset Summary (
2013–2024)Validation & Testing
python3 -m unittest scripts/us_census/acs5yr/subject_tables/subject_table_test.py(Ran 1 test in 58.1s — OK).dc-import genmcf):S2702_output.mcf,S2702_output.tmcf,S2702_cleaned.csvNumRowSuccesses:11,433,315(0fatal,0errors)Existence_MissingReference_variableMeasured:0tools/import_differ/import_differ.pyvs.20250211release):2013–2023):10,624,1522013–2024):11,433,3152024):809,163000