Skip to content

Add place-level (city) selection UI for US impact analysis#634

Merged
anth-volk merged 7 commits intomainfrom
feat/add-place-level-analysis
Feb 5, 2026
Merged

Add place-level (city) selection UI for US impact analysis#634
anth-volk merged 7 commits intomainfrom
feat/add-place-level-analysis

Conversation

@anth-volk
Copy link
Collaborator

@anth-volk anth-volk commented Feb 3, 2026

Fixes #633

Requires PolicyEngine/policyengine.py#223, a relaunch of the simulation API, and PolicyEngine/policyengine-api#3195.

Summary

  • Add UI components for selecting US Census places (cities/towns) with population > 100,000
  • Enable city-level impact analysis selection in the geographic options

Changes

app/src/types/regionTypes.ts

  • Added PLACE: 'place' to US_REGION_TYPES

app/src/utils/regionStrategies.ts

  • Added PlaceOption interface
  • Added US_PLACES_OVER_100K constant (333 places from Census 2023 Population Estimates)
  • Added helper functions:
    • getPlaceStateNames() - Get unique state names with 100k+ places
    • filterPlacesByState() - Filter places by state name
    • placeToRegionString() - Convert PlaceOption to region string
    • parsePlaceRegionString() - Parse region string into state/FIPS
    • findPlaceFromRegionString() - Find PlaceOption from region string

app/src/pathways/report/components/geographicOptions/USPlaceSelector.tsx (new)

  • New component for selecting cities with state-then-city dropdown pattern
  • Similar UX to congressional district selector

app/src/pathways/report/components/geographicOptions/USGeographicOptions.tsx

  • Added "All households in a city" radio option
  • Added USPlaceSelector component when place scope is selected

app/src/pathways/report/views/population/PopulationScopeView.tsx

  • Added US_REGION_TYPES.PLACE to needsRegion validation array

Region String Format

  • Format: place/{STATE_ABBREV}-{PLACE_FIPS}
  • Example: place/NJ-57000 for Paterson, NJ

Test plan

  • Verify "All households in a city" radio option appears in US geographic options
  • Test state dropdown shows only states with 100k+ places
  • Test city dropdown filters by selected state
  • Verify correct region string is generated on selection
  • Test form validation requires city selection before proceeding

🤖 Generated with Claude Code

- Add PLACE to US_REGION_TYPES in regionTypes.ts
- Add PlaceOption interface and US_PLACES_OVER_100K constant (333 places
  with population > 100,000 from Census 2023 estimates)
- Add helper functions: getPlaceStateNames, filterPlacesByState,
  placeToRegionString, parsePlaceRegionString, findPlaceFromRegionString
- Create USPlaceSelector component for selecting cities by state
- Add place option to USGeographicOptions with radio button and selector
- Update PopulationScopeView validation to require region for PLACE scope

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
policyengine-app-v2 Ready Ready Preview, Comment Feb 5, 2026 7:33pm
policyengine-calculator Ready Ready Preview, Comment Feb 5, 2026 7:33pm
policyengine-website Ready Ready Preview, Comment Feb 5, 2026 7:33pm

Request Review

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Change "All households in a city" to "All households in a municipality"
- Change "Pick" to "Choose" in USPlaceSelector
- Change "Select City" to "Select Municipality"
- Remove CITY from US_REGION_TYPES (replaced by PLACE)
- Remove NYC city mock from test fixtures

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add tests for place-related functions in regionStrategies
  (getPlaceStateNames, filterPlacesByState, placeToRegionString,
  parsePlaceRegionString, findPlaceFromRegionString)
- Add tests for regionTypes verifying PLACE constant exists and CITY doesn't
- Add tests for USPlaceSelector component
- Add tests for USGeographicOptions place/municipality option
- Add fixtures for place testing data

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix duplicate import in USGeographicOptionsMocks.ts
- Remove unused MOCK_STATE_NAMES import in USPlaceSelector.test.tsx
- Run prettier formatting

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update all user-facing labels and comments to use 'city' instead of 'community'
for place-level geographic analysis.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@anth-volk anth-volk merged commit df16c86 into main Feb 5, 2026
8 checks passed
@anth-volk anth-volk deleted the feat/add-place-level-analysis branch February 5, 2026 20:00
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 place-level (city) selection UI for US impact analysis

1 participant