Skip to content

include state FIPS codes in set of all FIPS geo values #1835

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 3 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _delphi_utils_python/delphi_utils/geomap.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def _load_geo_values(self, geo_type):
to_code = from_code = "state"
elif geo_type == "fips":
from_code = "fips"
to_code = "pop"
to_code = "state"
else:
from_code = "fips"
to_code = geo_type
Expand Down
2 changes: 0 additions & 2 deletions _delphi_utils_python/delphi_utils/validator/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ def _get_valid_geo_values(self, geo_type):
gmpr = GeoMapper()
valid_geos = gmpr.get_geo_values(geomap_type)
valid_geos |= set(self.params.additional_valid_geo_values.get(geo_type, []))
if geo_type == "county":
valid_geos |= set(x + "000" for x in gmpr.get_geo_values("state_code"))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

lolololol, we shoulda just been using _get_valid_geo_values() instead of the geo_type_translator

Copy link
Contributor

Choose a reason for hiding this comment

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

haha actually, not a bad refactor opportunity!

return valid_geos

def check_bad_geo_id_value(self, df_to_test, filename, geo_type, report):
Expand Down
4 changes: 2 additions & 2 deletions _delphi_utils_python/tests/test_geomap.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,13 @@ def test_add_geocode(self, geomapper):
def test_get_geos(self, geomapper):
assert geomapper.get_geo_values("nation") == {"us"}
assert geomapper.get_geo_values("hhs") == set(str(i) for i in range(1, 11))
assert len(geomapper.get_geo_values("fips")) == 3236
assert len(geomapper.get_geo_values("fips")) == 3293
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 57: 50 states + 1 District (DC) + 6 Territories (Puerto Rico etc)

assert len(geomapper.get_geo_values("chng-fips")) == 2711
assert len(geomapper.get_geo_values("state_id")) == 60
assert len(geomapper.get_geo_values("zip")) == 32976

def test_get_geos_2019(self, geomapper_2019):
assert len(geomapper_2019.get_geo_values("fips")) == 3235
assert len(geomapper_2019.get_geo_values("fips")) == 3292
assert len(geomapper_2019.get_geo_values("chng-fips")) == 2710

def test_get_geos_within(self, geomapper):
Expand Down