Skip to content

Add ability to run impacts over subnational regions #230

@anth-volk

Description

@anth-volk

Summary

Add support for running policy impact calculations at subnational geographic levels (states, congressional districts, local authorities, constituencies, and places/cities).

Motivation

PolicyEngine needs to support regional impact analysis for policy reforms at different geographic granularities:

  • US: States (51), Congressional Districts (436), and Places/Cities (333)
  • UK: Countries (4), Regions (12), Local Authorities (~370), and Constituencies (~650)

Implementation

This feature adds:

  1. Region model (src/policyengine/core/region.py):

    • Region class with code, label, type, and optional dataset paths
    • RegionRegistry for O(1) lookups by code or type
    • Support for HuggingFace and GCS dataset paths
  2. Country-specific region definitions:

    • US: States, congressional districts, and places with FIPS codes
    • UK: Countries, regions, local authorities, and constituencies
  3. Integration with tax benefit models:

    • TaxBenefitModelVersion.regions property
    • Region registries accessible via model versions
  4. Test coverage:

    • Unit tests for Region and RegionRegistry
    • Country-specific tests for US and UK region data
    • Regional impact calculation verification script

Testing

A test script (scripts/test_regional_impacts.py) verifies that:

  • Simulations run correctly at national, state, and district levels
  • Budgetary impacts are calculated correctly
  • Subnational impacts are proportional to population shares

Related

This enables the app v2 to display regional impacts for policy reforms.

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