Partition budgetary_impact into federal vs. state shares#3482
Open
Partition budgetary_impact into federal vs. state shares#3482
Conversation
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).
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
Partitions the
/economybudgetary_impactendpoint payload into federal vs. state shares.New payload keys:
federal_budgetary_impactstate_budgetary_impactfederal_tax_revenue_impact(total tax − state tax, for consistency with the existingstate_tax_revenue_impact)federal_benefit_spending_impactstate_benefit_spending_impactSource
Federal/state benefit attribution uses two new keys on the economy-simulation payload:
total_federal_benefit_cost= sum of thefederal_benefit_costmicrosim variable (Medicaid FMAP + CHIP eFMAP today; extends as more programs gain attribution)total_state_benefit_cost= sum of thestate_benefit_costmicrosim variableThese 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_costare 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_impactalways holds (tested).Test plan
tests/unit/endpoints/economy/test_compare.py::TestBudgetaryImpactFederalState:Related
Closes #3481.