From f4cc439e11cfa397c8e7185227fb2043b8d65b4d Mon Sep 17 00:00:00 2001 From: Amaris Sim Date: Wed, 15 Jan 2025 10:36:13 -0500 Subject: [PATCH 1/3] issue date must be 8 digits --- nhsn/delphi_nhsn/patch.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nhsn/delphi_nhsn/patch.py b/nhsn/delphi_nhsn/patch.py index 31fae3070..ed1e24bf6 100644 --- a/nhsn/delphi_nhsn/patch.py +++ b/nhsn/delphi_nhsn/patch.py @@ -79,10 +79,11 @@ def patch(params): patch_list = filter_source_files(source_files) for file in patch_list: issue_date = datetime.strptime(file.name.split(".")[0], "%Y%m%d") - current_issue_ew = Week.fromdate(issue_date) logger.info("Running issue", issue_date=issue_date.strftime("%Y-%m-%d")) params["patch"]["issue_date"] = issue_date.strftime("%Y%m%d") - current_issue_dir = f"{params['patch']['patch_dir']}/issue_{current_issue_ew}/nhsn" + # regardless of week date type or not the directory name must be issue_date_yyyymmdd + # conversion in done in acquisition + current_issue_dir = f"{params['patch']['patch_dir']}/issue_{issue_date.strftime('%Y%m%d')}/nhsn" makedirs(current_issue_dir, exist_ok=True) params["common"]["export_dir"] = current_issue_dir params["common"]["custom_run"] = True From ae1e8be99822694836b9bf3970642397782d4a38 Mon Sep 17 00:00:00 2001 From: Amaris Sim Date: Wed, 15 Jan 2025 10:44:12 -0500 Subject: [PATCH 2/3] fixed test --- nhsn/tests/test_patch.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nhsn/tests/test_patch.py b/nhsn/tests/test_patch.py index 639d5d262..066ef4736 100644 --- a/nhsn/tests/test_patch.py +++ b/nhsn/tests/test_patch.py @@ -112,8 +112,7 @@ def test_patch(self, params_w_patch): issue_dt_str = issue_path.name.replace("issue_", "") for file in Path(issue_path / "nhsn").iterdir(): df = pd.read_csv(file) - val = Week.fromdate(datetime.strptime(str(int(df["val"][0])), "%Y%m%d")) - assert issue_dt_str == str(val) + assert issue_dt_str == str(int(df["val"][0])) # clean up shutil.rmtree(f"{TEST_DIR}/patch_dir") From 7e3bfbe8dd14dd1c61d9c66809c48429822fd674 Mon Sep 17 00:00:00 2001 From: Amaris Sim Date: Wed, 15 Jan 2025 15:56:27 -0500 Subject: [PATCH 3/3] suggested changes --- nhsn/delphi_nhsn/patch.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nhsn/delphi_nhsn/patch.py b/nhsn/delphi_nhsn/patch.py index ed1e24bf6..cefb0e564 100644 --- a/nhsn/delphi_nhsn/patch.py +++ b/nhsn/delphi_nhsn/patch.py @@ -78,12 +78,12 @@ def patch(params): patch_list = filter_source_files(source_files) for file in patch_list: - issue_date = datetime.strptime(file.name.split(".")[0], "%Y%m%d") - logger.info("Running issue", issue_date=issue_date.strftime("%Y-%m-%d")) - params["patch"]["issue_date"] = issue_date.strftime("%Y%m%d") - # regardless of week date type or not the directory name must be issue_date_yyyymmdd + issue_date_str = file.name.split(".")[0] + logger.info("Running issue", issue_date=datetime.strptime(issue_date_str, "%Y%m%d").strftime("%Y-%m-%d")) + params["patch"]["issue_date"] = issue_date_str + # regardless of week date type or not the directory name must be issue_date_YYYYMMDD # conversion in done in acquisition - current_issue_dir = f"{params['patch']['patch_dir']}/issue_{issue_date.strftime('%Y%m%d')}/nhsn" + current_issue_dir = f"{params['patch']['patch_dir']}/issue_{issue_date_str}/nhsn" makedirs(current_issue_dir, exist_ok=True) params["common"]["export_dir"] = current_issue_dir params["common"]["custom_run"] = True