Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions packages/populace-build/src/populace/build/us/fiscal_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,16 @@
("cms_nhe", "expenditure_amount", "medicaid_title_xix"): (
"medicaid",
"cms_medicaid",
{"target_role": "medicaid_spending"},
{
"target_role": "medicaid_spending",
"calibration_role": "validation_only",
"exclusion_reason": (
"PolicyEngine-US allocates medicaid spending from state totals "
"through person_weight-dependent denominators. Reweighting then "
"recomputes per-person medicaid costs, so this is not a linear "
"calibration row."
),
},
),
("cms_medicare", "actual_amount", "premiums_from_enrollees"): (
"gross_medicare_part_b_premium",
Expand Down Expand Up @@ -847,6 +856,8 @@ def _direct_reference_from_fact(
else:
base_variable, family, metadata = mapping
metadata = dict(metadata)
if metadata.get("calibration_role") == "validation_only":
return None

source_record_id = _source_record_id(fact)
if not source_record_id:
Expand Down Expand Up @@ -1208,12 +1219,6 @@ def _str_at(obj: object, *path: str) -> str:
accepted_families=("cms_aca",),
min_matches=2,
),
TargetCoverageRequirement(
requirement_id="medicaid_spending",
label="Medicaid spending",
accepted_families=("cms_medicaid",),
required_metadata=(("target_role", "medicaid_spending"),),
),
TargetCoverageRequirement(
requirement_id="medicaid_enrollment",
label="Medicaid enrollment",
Expand Down
50 changes: 27 additions & 23 deletions packages/populace-build/tests/test_us_fiscal_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"refundable_ctc_total",
"aca_spending",
"aca_enrollment",
"medicaid_spending",
"medicaid_enrollment",
"medicaid_chip_enrollment",
"medicare_part_b_premium_total",
Expand Down Expand Up @@ -178,6 +177,30 @@ def test_reviewed_zero_support_facts_are_not_active_targets() -> None:
assert control.value == 456_000_000


def test_weight_dependent_medicaid_spending_is_validation_only() -> None:
source_record_id = (
"cms_nhe.cy2024.medicaid_title_xix_expenditures."
"medicaid_title_xix.expenditure_amount"
)
facts = [
*packaged_reference_facts(),
_dynamic_ledger_fact(
source_record_id=source_record_id,
source_name="cms_nhe",
measure_id="expenditure_amount",
groupby_value_id="medicaid_title_xix",
value=931_692_000_000,
),
]

registry = compile_us_fiscal_target_registry(facts)

by_source_record_id = {
spec.metadata["ledger_source_record_id"]: spec for spec in registry.specs
}
assert source_record_id not in by_source_record_id


def test_jct_tax_expenditure_references_are_simple_income_tax_reforms() -> None:
assert len(US_JCT_TAX_EXPENDITURE_REFORMS) == len(
REFERENCE_JCT_TAX_EXPENDITURE_TARGETS
Expand Down Expand Up @@ -565,7 +588,7 @@ def test_us_fiscal_requirements_include_reference_program_and_tax_controls() ->
assert "eitc_total" in ids
assert "refundable_ctc_total" in ids
assert "aca_marketplace" in ids
assert "medicaid_spending" in ids
assert "medicaid_spending" not in ids
assert "medicaid_enrollment" in ids
assert "medicaid_chip_enrollment" in ids
assert "irs_agi_distribution" in ids
Expand Down Expand Up @@ -677,7 +700,7 @@ def test_medicaid_chip_requirement_needs_combined_enrollment_role() -> None:
assert any("medicaid_chip_enrollment" in failure for failure in result.failures)


def test_medicaid_requirements_need_spending_and_enrollment_roles() -> None:
def test_medicaid_requirement_needs_enrollment_role() -> None:
base_targets = [
federal_income_tax_total_row(),
*complete_agi_distribution_rows(),
Expand All @@ -687,21 +710,6 @@ def test_medicaid_requirements_need_spending_and_enrollment_roles() -> None:
]
program_rows = complete_program_rows()

without_spending = [
*base_targets,
*[
row
for row in program_rows
if row["metadata"]["target_role"] != "medicaid_spending"
],
]
spending_result = target_profile_coverage_gate(
without_spending,
US_FISCAL_TARGET_COVERAGE_REQUIREMENTS,
)
assert not spending_result.passed
assert any("medicaid_spending" in failure for failure in spending_result.failures)

without_enrollment = [
*base_targets,
*[
Expand Down Expand Up @@ -1073,11 +1081,7 @@ def complete_program_rows() -> list[dict[str, object]]:
family = "irs_soi"
elif role in {"aca_spending", "aca_enrollment"}:
family = "cms_aca"
elif role in {
"medicaid_spending",
"medicaid_enrollment",
"medicaid_chip_enrollment",
}:
elif role in {"medicaid_enrollment", "medicaid_chip_enrollment"}:
family = "cms_medicaid"
elif role == "medicare_part_b_premium_total":
family = "cms_medicare"
Expand Down
2 changes: 1 addition & 1 deletion tools/build_us_fiscal_refresh_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
"cms-aca-oep-state-level",
"cms-medicaid-chip-monthly-enrollment-dataset",
"cms-medicare-trustees-report-2025-part-b-premium-income",
"cms-nhe-historical-service-source",
"census-stc-individual-income-tax",
"hhs-acf-tanf-caseload-2024",
"hhs-acf-tanf-financial-2024",
Expand Down Expand Up @@ -109,6 +108,7 @@
"cms-aca-oep-state-level-2022",
"cms-aca-oep-state-level-2025",
"cms-medicaid-chip-monthly-enrollment-december-2024",
"cms-nhe-historical-service-source",
"hhs-acf-liheap-fy2023-national-profile",
"hhs-acf-liheap-fy2024-national-profile",
"ssa-ssi-table-7b1-2024",
Expand Down
Loading