Skip to content

Commit fe51a4e

Browse files
authored
Merge pull request #861 from cmu-delphi/chng_newfiles
CHNG New file format and location
2 parents d145a0c + 5a01206 commit fe51a4e

12 files changed

+37
-562179
lines changed

changehc/delphi_changehc/config.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ class Config:
3434
ID_COLS = [DATE_COL] + [GEO_COL]
3535
FILT_COLS = ID_COLS + COUNT_COLS
3636

37-
DENOM_COLS = [GEO_COL, DATE_COL, DENOM_COL]
38-
COVID_COLS = [GEO_COL, DATE_COL, COVID_COL]
39-
FLU_COLS = [GEO_COL, DATE_COL, FLU_COL]
40-
MIXED_COLS = [GEO_COL, DATE_COL, MIXED_COL]
41-
FLU_LIKE_COLS = [GEO_COL, DATE_COL, FLU_LIKE_COL]
42-
COVID_LIKE_COLS = [GEO_COL, DATE_COL, COVID_LIKE_COL]
37+
DENOM_COLS = [DATE_COL, GEO_COL, DENOM_COL]
38+
COVID_COLS = [DATE_COL, GEO_COL, COVID_COL]
39+
FLU_COLS = [DATE_COL, GEO_COL, FLU_COL]
40+
MIXED_COLS = [DATE_COL, GEO_COL, MIXED_COL]
41+
FLU_LIKE_COLS = [DATE_COL, GEO_COL, FLU_LIKE_COL]
42+
COVID_LIKE_COLS = [DATE_COL, GEO_COL, COVID_LIKE_COL]
4343

4444
DENOM_DTYPES = {DATE_COL: str, DENOM_COL: str, GEO_COL: str}
4545
COVID_DTYPES = {DATE_COL: str, COVID_COL: str, GEO_COL: str}

changehc/delphi_changehc/download_ftp_files.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def get_files_from_dir(sftp, filedate, out_path):
3232
not path.exists(path.join(out_path, filename)):
3333
filepaths_to_download[filename] = path.join(out_path, filename)
3434

35-
# make sure we don't download more than 2 files per day
36-
assert len(filepaths_to_download) <= 2, "more files dropped than expected"
35+
# make sure we don't download more than 6 files per day
36+
assert len(filepaths_to_download) <= 6, "more files dropped than expected"
3737

3838
# download!
3939
for infile, outfile in filepaths_to_download.items():
@@ -60,10 +60,7 @@ def download_covid(filedate, out_path, ftp_conn):
6060
allow_agent=False, look_for_keys=False)
6161
sftp = client.open_sftp()
6262

63-
sftp.chdir('/dailycounts/All_Outpatients_By_County')
64-
get_files_from_dir(sftp, filedate, out_path)
65-
66-
sftp.chdir('/dailycounts/Covid_Outpatients_By_County')
63+
sftp.chdir('/countproducts')
6764
get_files_from_dir(sftp, filedate, out_path)
6865

6966
finally:
@@ -90,19 +87,7 @@ def download_cli(filedate, out_path, ftp_conn):
9087
allow_agent=False, look_for_keys=False)
9188
sftp = client.open_sftp()
9289

93-
sftp.chdir('/dailycounts/All_Outpatients_By_County')
94-
get_files_from_dir(sftp, filedate, out_path)
95-
96-
sftp.chdir('/dailycounts/Flu_Patient_Count_By_County')
97-
get_files_from_dir(sftp, filedate, out_path)
98-
99-
sftp.chdir('/dailycounts/Mixed_Patient_Count_By_County')
100-
get_files_from_dir(sftp, filedate, out_path)
101-
102-
sftp.chdir('/dailycounts/Flu_Like_Patient_Count_By_County')
103-
get_files_from_dir(sftp, filedate, out_path)
104-
105-
sftp.chdir('/dailycounts/Covid_Like_Patient_Count_By_County')
90+
sftp.chdir('/countproducts')
10691
get_files_from_dir(sftp, filedate, out_path)
10792

10893
finally:

changehc/delphi_changehc/load_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def load_chng_data(filepath, dropdate, base_geo,
4444

4545
data = pd.read_csv(
4646
filepath,
47-
sep="|",
47+
sep=",",
4848
header=None,
4949
names=col_names,
5050
dtype=col_types,

changehc/delphi_changehc/run.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ def retrieve_files(params, filedate, logger):
3131
if "cli" in params["indicator"]["types"]:
3232
download_cli(filedate, params["indicator"]["input_cache_dir"], params["indicator"]["ftp_conn"])
3333

34-
denom_file = "%s/%s_All_Outpatients_By_County.dat.gz" % (params["indicator"]["input_cache_dir"],filedate)
35-
covid_file = "%s/%s_Covid_Outpatients_By_County.dat.gz" % (params["indicator"]["input_cache_dir"],filedate)
36-
flu_file = "%s/%s_Flu_Patient_Count_By_County.dat.gz" % (params["indicator"]["input_cache_dir"],filedate)
37-
mixed_file = "%s/%s_Mixed_Patient_Count_By_County.dat.gz" % (params["indicator"]["input_cache_dir"],filedate)
38-
flu_like_file = "%s/%s_Flu_Like_Patient_Count_By_County.dat.gz" % (params["indicator"]["input_cache_dir"],filedate)
39-
covid_like_file = "%s/%s_Covid_Like_Patient_Count_By_County.dat.gz" % (params["indicator"]["input_cache_dir"],filedate)
34+
denom_file = "%s/%s_Counts_Products_Denom.dat.gz" % (params["indicator"]["input_cache_dir"],filedate)
35+
covid_file = "%s/%s_Counts_Products_Covid.dat.gz" % (params["indicator"]["input_cache_dir"],filedate)
36+
flu_file = "%s/%s_Counts_Products_Flu.dat.gz" % (params["indicator"]["input_cache_dir"],filedate)
37+
mixed_file = "%s/%s_Counts_Products_Mixed.dat.gz" % (params["indicator"]["input_cache_dir"],filedate)
38+
flu_like_file = "%s/%s_Counts_Products_Flu_Like.dat.gz" % (params["indicator"]["input_cache_dir"],filedate)
39+
covid_like_file = "%s/%s_Counts_Products_Covid_Like.dat.gz" % (params["indicator"]["input_cache_dir"],filedate)
4040
else:
4141
denom_file = files["denom"]
4242
covid_file = files["covid"]

0 commit comments

Comments
 (0)