Skip to content

Conversation

@anth-volk
Copy link
Collaborator

Fixes #3073

Summary

  • Adds include_district_breakdowns query parameter to the economy endpoint for US national simulations
  • When include_district_breakdowns=true is passed for US national-level simulations (country_id=us, region=us), sets the dataset to national-with-breakdowns
  • The Modal gateway routes this to run_national_with_breakdowns, which spawns parallel simulations and returns results with congressional_district_impact data

Changes

  • economy_routes.py: Added handling for include_district_breakdowns query parameter
  • economy_service.py: Added PASSTHROUGH_DATASETS set containing accepted keywords (national-with-breakdowns, national-with-breakdowns-test) and updated _setup_data() to pass these directly to the simulation API
  • test_economy_service.py: Added tests for passthrough dataset behavior

Test plan

  • Verify existing economy service tests pass
  • Test US national simulation with include_district_breakdowns=true
  • Verify response includes congressional_district_impact data

🤖 Generated with Claude Code

@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.73%. Comparing base (3f04db8) to head (e1c61f2).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
policyengine_api/routes/economy_routes.py 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3074   +/-   ##
=======================================
  Coverage   70.73%   70.73%           
=======================================
  Files          57       57           
  Lines        2436     2443    +7     
  Branches      339      341    +2     
=======================================
+ Hits         1723     1728    +5     
- Misses        653      654    +1     
- Partials       60       61    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@anth-volk anth-volk marked this pull request as ready for review January 15, 2026 06:37
@anth-volk anth-volk merged commit 1c8bd89 into master Jan 15, 2026
7 checks passed
@anth-volk anth-volk deleted the feat/enable-dist-breakdowns branch January 15, 2026 06:55
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.

Add district breakdowns to US nationwide results

2 participants