Skip to content

Update CDC500_states query - #2149

Open
shvngisingh wants to merge 14 commits into
datacommonsorg:masterfrom
shvngisingh:cdc500_states_query
Open

Update CDC500_states query#2149
shvngisingh wants to merge 14 commits into
datacommonsorg:masterfrom
shvngisingh:cdc500_states_query

Conversation

@shvngisingh

Copy link
Copy Markdown
Contributor

PR is for updating query in process.py from using the old resolved StatVarObservation table to the new TimeSeries and Observation schemas tables of latest spanner .

@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 refactors the SQL query in scripts/us_cdc/cdc500_state/process.py by introducing Common Table Expressions (CTEs) and updating the source table references to spanner_dc_graph_prod_DEFAULT. The review identifies an opportunity to improve query performance by removing a redundant join in the svo_count CTE and recommends using SAFE_DIVIDE to handle potential division-by-zero errors during the percentage calculation.

Comment thread scripts/us_cdc/cdc500_state/process.py Outdated
Comment thread scripts/us_cdc/cdc500_state/process.py Outdated
shvngisingh and others added 2 commits August 10, 2026 17:16
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…streamline aggregation in CDC500 state query
@pulkeet-wq

Copy link
Copy Markdown
Contributor

Add validation_config.json

… ACS 5Yr facet join, explicit cohort CASE mapping, modular entrypoint, and add unit test suite
@shvngisingh

Copy link
Copy Markdown
Contributor Author

Add validation_config.json

Added

Comment thread scripts/us_cdc/cdc500_state/validation_config.json Outdated
Comment thread scripts/us_cdc/cdc500_state/README.md
Comment thread scripts/us_cdc/cdc500_state/process.py
Comment thread scripts/us_cdc/cdc500_state/process.py Outdated
Comment thread scripts/us_cdc/cdc500_state/process.py Outdated
Comment thread scripts/us_cdc/cdc500_state/process.py Outdated
Comment thread scripts/us_cdc/cdc500_state/process.py Outdated
…ME docs, remove default validation rules, use logging.error, and clean up query helpers
…ame error test, and fix senior cohort statvars
- Exclude age-bracketed cancer screening indicators lacking composite Census ACS cohorts (Mammography, Cervical screening, Pap smear, Colorectal screening).
- Add QUALIFY deduplication in svo_count for 1:1 population weighting.
- Raise RuntimeError on empty query results and write CSV atomically.
- Add scoped SQL_VALIDATOR check for cohort vintage freshness in validation_config.json.
- Remove duplicate source_files in manifest.json and ensure trailing newlines.
- Expand unit tests to verify query constants, error handling, and CLI flags.
- Update README.md with rationale, prerequisites, testing, and automation details.
- Add check_deleted_records_percent override (threshold 100) in validation_config.json for TMCF unit/scalingFactor migration.
- Remove redundant try/except re-raise logging in run_process to eliminate double tracebacks.
- Add unit tests for demographic cohort regex mappings and population-weighted aggregation.
- Fix demographic cohort examples in README.md to reflect excluded cancer screening indicators.
…plication in process.py and use TRY_CAST in validation_config.json
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