22
22
"msa" : join (DATA_PATH , "zip_msa_table.csv" ),
23
23
"pop" : join (DATA_PATH , "zip_pop.csv" ),
24
24
"state" : join (DATA_PATH , "zip_state_code_table.csv" ),
25
+ "hhs_region_number" : join (DATA_PATH , "zip_hhs_table.csv" )
25
26
},
26
27
"fips" : {
27
28
"zip" : join (DATA_PATH , "fips_zip_table.csv" ),
28
29
"hrr" : join (DATA_PATH , "fips_hrr_table.csv" ),
29
30
"msa" : join (DATA_PATH , "fips_msa_table.csv" ),
30
31
"pop" : join (DATA_PATH , "fips_pop.csv" ),
31
32
"state" : join (DATA_PATH , "fips_state_table.csv" ),
33
+ "hhs_region_number" : join (DATA_PATH , "fips_hhs_table.csv" ),
32
34
},
33
35
"state" : {"state" : join (DATA_PATH , "state_codes_table.csv" )},
34
36
"state_code" : {
@@ -55,12 +57,14 @@ class GeoMapper: # pylint: disable=too-many-public-methods
55
57
- [x] zip -> hrr : unweighted
56
58
- [x] zip -> msa : unweighted
57
59
- [x] zip -> state
60
+ - [x] zip -> hhs_region_number
58
61
- [x] zip -> population
59
62
- [x] state code -> hhs_region_number
60
63
- [x] fips -> state : unweighted
61
64
- [x] fips -> msa : unweighted
62
65
- [x] fips -> megacounty
63
66
- [x] fips -> hrr
67
+ - [x] fips -> hhs_region_number
64
68
- [x] nation
65
69
- [ ] zip -> dma (postponed)
66
70
@@ -102,8 +106,10 @@ def __init__(self):
102
106
"""
103
107
self .crosswalk_filepaths = CROSSWALK_FILEPATHS
104
108
self .crosswalks = {
105
- "zip" : {"fips" : None , "hrr" : None , "msa" : None , "pop" : None , "state" : None },
106
- "fips" : {"zip" : None , "hrr" : None , "msa" : None , "pop" : None , "state" : None },
109
+ "zip" : {"fips" : None , "hrr" : None , "msa" : None ,
110
+ "pop" : None , "state" : None , "hhs_region_number" : None },
111
+ "fips" : {"zip" : None , "hrr" : None , "msa" : None ,
112
+ "pop" : None , "state" : None , "hhs_region_number" : None },
107
113
"state" : {"state" : None },
108
114
"state_code" : {"hhs_region_number" : None },
109
115
"jhu_uid" : {"fips" : None },
@@ -123,6 +129,7 @@ def _load_crosswalk(self, from_code, to_code):
123
129
("jhu_uid" , "fips" ),
124
130
("zip" , "msa" ),
125
131
("fips" , "hrr" ),
132
+ ("zip" , "hhs_region_number" )
126
133
]:
127
134
self .crosswalks [from_code ][to_code ] = pd .read_csv (
128
135
stream ,
@@ -136,6 +143,8 @@ def _load_crosswalk(self, from_code, to_code):
136
143
elif (from_code , to_code ) in [
137
144
("zip" , "hrr" ),
138
145
("fips" , "msa" ),
146
+ ("fips" , "hhs_region_number" ),
147
+ ("state_code" , "hhs_region_number" )
139
148
]:
140
149
self .crosswalks [from_code ][to_code ] = pd .read_csv (
141
150
stream ,
@@ -151,11 +160,6 @@ def _load_crosswalk(self, from_code, to_code):
151
160
"state_name" : str ,
152
161
},
153
162
)
154
- elif (from_code , to_code ) == ("state_code" , "hhs_region_number" ):
155
- self .crosswalks [from_code ][to_code ] = pd .read_csv (
156
- stream ,
157
- dtype = {"state_code" : str , "hhs_region_number" : str },
158
- )
159
163
elif (from_code , to_code ) == ("zip" , "state" ):
160
164
self .crosswalks [from_code ][to_code ] = pd .read_csv (
161
165
stream ,
@@ -255,8 +259,8 @@ def add_geocode(
255
259
"""Add a new geocode column to a dataframe.
256
260
257
261
Currently supported conversions:
258
- - fips -> state_code, state_id, state_name, zip, msa, hrr, nation
259
- - zip -> state_code, state_id, state_name, fips, msa, hrr, nation
262
+ - fips -> state_code, state_id, state_name, zip, msa, hrr, nation, hhs_region_number
263
+ - zip -> state_code, state_id, state_name, fips, msa, hrr, nation, hhs_region_number
260
264
- jhu_uid -> fips
261
265
- state_x -> state_y, where x and y are in {code, id, name}
262
266
- state_code -> hhs_region_number
0 commit comments