Skip to content

Comments

Phase 3: Expensive computations — API wiring#87

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

Phase 3: Expensive computations — API wiring#87
anth-volk merged 5 commits intoapp-v2-migrationfrom
feat/sim-report-migration/phase-3

Conversation

@anth-volk
Copy link
Contributor

Summary

  • Wire up CongressionalDistrictImpact from policyengine.py for US economy comparison
  • Wire up ConstituencyImpact and LocalAuthorityImpact for UK economy comparison
  • Migrate all intra-decile computation from inline api/intra_decile.py to policyengine.py's IntraDecileImpact
  • Add wealth decile impact and intra-wealth-decile for UK (using decile_variable="household_wealth_decile")
  • Add decile_type column to intra_decile_impacts table (Alembic migration)
  • Add wealth_decile and intra_wealth_decile fields to EconomicImpactResponse
  • Tests for all new response fields (19 new tests across 5 test classes)

Companion PR: PolicyEngine/policyengine.py#235 — Phase 3 output classes

Test plan

  • All 48 API tests pass (19 new)
  • Alembic migration applies cleanly
  • Verify end-to-end with frontend consumption

🤖 Generated with Claude Code

anth-volk and others added 5 commits February 20, 2026 21:10
Create congressional_district_impacts table and wire per-district income
change computation into US economy comparison (local and Modal). Add
congressional_district_impact field to EconomicImpactResponse.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds ConstituencyImpact DB model, Alembic migration, and wires
constituency computation into both local and Modal UK economy
comparison paths. Uses GCS-hosted weight matrix and constituency CSV.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds LocalAuthorityImpact DB model, Alembic migration, and wires
computation into both local and Modal UK economy comparison paths.
Uses GCS-hosted weight matrix and local authority CSV.

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

Migrate all intra-decile computation (UK+US, local+Modal) from the
API's inline intra_decile.py helper to policyengine.py's new
IntraDecileImpact output class.

Add wealth decile impact and intra-wealth-decile impact for UK
economy comparisons, using DecileImpact with decile_variable=
"household_wealth_decile". Add decile_type column to
intra_decile_impacts table to distinguish income vs wealth records.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extend fixtures with factory functions for congressional district,
constituency, local authority, wealth decile, and intra-wealth-decile
records. Add test classes verifying _build_response() populates all
new fields correctly.

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 23:23
@anth-volk anth-volk merged commit 7b452bf into app-v2-migration Feb 20, 2026
1 check passed
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