Skip to content

Remove unused DV code after geo refactor #556

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 1 commit into from
Nov 30, 2020
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
33 changes: 1 addition & 32 deletions doctor_visits/delphi_doctor_visits/geo_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
class GeoMaps:
"""Class to map counties to other geographic resolutions."""

def __init__(self, geo_filepath):
self.geo_filepath = geo_filepath
def __init__(self):
self.gmpr = GeoMapper()

@staticmethod
Expand All @@ -38,13 +37,6 @@ def county_to_msa(self, data):

Returns: tuple of dataframe at the daily-msa resolution, and the geo_id column name
"""
msa_map = pd.read_csv(
join(self.geo_filepath, "02_20_uszips.csv"),
usecols=["fips", "cbsa_id"],
dtype={"cbsa_id": float},
converters={"fips": GeoMaps.convert_fips},
)
msa_map.drop_duplicates(inplace=True)
data = self.gmpr.add_geocode(data,
"fips",
"msa",
Expand All @@ -63,14 +55,6 @@ def county_to_state(self, data):

Returns: tuple of dataframe at the daily-state resolution, and geo_id column name
"""

state_map = pd.read_csv(
join(self.geo_filepath, "02_20_uszips.csv"),
usecols=["fips", "state_id"],
dtype={"state_id": str},
converters={"fips": GeoMaps.convert_fips},
)
state_map.drop_duplicates(inplace=True)
data = self.gmpr.add_geocode(data,
"fips",
"state_id",
Expand All @@ -94,21 +78,6 @@ def county_to_hrr(self, data):
tuple of (data frame at daily-HRR resolution, geo_id column name)

"""

hrr_map = pd.read_csv(
join(self.geo_filepath, "transfipsToHRR.csv"),
converters={"fips": GeoMaps.convert_fips},
)

## Each row is one FIPS. Columns [3:] are HRR numbers, consecutively.
## Entries are the proportion of the county contained in the HRR, so rows
## sum to 1.

## Drop county and state names -- not needed here.
hrr_map.drop(columns=["county_name", "state_id"], inplace=True)

hrr_map = hrr_map.melt(["fips"], var_name="hrr", value_name="wpop")
hrr_map = hrr_map[hrr_map["wpop"] > 0]
data = self.gmpr.add_geocode(data,
"fips",
"hrr",
Expand Down
2 changes: 1 addition & 1 deletion doctor_visits/delphi_doctor_visits/update_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def update_sensor(
jeffreys = True if se else False

# get right geography
geo_map = GeoMaps(staticpath)
geo_map = GeoMaps()
if geo.lower() == "county":
data_groups, _ = geo_map.county_to_megacounty(
data, Config.MIN_RECENT_VISITS, Config.RECENT_LENGTH
Expand Down
Loading