Skip to content

Commit 13ad138

Browse files
authored
Merge pull request #232 from cmu-delphi/fix-jhu-linter-issues
Fix jhu linter issues
2 parents 9149aed + 3c15428 commit 13ad138

File tree

3 files changed

+4
-19
lines changed

3 files changed

+4
-19
lines changed

jhu/delphi_jhu/geo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
INCIDENCE_BASE = 100000
66

7-
def geo_map(df: pd.DataFrame, geo_res: str, sensor: str):
7+
def geo_map(df: pd.DataFrame, geo_res: str):
88
"""
99
Maps a DataFrame df, which contains data at the county resolution, and
1010
aggregate it to the geographic resolution geo_res.

jhu/delphi_jhu/pull.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# -*- coding: utf-8 -*-
22

33
import re
4-
from delphi_utils import GeoMapper
54
import pandas as pd
65
import numpy as np
6+
from delphi_utils import GeoMapper
77

88
def detect_date_col(col_name: str):
99
"""determine if column name is a date"""
10-
date_match = re.match('\d{1,2}\/\d{1,2}\/\d{1,2}', col_name)
10+
date_match = re.match(r'\d{1,2}\/\d{1,2}\/\d{1,2}', col_name)
1111
if date_match:
1212
return True
1313
return False
@@ -51,9 +51,6 @@ def pull_jhu_data(base_url: str, metric: str, pop_df: pd.DataFrame) -> pd.DataFr
5151
pd.DataFrame
5252
Dataframe as described above.
5353
"""
54-
# Two metrics, two schema...
55-
MIN_FIPS = 1000
56-
MAX_FIPS = 73000
5754

5855
# Read data
5956
df = pd.read_csv(base_url.format(metric=metric))
@@ -70,21 +67,9 @@ def pull_jhu_data(base_url: str, metric: str, pop_df: pd.DataFrame) -> pd.DataFr
7067
)
7168
df["timestamp"] = pd.to_datetime(df["timestamp"])
7269

73-
7470
gmpr = GeoMapper()
7571
df = gmpr.jhu_uid_to_county(df, jhu_col="UID", date_col='timestamp')
7672

77-
"""
78-
df = df[
79-
(
80-
(fips_int >= MIN_FIPS) # US non-state territories
81-
& (fips_int < MAX_FIPS)
82-
) # "Uncategorized", etc.
83-
# Get Fake FIPS for unassigned cases
84-
| np.logical_and(fips_int >= 90001,
85-
fips_int <= 90056)
86-
]
87-
"""
8873
# Merge in population LOWERCASE, consistent across confirmed and deaths
8974
# Set population as NAN for fake fips
9075
pop_df.rename(columns={'FIPS':'fips'}, inplace=True)

jhu/delphi_jhu/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def run_module():
9292
print(metric, geo_res, sensor, smoother)
9393
df = dfs[metric]
9494
# Aggregate to appropriate geographic resolution
95-
df = geo_map(df, geo_res, sensor)
95+
df = geo_map(df, geo_res)
9696
df["val"] = SMOOTHERS_MAP[smoother][0](df[sensor].values)
9797
df["se"] = np.nan
9898
df["sample_size"] = np.nan

0 commit comments

Comments
 (0)