CDC_Mortality_UnderlyingCause - #2210
Open
goutamabrol wants to merge 17 commits into
Open
goutamabrol wants to merge 17 commits into
goutamabrol wants to merge 17 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new automated importer for CDC WONDER County-Level Mortality Data, including a download script, metadata, mapping files, unit tests, and validation configurations. The reviewer feedback highlights two important improvements for the download script: first, making the is_state_downloaded check more robust to ensure all intermediate years are covered rather than just the first and last; second, modifying the downloader to log errors and continue processing other states instead of immediately terminating the script with logging.fatal when a single state fails.
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
PR checklist - link
Adds the CDC_Mortality_UnderlyingCause import under statvar_imports/us_cdc/county_mortality/ for CDC WONDER county-level mortality data.
Data Source: CDC WONDER Underlying Cause of Death (Database D158), covering all ~3,143 US counties from 2018 to 2024.
Coverage: Maps 118 active StatVars (116 with 2024 data + 2 rare causes with 2023 data) across 137 mapped causes in the ICD-10 113 list.
Downloader (download.py): Automates session agreements, form-based year discovery, query partitioning (75k-row cap), and 31-min silent backoff on HTTP 429.
Mappings: Dynamic 5-digit FIPS zero-padding (geoId/{CountyCode1}) in PV map with no hardcoded county lookup tables.
Automation (manifest.json): Configured for Cloud Batch execution with download.py, stat_var_processor.py, and weekly cron.
Validation (validation_config.json): Enforces 0.1% historical deletion threshold and dynamic date freshness (SQL_VALIDATOR) for standard and rare causes.
Testing: 16/16 unit tests pass locally (download_test.py).
Cloud Batch job (test) - link
Validation - link
CRA Report - link