Skip to content

Comments

Wire up all V1 economy comparison outputs (Phase 2 parity)#86

Merged
anth-volk merged 9 commits intoapp-v2-migrationfrom
feat/sim-report-migration/phase-2
Feb 20, 2026
Merged

Wire up all V1 economy comparison outputs (Phase 2 parity)#86
anth-volk merged 9 commits intoapp-v2-migrationfrom
feat/sim-report-migration/phase-2

Conversation

@anth-volk
Copy link
Contributor

Fixes #85

Summary

  • Wire up poverty computation (overall, by age, gender, race) into UK/US economy comparison (local + Modal)
  • Wire up inequality computation (Gini, top 10%, top 1%) into UK/US economy comparison
  • Create budget_summary table and compute fiscal aggregates (tax, benefits, net income, household count)
  • Create intra_decile_impacts table and compute 5-category income change distribution per decile
  • Add detailed_budget V1-compatible per-program breakdown dict to response
  • Expand UK local program list from 4 to 10 programs (matching Modal)
  • Add intra-decile helper with two formula variants (V1 original + corrected) and strategy selector

Test plan

  • python -m pytest passes (analysis tests: 29/29)
  • alembic upgrade head succeeds with new migrations
  • EconomicImpactResponse includes all new fields when report is completed
  • UK and US local comparison functions compute all outputs
  • UK and US Modal functions compute all outputs

🤖 Generated with Claude Code

anth-volk and others added 9 commits February 19, 2026 23:02
Add poverty rate calculation to all economy comparison paths (local UK,
local US, Modal UK, Modal US). Each path calls the appropriate
calculate_*_poverty_rates() function for both baseline and reform
simulations, storing results as Poverty DB records linked to the report.
Also adds poverty to EconomicImpactResponse and _build_response().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add inequality calculation to all economy comparison paths (local UK,
local US, Modal UK, Modal US). Each path calls the appropriate
calculate_*_inequality() function for both baseline and reform
simulations, storing results as Inequality DB records linked to the
report. Also adds inequality to EconomicImpactResponse and
_build_response().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add age-group poverty computation (child, adult, senior) to both
local and Modal economy comparison functions for UK and US.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add gender poverty computation (male, female) to both local and Modal
economy comparison functions for UK and US.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add racial poverty computation (white, black, hispanic, other) to both
local and Modal US economy comparison functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New budget_summary table stores economy-wide fiscal aggregates per
report (household_tax, household_benefits, household_net_income,
household_state_income_tax, household_count_total). Each row has
baseline_total, reform_total, and change — the client can derive
V1-compatible budget fields from these.

Household count bypasses Aggregate and uses raw numpy sum of
household_weight to avoid MicroSeries double-applying weights.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…utation

New intra_decile_impacts table stores per-decile distribution of income
change categories (lose >5%, lose <5%, no change, gain <5%, gain >5%).
Computation helper includes both V1 original formula (noted as likely
buggy — double-counts change) and corrected formula, with a strategy
selector currently using the corrected version.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…list

Add V1-compatible detailed_budget dict to EconomicImpactResponse, derived
from existing ProgramStatistics records. Expand UK local economy comparison
from 4 to 10 programs to match Modal (vat, council_tax, pension_credit,
income_support, working_tax_credit, child_tax_credit).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
52 tests covering:
- Income change formulas (V1 vs corrected), structure, classification, edge cases
- _safe_float sanitization, _build_response for all Phase 2 output fields
  (poverty, inequality, budget_summary, intra_decile, program_statistics,
  detailed_budget), pending/completed report states

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@anth-volk anth-volk marked this pull request as ready for review February 20, 2026 18:52
@anth-volk anth-volk merged commit 13d465e into app-v2-migration Feb 20, 2026
1 check passed
@anth-volk anth-volk deleted the feat/sim-report-migration/phase-2 branch February 20, 2026 18:52
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