Prefix state Medicaid calibration label with state/#778
Merged
MaxGhenis merged 1 commit intoPolicyEngine:mainfrom Apr 17, 2026
Merged
Prefix state Medicaid calibration label with state/#778MaxGhenis merged 1 commit intoPolicyEngine:mainfrom
MaxGhenis merged 1 commit intoPolicyEngine:mainfrom
Conversation
The state-level Medicaid enrollment calibration column was labeled
`irs/medicaid_enrollment/{state}`, missing the `state/` prefix used
by every other state target in `build_loss_matrix` (e.g. line 849:
`state/irs/aca_enrollment/{state}`, state SNAP, state AGI).
In `reweight()`, `is_national = columns.str.startswith("nation/")`
and the non-national normalisation factor uses `~is_national`, so
today the label technically lands in the state pool, but it also
isn't tagged as a state target. Downstream tools that filter
targets by the `state/` prefix (dashboards, validation scripts)
silently skip these Medicaid columns.
Fix: prefix with `state/` for consistency.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MaxGhenis
added a commit
to MaxGhenis/policyengine-us-data
that referenced
this pull request
Apr 17, 2026
Line 820 labeled the per-state ACA spending target
`nation/irs/aca_spending/{state}` — starting with `nation/` even
though every row is specific to one state. `reweight()` classifies
targets via `columns.str.startswith("nation/")` and divides the
normalisation weight by the count of national versus state
targets, so this label was counted as a national target, diluting
the national-target pool with what are actually 50 state rows.
Sibling state labels use `state/` prefixes (e.g. line 849
`state/irs/aca_enrollment/{state}`, state AGI, state SNAP). Fix
the ACA spending label to match.
This was flagged during independent review of PR PolicyEngine#778 (state
Medicaid label prefix) as an analogous but higher-severity bug
(real calibration-weighting impact vs naming-consistency for PolicyEngine#778).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 task
MaxGhenis
added a commit
that referenced
this pull request
Apr 17, 2026
Line 820 labeled the per-state ACA spending target
`nation/irs/aca_spending/{state}` — starting with `nation/` even
though every row is specific to one state. `reweight()` classifies
targets via `columns.str.startswith("nation/")` and divides the
normalisation weight by the count of national versus state
targets, so this label was counted as a national target, diluting
the national-target pool with what are actually 50 state rows.
Sibling state labels use `state/` prefixes (e.g. line 849
`state/irs/aca_enrollment/{state}`, state AGI, state SNAP). Fix
the ACA spending label to match.
This was flagged during independent review of PR #778 (state
Medicaid label prefix) as an analogous but higher-severity bug
(real calibration-weighting impact vs naming-consistency for #778).
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
The state-level Medicaid enrollment calibration column was labeled
irs/medicaid_enrollment/{state}, missing thestate/prefix used by every other state target inbuild_loss_matrix:state/irs/aca_enrollment/{state}✓{r.GEO_ID[-4:]}/snap-cost(state targets)state/{GEO_NAME}/{VARIABLE}/{band}✓irs/medicaid_enrollment/{state}✗ (missing prefix)In
reweight(),is_national = columns.str.startswith("nation/")— a label starting withirs/is not classified as national but also doesn't follow thestate/naming convention. It still participates in calibration, but downstream tools that filter targets by prefix (dashboards, validation scripts) silently skip these Medicaid columns.Fix
Test plan