Skip to content

Partition budgetary_impact into federal vs. state shares#3482

Open
MaxGhenis wants to merge 1 commit intomasterfrom
expose-federal-state-budgetary-impact
Open

Partition budgetary_impact into federal vs. state shares#3482
MaxGhenis wants to merge 1 commit intomasterfrom
expose-federal-state-budgetary-impact

Conversation

@MaxGhenis
Copy link
Copy Markdown
Collaborator

Summary

Partitions the /economy budgetary_impact endpoint payload into federal vs. state shares.

New payload keys:

  • federal_budgetary_impact
  • state_budgetary_impact
  • federal_tax_revenue_impact (total tax − state tax, for consistency with the existing state_tax_revenue_impact)
  • federal_benefit_spending_impact
  • state_benefit_spending_impact

Source

Federal/state benefit attribution uses two new keys on the economy-simulation payload:

  • total_federal_benefit_cost = sum of the federal_benefit_cost microsim variable (Medicaid FMAP + CHIP eFMAP today; extends as more programs gain attribution)
  • total_state_benefit_cost = sum of the state_benefit_cost microsim variable

These variables ship in policyengine-us via PolicyEngine/policyengine-us#8076. The economy worker will need to pass them through to the payload (separate infra work).

Fallback behavior

If total_federal_benefit_cost / total_state_benefit_cost are missing from the payload (older releases or non-US countries), benefit spending is attributed 100% federal. This matches the current (implicit) convention — no regression.

Invariant

federal_budgetary_impact + state_budgetary_impact == budgetary_impact always holds (tested).

Test plan

  • 4 new unit tests in tests/unit/endpoints/economy/test_compare.py::TestBudgetaryImpactFederalState:
    • Medicaid expansion rollback (90/10 split)
    • Pure federal tax cut
    • Missing-keys fallback
    • Sum invariant
  • CI

Related

Closes #3481.

Adds federal_budgetary_impact, state_budgetary_impact, federal_tax_revenue_impact,
federal_benefit_spending_impact, and state_benefit_spending_impact fields to
the /economy budgetary_impact payload. Consumes new total_federal_benefit_cost
and total_state_benefit_cost keys from the economy worker, which come from the
FMAP/eFMAP-based attribution variables added in
PolicyEngine/policyengine-us#8076.

Falls back to attributing benefit spending 100% federal if the worker hasn't
populated the new keys (older policyengine-us releases or missing variables),
preserving current scoring behavior.

Closes #3481.
MaxGhenis added a commit to PolicyEngine/policyengine-app-v2 that referenced this pull request Apr 19, 2026
Adds BudgetaryImpactByLevelSubPage showing the reform's budgetary impact
partitioned into federal vs. state via federal_budgetary_impact and
state_budgetary_impact fields on the economy payload. Wired into
ComparativeAnalysisPage at budgetary-impact-by-level, and shown as a
collapsible section in the US Migration tab when the fields are present.

Falls back to an explanatory message when the economy worker hasn't yet
populated the new fields (older releases) or on non-US countries.

Closes #999. Depends on
PolicyEngine/policyengine-api#3482 (once merged and the economy worker
surfaces total_federal_benefit_cost/total_state_benefit_cost).
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.

Expose federal vs. state budgetary impact in compare.py

1 participant