Skip to content

Add place-level (city) filtering for US impact analysis #222

@anth-volk

Description

@anth-volk

Summary

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

  1. Add "place" to USRegionType and US_REGION_PREFIXES in datasets.py
  2. Add parse_us_place_region() helper function to extract state code and place FIPS
  3. Add place handling in _get_default_us_dataset() to load the parent state's dataset
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions