Skip to content

Commit d40d433

Browse files
committed
revert fname gen
1 parent 5205bb8 commit d40d433

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

e2e_batch/utils.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@
2727
)
2828

2929

30-
def generate_csv(fore_name, dose_amount, action_flag,
31-
vax_type="RSV", ods="YGM41",
32-
headers="NHS_NUMBER", same_id=False, file_key=False
33-
):
30+
def generate_csv(fore_name, dose_amount, action_flag, headers="NHS_NUMBER", same_id=False, file_key=False):
3431
"""
3532
Generate a CSV file with 2 or 3 rows depending on the action_flag.
3633
@@ -88,8 +85,13 @@ def generate_csv(fore_name, dose_amount, action_flag,
8885
data.append(create_row(unique_id, "fore_name", dose_amount, "UPDATE", headers))
8986

9087
df = pd.DataFrame(data)
91-
92-
file_name = get_file_name(vax_type, ods, "4" if file_key else "5")
88+
timestamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%S%f")[:-3]
89+
file_name = (
90+
f"COVID19_Vaccinations_v4_YGM41_{timestamp}.csv"
91+
if file_key
92+
else f"COVID19_Vaccinations_v5_YGM41_{timestamp}.csv"
93+
)
94+
# file_name = get_file_name(vax_type, ods, "4" if file_key else "5")
9395
df.to_csv(file_name, index=False, sep="|", quoting=csv.QUOTE_MINIMAL)
9496
return file_name
9597

@@ -98,8 +100,6 @@ def upload_file_to_s3(file_name, bucket, prefix):
98100
"""Upload the given file to the specified bucket under the provided prefix.
99101
Returns the S3 key if successful, or raises an exception."""
100102

101-
response = s3_client.list_buckets()
102-
103103
key = f"{prefix}{file_name}"
104104
try:
105105
with open(file_name, "rb") as f:
@@ -444,7 +444,9 @@ def generate_csv_with_ordered_100000_rows(file_name=None):
444444

445445
# Convert to DataFrame and save as CSV
446446
df = pd.DataFrame(full_data)
447-
file_name = get_file_name("RSV", "YGM41", "5") if not file_name else file_name
447+
timestamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%S%f")[:-3]
448+
file_name = f"RSV_Vaccinations_v5_YGM41_{timestamp}.csv" if not file_name else file_name
449+
# file_name = get_file_name("RSV", "YGM41", "5") if not file_name else file_name
448450
df.to_csv(file_name, index=False, sep="|", quoting=csv.QUOTE_MINIMAL)
449451
return file_name
450452

0 commit comments

Comments
 (0)