Skip to content

Commit e55e141

Browse files
committed
Delete date_col="timestamp" statements
1 parent 70f4b43 commit e55e141

File tree

11 files changed

+14
-31
lines changed

11 files changed

+14
-31
lines changed

_template_python/delphi_NAME/run.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ def run_module(params):
4747
## aggregate & smooth
4848
## TODO: add num/prop variations if needed
4949
for sensor, smoother, geo in product(SIGNALS, SMOOTHERS, GEOS):
50-
df = mapper.replace_geocode(
51-
all_data, "zip", geo,
52-
new_col="geo_id",
53-
date_col="timestamp")
50+
df = mapper.replace_geocode(all_data, "zip", geo, new_col="geo_id")
5451
## TODO: recompute sample_size, se here if not NA
5552
df["val"] = df[["geo_id", "val"]].groupby("geo_id")["val"].transform(
5653
smoother[0].smooth

combo_cases_and_deaths/delphi_combo_cases_and_deaths/run.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@ def compute_special_geo_dfs(df, signal, geo):
7272
df = GMPR.replace_geocode(df,
7373
from_col="geo_id",
7474
from_code="fips",
75-
new_code="state_code",
76-
date_col="timestamp")
75+
new_code="state_code")
7776
df = GMPR.add_population_column(df, "state_code") # use total state population
78-
df = GMPR.replace_geocode(df, from_code="state_code", new_code=geo, date_col="timestamp")
77+
df = GMPR.replace_geocode(df, from_code="state_code", new_code=geo)
7978
if signal.endswith("_prop"):
8079
df["val"] = df["val"]/df["population"] * 100000
8180
df.drop("population", axis=1, inplace=True)

covid_act_now/delphi_covid_act_now/geo.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ def geo_map(df: pd.DataFrame, geo_res: str) -> pd.DataFrame:
9292

9393
df = (df
9494
.loc[:, ["fips", "timestamp", "pcr_tests_positive", "pcr_tests_total"]]
95-
.pipe(gmpr.replace_geocode, "fips", geo_res, new_col="geo_id",
96-
date_col="timestamp")
95+
.pipe(gmpr.replace_geocode, "fips", geo_res, new_col="geo_id")
9796
.rename(columns={"pcr_tests_total": "sample_size"})
9897
.assign(val=positivity_rate, se=std_err)
9998
.reset_index()

google_symptoms/delphi_google_symptoms/run.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ def run_module(params):
9090
if geo_res == "state":
9191
df_pull = dfs["state"]
9292
elif geo_res in ["hhs", "nation"]:
93-
df_pull = gmpr.replace_geocode(dfs["county"], "fips", geo_res, from_col="geo_id",
94-
date_col="timestamp")
93+
df_pull = gmpr.replace_geocode(dfs["county"], "fips", geo_res, from_col="geo_id")
9594
df_pull.rename(columns={geo_res: "geo_id"}, inplace=True)
9695
else:
9796
df_pull = geo_map(dfs["county"], geo_res)

hhs_hosp/delphi_hhs/run.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,7 @@ def make_geo(state, geo, geo_mapper):
162162
if geo == "state":
163163
exported = state.rename(columns={"state": "geo_id"})
164164
else:
165-
exported = geo_mapper.replace_geocode(
166-
state, "state_code", geo,
167-
new_col="geo_id",
168-
date_col="timestamp")
165+
exported = geo_mapper.replace_geocode(state, "state_code", geo, new_col="geo_id")
169166
exported["se"] = np.nan
170167
exported["sample_size"] = np.nan
171168
return exported

jhu/delphi_jhu/geo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ def geo_map(df: pd.DataFrame, geo_res: str, sensor: str):
4444
elif geo_res in ("state", "hhs", "nation"):
4545
geo = "state_id" if geo_res == "state" else geo_res
4646
df = df.append(unassigned_counties) if not unassigned_counties.empty else df
47-
df = gmpr.replace_geocode(df, "fips", geo, new_col="geo_id", date_col="timestamp")
47+
df = gmpr.replace_geocode(df, "fips", geo, new_col="geo_id")
4848
else:
49-
df = gmpr.replace_geocode(df, "fips", geo_res, new_col="geo_id", date_col="timestamp")
49+
df = gmpr.replace_geocode(df, "fips", geo_res, new_col="geo_id")
5050
df["incidence"] = df["new_counts"] / df["population"] * INCIDENCE_BASE
5151
df["cumulative_prop"] = df["cumulative_counts"] / df["population"] * INCIDENCE_BASE
5252
return df

jhu/delphi_jhu/pull.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ def pull_jhu_data(base_url: str, metric: str, gmpr: GeoMapper) -> pd.DataFrame:
9999
df = download_data(base_url, metric)
100100

101101
gmpr = GeoMapper()
102-
df = gmpr.replace_geocode(
103-
df, "jhu_uid", "fips", from_col="UID", date_col="timestamp"
104-
)
102+
df = gmpr.replace_geocode(df, "jhu_uid", "fips", from_col="UID")
105103
df = create_diffs_column(df)
106104
# Final sanity checks
107105
sanity_check_data(df)

jhu/tests/test_geo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_msa_hrr(self, jhu_confirmed_test_data):
107107
new_df = geo_map(test_df, geo, "cumulative_prop")
108108
gmpr = GeoMapper()
109109
test_df = gmpr.add_population_column(test_df, "fips")
110-
test_df = gmpr.replace_geocode(test_df, "fips", geo, date_col="timestamp")
110+
test_df = gmpr.replace_geocode(test_df, "fips", geo)
111111

112112
new_df = new_df.set_index(["geo_id", "timestamp"]).sort_index()
113113
test_df = test_df.set_index([geo, "timestamp"]).sort_index()

quidel_covidtest/delphi_quidel_covidtest/geo_maps.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Contains geographic mapping tools."""
22
from delphi_utils import GeoMapper
33

4-
DATE_COL = "timestamp"
54
DATA_COLS = ['totalTest', 'numUniqueDevices', 'positiveTest', "population"]
65
GMPR = GeoMapper() # Use geo utils
76
GEO_KEY_DICT = {
@@ -21,8 +20,7 @@ def geo_map(geo_res, df):
2120
# Add population for each zipcode
2221
data = GMPR.add_population_column(data, "zip")
2322
# zip -> geo_res
24-
data = GMPR.replace_geocode(data, "zip", geo_key,
25-
date_col=DATE_COL, data_cols=DATA_COLS)
23+
data = GMPR.replace_geocode(data, "zip", geo_key, data_cols=DATA_COLS)
2624
if geo_res in ["state", "hhs", "nation"]:
2725
return data, geo_key
2826
# Add parent state

safegraph_patterns/delphi_safegraph_patterns/process.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,7 @@ def aggregate(df, metric, geo_res):
114114
gmpr = GeoMapper()
115115
geo_key = GEO_KEY_DICT[geo_res]
116116
df = gmpr.add_population_column(df, "zip")
117-
df = gmpr.replace_geocode(df,
118-
"zip",
119-
geo_key,
120-
date_col="timestamp",
121-
data_cols=[metric_count_name, "population"])
117+
df = gmpr.replace_geocode(df, "zip", geo_key, data_cols=[metric_count_name, "population"])
122118

123119
df[metric_prop_name] = df[metric_count_name] / df["population"] \
124120
* INCIDENCE_BASE

0 commit comments

Comments
 (0)