Skip to content

Commit 5ce253b

Browse files
committed
Someone actually changed it to timestamp
1 parent 9517792 commit 5ce253b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

changehc/delphi_changehc/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Config:
1919
BURN_IN_PERIOD = timedelta(days=1)
2020

2121
# shift dates forward for labeling purposes
22-
DAY_SHIFT = timedelta(days=1)
22+
DAY_SHIFT = timedelta(days=0)
2323

2424
## data columns
2525
COVID_COL = "COVID"

changehc/tests/test_update_sensor.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ def test_update_sensor_output_daterange(self):
138138
"num": [0, 100, 200, 300, 400, 500, 600, 100, 200, 300, 400, 500, 600] * 2,
139139
"fips": ["01001"] * 13 + ["42003"] * 13,
140140
"den": [30, 50, 50, 10, 1, 5, 5, 50, 50, 50, 0, 0, 0] * 2,
141-
"date": list(pd.date_range("20200301", "20200313")) * 2
142-
}).set_index(["fips", "date"])
141+
"timestamp": list(pd.date_range("20200301", "20200313")) * 2
142+
}).set_index(["fips", "timestamp"])
143143
startdates = ["2020-03-01", "2020-03-05"]
144144
outputs = {s:{} for s in startdates}
145145
for startdate in startdates:
@@ -182,7 +182,7 @@ def test_write_to_csv_results(self):
182182
"val": [0.1, 0.5, 1.5] + [1, 2, 3],
183183
"se": [0.1, 1, 1.1] + [0.5, np.nan, 0.5],
184184
"sample_size": [np.nan] * 6,
185-
"timestamp": pd.to_datetime(["2020-05-01", "2020-05-02", "2020-05-04"] * 2),
185+
"timestamp": pd.to_datetime(["2020-05-02", "2020-05-03", "2020-05-05"] * 2),
186186
"include": [True, True, True] + [True, False, True],
187187
"geo_id": ["a"] * 3 + ["b"] * 3,
188188
})
@@ -238,7 +238,7 @@ def test_write_to_csv_with_se_results(self):
238238
"val": [0.1, 0.5, 1.5] + [1, 2, 3],
239239
"se": [0.1, 1, 1.1] + [0.5, np.nan, 0.5],
240240
"sample_size": [np.nan] * 6,
241-
"timestamp": pd.to_datetime(["2020-05-01", "2020-05-02", "2020-05-04"] * 2),
241+
"timestamp": pd.to_datetime(["2020-05-02", "2020-05-03", "2020-05-05"] * 2),
242242
"include": [True, True, True] + [True, False, True],
243243
"geo_id": ["a"] * 3 + ["b"] * 3,
244244
})
@@ -272,7 +272,7 @@ def test_write_to_csv_wrong_results(self):
272272
"val": [0.1, 0.5, 1.5] + [1, 2, 3],
273273
"se": [0.1, 1, 1.1] + [0.5, 0.5, 0.5],
274274
"sample_size": [np.nan] * 6,
275-
"timestamp": pd.to_datetime(["2020-05-01", "2020-05-02", "2020-05-04"] * 2),
275+
"timestamp": pd.to_datetime(["2020-05-02", "2020-05-03", "2020-05-05"] * 2),
276276
"include": [True, True, True] + [True, False, True],
277277
"geo_id": ["a"] * 3 + ["b"] * 3,
278278
}).set_index(["timestamp", "geo_id"]).sort_index()
@@ -282,7 +282,7 @@ def test_write_to_csv_wrong_results(self):
282282
# nan value for included loc-date
283283
res1 = res0.copy()
284284
res1 = res1[res1['include']]
285-
res1.loc[("2020-05-01", "a"), "val"] = np.nan
285+
res1.loc[("2020-05-02", "a"), "val"] = np.nan
286286
res1.reset_index(inplace=True)
287287
with pytest.raises(AssertionError):
288288
write_to_csv(
@@ -298,7 +298,7 @@ def test_write_to_csv_wrong_results(self):
298298
# nan se for included loc-date
299299
res2 = res0.copy()
300300
res2 = res2[res2['include']]
301-
res2.loc[("2020-05-01", "a"), "se"] = np.nan
301+
res2.loc[("2020-05-02", "a"), "se"] = np.nan
302302
res2.reset_index(inplace=True)
303303
with pytest.raises(AssertionError):
304304
write_to_csv(
@@ -314,7 +314,7 @@ def test_write_to_csv_wrong_results(self):
314314
# large se value
315315
res3 = res0.copy()
316316
res3 = res3[res3['include']]
317-
res3.loc[("2020-05-01", "a"), "se"] = 10
317+
res3.loc[("2020-05-02", "a"), "se"] = 10
318318
res3.reset_index(inplace=True)
319319
with pytest.raises(AssertionError):
320320
write_to_csv(

0 commit comments

Comments
 (0)