Skip to content

implemented golden checks Uscensuspep_annual_population#2037

Open
niveditasing wants to merge 17 commits into
datacommonsorg:masterfrom
niveditasing:implmented_golden_checks_annual_pop
Open

implemented golden checks Uscensuspep_annual_population#2037
niveditasing wants to merge 17 commits into
datacommonsorg:masterfrom
niveditasing:implmented_golden_checks_annual_pop

Conversation

@niveditasing

@niveditasing niveditasing commented May 25, 2026

Copy link
Copy Markdown
Contributor

What changes were made in preprocess.py?

  1. Fixed Pandas crash for .txt files in preprocess.py
    Change: Replaced delim_whitespace=True with sep=r'\s+' inside pd.read_table().

Why: In Pandas 2.2.0+, the delim_whitespace parameter was deprecated and removed, causing the script to crash with a TypeError when processing space-separated text files (e.g., e7079co.txt). Using sep=r'\s+' achieves the exact same behavior using standard regex and is fully supported in modern Pandas versions.

  1. Improved Pandas Series indexing in _geo_id()
    Change: Updated state, county = val[0], val[1] to use explicit position-based indexing: state, county = val.iloc[0], val.iloc[1].

Why: Direct bracket indexing (val[0]) on Series objects can be ambiguous in newer Pandas versions, often confusing index labels with integer positions. Switching to .iloc explicitly guarantees positional access, silencing future warnings and preventing potential runtime bugs.

  1. Added golden_summary_report.csv & increased threshold 0.1%

Impact & Verification
Pipeline Stability: The entire preprocessing pipeline now runs successfully on all 80 input files (including legacy .txt files) without crashing.

Testing results: https://pantheon.corp.google.com/storage/browser/datcom-import-test/scripts/us_census/pep/annual_population/USCensusPEP_Annual_Population/2026_07_08T03_12_32_164951_07_00?inv=1&invt=AbrLyg&mods=-monitoring_api_staging&project=datcom-infosys-dev&pageState=(%22StorageObjectListTable%22:(%22f%22:%22%255B%255D%22))

PR checklist: https://docs.google.com/spreadsheets/d/1BzweR9Sj58j0H2_BweGTmfE4Z1lrjPZL8u1FS0kzCeg/edit?pli=1&gid=0#gid=0

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces validation configuration for the US Census PEP annual population data. It adds a new golden summary report CSV, updates the manifest to include a validation configuration file, and defines several validation rules including record deletion thresholds and golden file comparisons. A review comment identifies that the check_goldens_summary_report rule is missing the input_files parameter, which is necessary for the validator to correctly compare against the summary report.

Comment thread scripts/us_census/pep/annual_population/validation_config.json Outdated
@pulkeet-wq

Copy link
Copy Markdown
Contributor

LGTM

@niveditasing niveditasing changed the title implemented golden checks implemented golden checks Uscensuspep_annual_population May 29, 2026
@niveditasing niveditasing force-pushed the implmented_golden_checks_annual_pop branch from f330147 to 1a3b3fa Compare June 5, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants