Skip to content

get_geo_values() doesnt know about a plain "state" type #1121

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

Merged
merged 4 commits into from
Apr 5, 2023

Conversation

melange396
Copy link
Collaborator

but it does know about "state_id", "state_code", and "state_name" (see delphi_utils/geomap.py). "state_id" appears to be the two-digit state abbreviation, if delphi_utils/data/2020/state_pop.csv is to be believed.

this is untested! i whipped it up fast to address the issue we saw post-rollout. its kinda hacky and i dont love the ternary form of it. ...but it should do the trick, at least in prod for now.

obviously, it should be accompanied by some new additional unit and/or integration tests that involve a "state" geo_type.

also has a less hacky feel to it

Co-authored-by: dshemetov <[email protected]>
@melange396
Copy link
Collaborator Author

this feels much less hacky. added geo_type "county" handling, and it now steps around geo_types that are unknown to GeoMapper (like "dma"). we may want to keep the just-added geo_type_translator in sync with GEOGRAPHIC_RESOLUTIONS from csv_importer.py

now this is failing tests, presumably because tests use a geo_type of "fips" when they should specify "county" instead.

@krivard krivard requested a review from LeonLu2 April 5, 2023 13:20
@krivard
Copy link
Contributor

krivard commented Apr 5, 2023

I'm working on a test now

krivard
krivard previously approved these changes Apr 5, 2023
Copy link
Contributor

@krivard krivard left a comment

Choose a reason for hiding this comment

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

I added and fixed tests, lmk if they're friendly and we can merge and release

Comment on lines +61 to +70
geo_type_translator = {
"county": "fips",
"state": "state_id",
"zip": "zip",
"hrr": "hrr",
"hhs": "hhs",
"msa": "msa",
"nation": "nation"
}
if geo_type in geo_type_translator: # else geo_type is unknown to GeoMapper
Copy link
Contributor

Choose a reason for hiding this comment

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

praise: nice logic here

agreed long term we should sync with the acquisition types and/or move a shared spec to common but this is a good rapid patch

@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 5, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@melange396
Copy link
Collaborator Author

tests look good. i added a note about syncing geo_type. i think this should be good to go!

Copy link
Contributor

@krivard krivard left a comment

Choose a reason for hiding this comment

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

🙌 stellar addition

@krivard krivard merged commit 0593895 into dev Apr 5, 2023
@krivard krivard deleted the geo_mapper_state_crutch branch April 5, 2023 15:18
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.

2 participants