Skip to content

Spread CPS age topcode across 80 to 84#164

Merged
MaxGhenis merged 1 commit into
mainfrom
codex/cps-age-topcode-80-84-20260601
Jun 2, 2026
Merged

Spread CPS age topcode across 80 to 84#164
MaxGhenis merged 1 commit into
mainfrom
codex/cps-age-topcode-80-84-20260601

Conversation

@MaxGhenis
Copy link
Copy Markdown
Contributor

Summary

Fixes CPS ASEC age topcoding for MP's eCPS-shaped path. Census A_AGE == 80 represents ages 80-84, but MP had been exporting every such person as exactly age 80. The latest MP-vs-eCPS target diagnostics showed this as the top individual regression: MP estimated about 10.27M weighted people at exact age 80 versus a target around 1.77M, while eCPS spreads that topcoded group across ages 80-84.

This PR:

  • adds an MP-owned deterministic CPS age recode helper, without importing policyengine-us-data at runtime;
  • applies it in the main CPS source processing path before age-derived flags are created;
  • applies it in the older CPS mapping/transform helpers as well;
  • bumps the processed CPS cache version so local rebuilds do not reuse stale age=80 caches;
  • adds focused tests for deterministic 80-84 spreading and raw CPS load behavior.

Validation

  • uv run ruff check src/microplex_us/data_sources/cps.py src/microplex_us/data_sources/cps_age.py src/microplex_us/data_sources/cps_mappings.py src/microplex_us/data_sources/cps_transform.py tests/data_sources/test_cps_age.py
  • uv run ruff format --check src/microplex_us/data_sources/cps.py src/microplex_us/data_sources/cps_age.py src/microplex_us/data_sources/cps_mappings.py src/microplex_us/data_sources/cps_transform.py tests/data_sources/test_cps_age.py
  • uv run --extra dev python -m pytest tests/data_sources/test_cps_age.py -q
  • uv run --extra dev python -m pytest tests/test_cps_source_provider.py -q -k 'rebuilds_stale_processed_cache_without_state_fips or caches_household_geography_on_persons'

@MaxGhenis MaxGhenis merged commit 5dc8331 into main Jun 2, 2026
5 checks passed
@MaxGhenis MaxGhenis deleted the codex/cps-age-topcode-80-84-20260601 branch June 2, 2026 01:12
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.

1 participant