@@ -91,7 +91,7 @@ def __init__(self,
9191 startdate: first sensor date (YYYY-mm-dd)
9292 enddate: last sensor date (YYYY-mm-dd)
9393 dropdate: data drop date (YYYY-mm-dd)
94- geo: geographic resolution, one of ["county", "state", "msa", "hrr"]
94+ geo: geographic resolution, one of ["county", "state", "msa", "hrr", "hhs", "nation" ]
9595 parallel: boolean to run the sensor update in parallel
9696 weekday: boolean to adjust for weekday effects
9797 numtype: type of count data used, one of ["covid", "cli"]
@@ -104,9 +104,8 @@ def __init__(self,
104104 ), f"not enough data to produce estimates starting { self .startdate } "
105105 assert self .startdate < self .enddate , "start date >= end date"
106106 assert self .enddate <= self .dropdate , "end date > drop date"
107- assert geo in ['county' , 'state' , 'msa' , 'hrr' ],\
108- f"{ geo } is invalid, pick one of 'county', 'state', 'msa', 'hrr'"
109- self .geo , self .parallel , self .weekday , self .numtype , self .se = geo .lower (), parallel , weekday , numtype , se
107+ self .geo , self .parallel , self .weekday , self .numtype , self .se = geo .lower (), parallel , \
108+ weekday , numtype , se
110109
111110 # output file naming
112111 if self .numtype == "covid" :
@@ -145,10 +144,9 @@ def geo_reindex(self, data):
145144 # get right geography
146145 geo = self .geo
147146 gmpr = GeoMapper ()
148- if geo not in {"county" , "state" , "msa" , "hrr" }:
149- logging .error ("{0} is invalid, pick one of 'county', 'state', 'msa', 'hrr'" .format (
150- geo
151- ))
147+ if geo not in {"county" , "state" , "msa" , "hrr" , "nation" , "hhs" }:
148+ logging .error ("{0} is invalid, pick one of 'county', "
149+ "'state', 'msa', 'hrr', 'hss','nation'" .format (geo ))
152150 return False
153151 if geo == "county" :
154152 data_frame = gmpr .fips_to_megacounty (data ,
@@ -158,10 +156,8 @@ def geo_reindex(self, data):
158156 mega_col = geo )
159157 elif geo == "state" :
160158 data_frame = gmpr .replace_geocode (data , "fips" , "state_id" , new_col = "state" )
161- elif geo == "msa" :
162- data_frame = gmpr .replace_geocode (data , "fips" , "msa" )
163- elif geo == "hrr" :
164- data_frame = gmpr .replace_geocode (data , "fips" , "hrr" )
159+ else :
160+ data_frame = gmpr .replace_geocode (data , "fips" , geo )
165161
166162 unique_geo_ids = pd .unique (data_frame [geo ])
167163 data_frame .set_index ([geo , Config .DATE_COL ],inplace = True )
0 commit comments