Skip to content

Commit 00cf3a1

Browse files
authored
Merge pull request #540 from cmu-delphi/quidel-pylint
Set pylint equal to others
2 parents 404e80d + c4c566e commit 00cf3a1

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

quidel_covidtest/.pylintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ attr-rgx=[a-z_][a-z0-9_]*
2020

2121
# Don't complain about pytest "unused" arguments.
2222
ignored-argument-names=(_.*|run_as_module)
23-
disable=R0801, C0330, E1101, E0611, C0114, C0116, C0103, R0913, R0914, W0702, W0212, E1136

quidel_covidtest/delphi_quidel_covidtest/geo_maps.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,51 @@
11
"""Contains geographic mapping tools."""
22
from delphi_utils import GeoMapper
33

4-
date_col = "timestamp"
5-
data_cols = ['totalTest', 'numUniqueDevices', 'positiveTest', "population"]
6-
gmpr = GeoMapper() # Use geo utils
4+
DATE_COL = "timestamp"
5+
DATA_COLS = ['totalTest', 'numUniqueDevices', 'positiveTest', "population"]
6+
GMPR = GeoMapper() # Use geo utils
77
GEO_KEY_DICT = {
88
"county": "fips",
99
"msa": "msa",
1010
"hrr": "hrr",
1111
"state": "state_id"
1212
}
13+
14+
1315
def geo_map(geo_res, df):
16+
"""
17+
Map a geocode to a new value.
18+
"""
1419
data = df.copy()
1520
geo_key = GEO_KEY_DICT[geo_res]
1621
# Add population for each zipcode
17-
data = gmpr.add_population_column(data, "zip")
22+
data = GMPR.add_population_column(data, "zip")
1823
# zip -> geo_res
19-
data = gmpr.replace_geocode(data, "zip", geo_key,
20-
date_col=date_col, data_cols=data_cols)
24+
data = GMPR.replace_geocode(data, "zip", geo_key,
25+
date_col=DATE_COL, data_cols=DATA_COLS)
2126
if geo_res == "state":
2227
return data
2328
# Add parent state
2429
data = add_parent_state(data, geo_res, geo_key)
2530
return data, geo_key
2631

32+
2733
def add_parent_state(data, geo_res, geo_key):
2834
"""
2935
- map from msa/hrr to state, going by the state with the largest
3036
population (since a msa/hrr may span multiple states)
3137
- map from county to the corresponding state
3238
"""
33-
fips_to_state = gmpr._load_crosswalk(from_code="fips", to_code="state")
39+
fips_to_state = GMPR._load_crosswalk(from_code="fips", to_code="state") # pylint: disable=protected-access
3440
if geo_res == "county":
35-
mix_map = fips_to_state[["fips", "state_id"]]
41+
mix_map = fips_to_state[["fips", "state_id"]] # pylint: disable=unsubscriptable-object
3642
else:
37-
fips_to_geo_res = gmpr._load_crosswalk(from_code="fips", to_code=geo_res)
43+
fips_to_geo_res = GMPR._load_crosswalk(from_code="fips", to_code=geo_res) # pylint: disable=protected-access
3844
mix_map = fips_to_geo_res[["fips", geo_res]].merge(
39-
fips_to_state[["fips", "state_id"]],
45+
fips_to_state[["fips", "state_id"]], # pylint: disable=unsubscriptable-object
4046
on="fips",
4147
how="inner")
42-
mix_map = gmpr.add_population_column(mix_map, "fips").groupby(
48+
mix_map = GMPR.add_population_column(mix_map, "fips").groupby(
4349
geo_res).max().reset_index().drop(
4450
["fips", "population"], axis = 1)
4551
# Merge the info of parent state to the data

0 commit comments

Comments
 (0)