Skip to content

Conversation

@anth-volk
Copy link
Collaborator

@anth-volk anth-volk commented Mar 21, 2025

Description

Fixes #2413.

Requires PolicyEngine/policyengine-us-data#195, then PolicyEngine/policyengine-us#5735 to be merged.

Note: this cannot yet be merged, as the API update that incorporates the changes from PolicyEngine/policyengine-us#5735 hasn't yet deployed successfully. Will revert to draft until that's complete.

Changes

This PR introduces a new household input component, "County name," that allows a user to select a county from a dropdown, then maps that behind the scenes to a FIPS code to allow for easier maintenance and fewer bugs for either deprecated counties or counties with special characters or spelling inconsistencies (including Mayagüez Municipio, PR; Windham County, CT; and LeFlore/Le Flore County, OK).

Note for reviewers: Would appreciate attention applied to some of the manual overriding I did to enable this component to exist, despite it not coinciding with a specific input variable. I wanted to still allow the inputting of county FIPS directly, hence why I didn't just replace that input with this one, but also didn't want to add it as a default input, hence some of the manual overrides.

Screenshots

Please see the Vercel launch below. If specific screenshots are desired, happy to add.

Tests

Tests have been added to ensure that the component properly displays counties and properly filters counties down to a state input, if one is given. Due to the limitations of Ant Design and react-router-dom, more technical unit tests have not been added.

@vercel
Copy link

vercel bot commented Mar 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
policyengine-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2025 8:04pm

@anth-volk anth-volk marked this pull request as ready for review April 2, 2025 17:37
Copilot AI review requested due to automatic review settings April 2, 2025 17:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new county input component for US households, enabling users to select a county that is then mapped to its corresponding FIPS code.

  • Added a new County input component (County.jsx) that displays and filters counties based on the selected state.
  • Updated VariableSearch and HouseholdPage to integrate the new county input.
  • Added helper functions in the counties data file and corresponding tests.

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/pages/household/input/County.jsx New county input component with county list filtering and FIPS mapping.
src/pages/household/VariableSearch.jsx Added a new search option for county input, though the identifier is inconsistent with other components.
src/pages/HouseholdPage.jsx Integrated the county input component and updated display tree logic.
src/data/counties.js Provided county data and mapping functionality using the FIPS package.
src/tests/pages/household/input/County.test.js Added tests for the County component to ensure correct rendering and behavior.
Files not reviewed (1)
  • package.json: Language not supported
Comments suppressed due to low confidence (1)

src/pages/household/VariableSearch.jsx:17

  • The option for the county input is using the value 'input.household.countyName', but the County component and display tree use 'input.geography.countyName'. Consider changing the option value to 'input.geography.countyName' for consistency.
options.push({

Copy link
Collaborator

@nikhilwoodruff nikhilwoodruff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on addressing comments

@anth-volk anth-volk marked this pull request as draft April 2, 2025 22:42
@anth-volk anth-volk marked this pull request as ready for review April 3, 2025 20:16
@anth-volk anth-volk merged commit 0900584 into PolicyEngine:master Apr 3, 2025
4 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in policyengine-app Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add county inputs to front end

2 participants