Skip to content

Commit

Permalink
Merge pull request #1835 from cmu-delphi/include_state_fips_codes
Browse files Browse the repository at this point in the history
include state FIPS codes in set of all FIPS geo values
  • Loading branch information
krivard authored Apr 18, 2023
2 parents 1f4f352 + 6223cdb commit 333bd3e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
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"))
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
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

0 comments on commit 333bd3e

Please sign in to comment.