Skip to content

Commit bd44e40

Browse files
authored
Merge pull request #496 from cmu-delphi/deploy-changehc
Propagate changehc signal name hotfix
2 parents 35ab469 + dcd4903 commit bd44e40

File tree

5 files changed

+31
-23
lines changed

5 files changed

+31
-23
lines changed

ansible/templates/changehc-params-prod.json.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"static_file_dir": "./static",
33
"export_dir": "/common/covidcast/receiving/changehc",
44
"cache_dir": "./cache",
5-
"input_denom_file": "./tests/test_data/20200601_All_Outpatients_By_County.dat",
6-
"input_covid_file": "./tests/test_data/20200601_Covid_Outpatients_By_County.dat",
5+
"input_denom_file": null,
6+
"input_covid_file": null,
77
"start_date": "2020-02-01",
88
"end_date": null,
99
"drop_date": null,

changehc/.pylintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ disable=logging-format-interpolation,
77
# Allow pytest functions to be part of a class.
88
no-self-use,
99
# Allow pytest classes to have one test.
10-
too-few-public-methods
10+
too-few-public-methods,
11+
# Ignore
12+
R0903, C0301, R0914, C0103, W1203, E0611, R0902, R0913, W0105, W0611, W1401
1113

1214
[BASIC]
1315

changehc/delphi_changehc/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Registry for signal names and geo types"""
2-
SMOOTHED = "smoothed_cli"
3-
SMOOTHED_ADJ = "smoothed_adj_cli"
2+
SMOOTHED = "smoothed_covid"
3+
SMOOTHED_ADJ = "smoothed_adj_covid"
44
SIGNALS = [SMOOTHED, SMOOTHED_ADJ]
55
NA = "NA"
66
HRR = "hrr"

changehc/delphi_changehc/run.py

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,33 @@ def run_module():
2626

2727
logging.basicConfig(level=logging.DEBUG)
2828

29-
## download recent files from FTP server
30-
logging.info("downloading recent files through SFTP")
31-
download(params["cache_dir"], params["ftp_conn"])
32-
33-
## get end date from input file
3429
# the filenames are expected to be in the format:
3530
# Denominator: "YYYYMMDD_All_Outpatients_By_County.dat.gz"
3631
# Numerator: "YYYYMMDD_Covid_Outpatients_By_County.dat.gz"
3732

33+
assert (params["input_denom_file"] is None) == (params["input_covid_file"] is None), \
34+
"exactly one of denom and covid files are provided"
35+
3836
if params["drop_date"] is None:
39-
dropdate_denom = datetime.strptime(
40-
Path(params["input_denom_file"]).name.split("_")[0], "%Y%m%d"
41-
)
42-
43-
dropdate_covid = datetime.strptime(
44-
Path(params["input_covid_file"]).name.split("_")[0], "%Y%m%d"
45-
)
46-
assert dropdate_denom == dropdate_covid, "different drop dates for data files"
47-
dropdate_dt = dropdate_denom
37+
# files are dropped about 8pm the day after the issue date
38+
dropdate_dt = (datetime.now() - timedelta(days=1,hours=20))
39+
dropdate_dt = dropdate_dt.replace(hour=0,minute=0,second=0,microsecond=0)
4840
else:
4941
dropdate_dt = datetime.strptime(params["drop_date"], "%Y-%m-%d")
42+
filedate = dropdate_dt.strftime("%Y%m%d")
43+
44+
if params["input_denom_file"] is None:
45+
46+
## download recent files from FTP server
47+
logging.info("downloading recent files through SFTP")
48+
download(params["cache_dir"], params["ftp_conn"])
49+
50+
input_denom_file = "%s/%s_All_Outpatients_By_County.dat.gz" % (params["cache_dir"],filedate)
51+
input_covid_file = "%s/%s_Covid_Outpatients_By_County.dat.gz" % (params["cache_dir"],filedate)
52+
else:
53+
input_denom_file = params["input_denom_file"]
54+
input_covid_file = params["input_covid_file"]
55+
5056
dropdate = str(dropdate_dt.date())
5157

5258
# range of estimates to produce
@@ -93,8 +99,8 @@ def run_module():
9399
params["se"]
94100
)
95101
su_inst.update_sensor(
96-
params["input_denom_file"],
97-
params["input_covid_file"],
102+
input_denom_file,
103+
input_covid_file,
98104
params["export_dir"]
99105
)
100106
logging.info("finished %s", geo)

changehc/params.json.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"static_file_dir": "./static",
33
"export_dir": "./receiving",
44
"cache_dir": "./cache",
5-
"input_denom_file": "./tests/test_data/20200601_All_Outpatients_By_County.dat",
6-
"input_covid_file": "./tests/test_data/20200601_Covid_Outpatients_By_County.dat",
5+
"input_denom_file": null,
6+
"input_covid_file": null,
77
"start_date": "2020-02-01",
88
"end_date": null,
99
"drop_date": null,

0 commit comments

Comments
 (0)