Wire up all V1 economy comparison outputs (Phase 2 parity)#86
Merged
anth-volk merged 9 commits intoapp-v2-migrationfrom Feb 20, 2026
Merged
Wire up all V1 economy comparison outputs (Phase 2 parity)#86anth-volk merged 9 commits intoapp-v2-migrationfrom
anth-volk merged 9 commits intoapp-v2-migrationfrom
Conversation
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>
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.
Fixes #85
Summary
budget_summarytable and compute fiscal aggregates (tax, benefits, net income, household count)intra_decile_impactstable and compute 5-category income change distribution per deciledetailed_budgetV1-compatible per-program breakdown dict to responseTest plan
python -m pytestpasses (analysis tests: 29/29)alembic upgrade headsucceeds with new migrations🤖 Generated with Claude Code