Skip to content

Commit 92742d5

Browse files
authored
Merge pull request #395 from chinandrew/update-lag-issue
Have nowcasting acquisition use issue date from file
2 parents 2395b48 + f2b721e commit 92742d5

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

integrations/acquisition/covidcast_nowcast/test_csv_uploading.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ def test_uploading(self):
6868
# print full diff if something unexpected comes out
6969
self.maxDiff=None
7070

71-
receiving_dir = '/common/covidcast_nowcast/receiving/src/'
72-
success_dir = '/common/covidcast_nowcast/archive/successful/src/'
73-
failed_dir = '/common/covidcast_nowcast/archive/failed/src/'
71+
receiving_dir = '/common/covidcast_nowcast/receiving/issue_20200421/src/'
72+
success_dir = '/common/covidcast_nowcast/archive/successful/issue_20200421/src/'
73+
failed_dir = '/common/covidcast_nowcast/archive/failed/issue_20200421/src/'
7474
os.makedirs(receiving_dir, exist_ok=True)
7575

7676
# valid
@@ -125,7 +125,7 @@ def test_duplicate_row(self):
125125
# print full diff if something unexpected comes out
126126
self.maxDiff=None
127127

128-
receiving_dir = '/common/covidcast_nowcast/receiving/src/'
128+
receiving_dir = '/common/covidcast_nowcast/receiving/issue_20200425/src/'
129129
os.makedirs(receiving_dir, exist_ok=True)
130130

131131
with open(receiving_dir + '20200419_state_sig.csv', 'w') as f:
@@ -146,8 +146,8 @@ def test_duplicate_row(self):
146146
'time_value': 20200419,
147147
'geo_value': 'ca',
148148
'value': 2,
149-
'issue': 20200421,
150-
'lag': 2,
149+
'issue': 20200425,
150+
'lag': 6,
151151
'signal': 'sig',
152152
}],
153153
'message': 'success',

src/acquisition/covidcast_nowcast/load_sensors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from shutil import move
2+
from datetime import datetime
23
import os
34
import time
45

@@ -36,7 +37,7 @@ def main(csv_path: str = SENSOR_CSV_PATH) -> None:
3637
"""
3738
user, pw = secrets.db.epi
3839
engine = sqlalchemy.create_engine(f"mysql+pymysql://{user}:{pw}@{secrets.db.host}/{DB_NAME}")
39-
for filepath, attribute in CsvImporter.find_csv_files(csv_path):
40+
for filepath, attribute in CsvImporter.find_issue_specific_csv_files(csv_path):
4041
if attribute is None:
4142
_move_after_processing(filepath, success=False)
4243
continue

tests/acquisition/covidcast_nowcast/test_load_sensors.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ def test_load_and_prepare_file(self):
2424
"test_signal",
2525
"test_time_type",
2626
"test_geo_type",
27-
"test_time_value",
28-
"test_issue_value",
29-
"test_lag_value")
27+
20201231,
28+
20210102,
29+
3)
3030

3131
test_df = load_and_prepare_file(StringIO("sensor_name,geo_value,value\ntestname,01001,1.5"), test_attributes)
3232
pd.testing.assert_frame_equal(test_df,
@@ -37,8 +37,8 @@ def test_load_and_prepare_file(self):
3737
"signal": ["test_signal"],
3838
"time_type": ["test_time_type"],
3939
"geo_type": ["test_geo_type"],
40-
"time_value": ["test_time_value"],
41-
"issue": ["test_issue_value"],
42-
"lag": ["test_lag_value"],
40+
"time_value": [20201231],
41+
"issue": [20210102],
42+
"lag": [3],
4343
"value_updated_timestamp": [12345]})
4444
)

0 commit comments

Comments
 (0)