You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add place-level (city) filtering for US impact analysis #222
Add support for filtering US simulations by Census place (city/town) to enable city-level impact analysis.
Background
Currently, PolicyEngine supports national, state, and congressional district level impact analysis for the US. This feature adds support for Census places (cities, towns, CDPs) with population over 100,000, enabling more granular local analysis.
Technical Details
Region String Format
Format: place/{STATE_ABBREV}-{PLACE_FIPS}
Example: place/NJ-57000 for Paterson, NJ
Implementation
Add "place" to USRegionType and US_REGION_PREFIXES in datasets.py
Add parse_us_place_region() helper function to extract state code and place FIPS
Add place handling in _get_default_us_dataset() to load the parent state's dataset
Add _filter_us_simulation_by_place() method in simulation.py to filter households by place_fips
How It Works
When a place region is selected, the system loads the parent state's dataset
Households are filtered by matching the place_fips variable in the dataset
The 100k population cutoff ensures sufficient sample sizes (500+ unweighted households)
Related
Companion PR needed in policyengine-app-v2 for the frontend UI
Activity
anth-volk commentedon Feb 5, 2026
Closed by #223