Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ZIP code handling #3227

Merged
merged 3 commits into from
Nov 3, 2023
Merged

Improve ZIP code handling #3227

merged 3 commits into from
Nov 3, 2023

Conversation

nikhilwoodruff
Copy link
Collaborator

@nikhilwoodruff nikhilwoodruff commented Nov 3, 2023

cc @MaxGhenis

This PR changes the automatic zip code handling, which can cause large fluctuations in MTR charts.

Current logic: ZIP codes are randomly sampled from the entire US for every household in the simulation (including axis variation households.

New logic:

  • For axes-containing simulations: ZIP code is sampled from the household's state and repeated for all households (in that state).
  • For other simulations: ZIP code is sampled from the household's state.

🤖 Generated by Copilot at ce77ab1

Summary

📝🐛🗺️

This pull request fixes a bug in the zip_code variable formula that caused inconsistent and random zip codes for households. It also updates the changelog entry to reflect the bug fix and the minor version bump.

zip_code formula
changed to match state and axes
fall leaves no errors

Walkthrough

  • Update changelog entry to reflect minor version bump and bug fix (link)
  • Fix zip code sampling logic to match state code and handle axes (link)

@nikhilwoodruff nikhilwoodruff added the enhancement New feature or request label Nov 3, 2023
@nikhilwoodruff nikhilwoodruff self-assigned this Nov 3, 2023
Copy link

codecov bot commented Nov 3, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (67e95c7) 99.02% compared to head (33d86b2) 99.01%.
Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3227      +/-   ##
==========================================
- Coverage   99.02%   99.01%   -0.02%     
==========================================
  Files        1798     1798              
  Lines       26614    26621       +7     
  Branches      155      158       +3     
==========================================
+ Hits        26354    26358       +4     
- Misses        223      225       +2     
- Partials       37       38       +1     
Files Coverage Δ
...sehold/demographic/geographic/zip_code/zip_code.py 82.35% <66.66%> (-17.65%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nikhilwoodruff
Copy link
Collaborator Author

Tests passing locally, merging.

@nikhilwoodruff nikhilwoodruff merged commit d5e4eb9 into master Nov 3, 2023
3 of 4 checks passed
@nikhilwoodruff nikhilwoodruff deleted the zip-code-fix branch November 3, 2023 20:30
@MaxGhenis MaxGhenis linked an issue Nov 6, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Randomly sample ZIP codes in CPS within the state
1 participant