Skip to content

Code fix to skip nonexisting urls for us_pep_sexrace#1955

Open
niveditasing wants to merge 8 commits intodatacommonsorg:masterfrom
niveditasing:code_fix_to_skip_nonexisting_urls
Open

Code fix to skip nonexisting urls for us_pep_sexrace#1955
niveditasing wants to merge 8 commits intodatacommonsorg:masterfrom
niveditasing:code_fix_to_skip_nonexisting_urls

Conversation

@niveditasing
Copy link
Copy Markdown
Contributor

@niveditasing niveditasing commented Apr 15, 2026

A code fix was implemented to address a pipeline failure caused by an inaccessible URL for the 1918 National Data. I added a safeguard to the processing loops in national_1900_1970.py and preprocess.py that validates the CSV schema before processing. This ensures that if a file is missing or formatted incorrectly, the script skips that specific year rather than terminating the entire pipeline.
[https://www2.census.gov/programs-surveys/popest/tables/1900-1980/national/asrh/pe-11-1918.csv]

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

Differ - Only 4 Data points deletion occur for year 1918 - national

image

@niveditasing niveditasing requested a review from saanikaaa April 15, 2026 08:38
Copy link
Copy Markdown
Contributor

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

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 enhances the US Census PEP preprocessing scripts by adding column count validation and implementing more resilient error handling. In preprocess.py, processing loops are now wrapped in try-except blocks to ensure that failures in individual files or geographic levels do not halt the entire execution. Feedback suggests refining this by using explicit checks instead of exception-based control flow to reduce log noise and replacing logging.fatal with logging.error to avoid unnecessary script termination.

Comment thread scripts/us_census/pep/us_pep_sexrace/preprocess.py
Comment thread scripts/us_census/pep/us_pep_sexrace/preprocess.py
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.

Looks like we are deleting an unwanted file. Lets revert this deletion

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.

2 participants