Skip to content

Conversation

@melange396
Copy link
Contributor

so that delphi_utils.geomap.GeoMapper().get_geo_values('fips') also includes (for example) "42000" representing all of Pennsylvania, in addition to FIPS codes in the 42001-42999 interval that represent individual counties.

see background discussion at cmu-delphi/delphi-epidata#1134

so that `delphi_utils.geomap.GeoMapper().get_geo_values('fips')` also includes (for example) "42000" representing all of Pennsylvania, in addition to FIPS codes in the 42001-42999 interval that represent individual counties.

see discussion at cmu-delphi/delphi-epidata#1134
Copy link
Contributor

@dshemetov dshemetov left a comment

Choose a reason for hiding this comment

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

Looks good, tests passing 👍

Also searched the repo for usage of get_geo_values and found now-redundant code adding megacounties in the validator, so removed those.

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.

🚀 👍

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)

@krivard krivard merged commit 333bd3e into main Apr 18, 2023
@krivard krivard deleted the include_state_fips_codes branch April 18, 2023 21:08
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!

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.

4 participants