Merged in bugfix/post-doczy-excel-output-types (pull request #960)
Bugfix/post doczy excel output types * Issue fix for output generation * lint format fix * Merged dev into bugfix/post-doczy-excel-output-types Approved-by: Siddhant Medar
This commit is contained in:
committed by
Katon Minhas
parent
50773656e9
commit
9c07257f76
+37
-1
@@ -987,9 +987,27 @@ def write_local(
|
|||||||
quoting=1,
|
quoting=1,
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
elif output_type == "post_doczy_excel":
|
||||||
|
output_dir = os.path.join(config.CONSOLIDATED_OUTPUT_DIRECTORY, run_timestamp)
|
||||||
|
os.makedirs(output_dir, exist_ok=True)
|
||||||
|
df.to_csv(
|
||||||
|
os.path.join(output_dir, f"{config.BATCH_ID}-POST-DOCZY-EXCEL.csv"),
|
||||||
|
index=False,
|
||||||
|
quoting=1,
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
elif output_type == "post_doczy_excel_summary":
|
||||||
|
output_dir = os.path.join(config.CONSOLIDATED_OUTPUT_DIRECTORY, run_timestamp)
|
||||||
|
os.makedirs(output_dir, exist_ok=True)
|
||||||
|
df.to_csv(
|
||||||
|
os.path.join(output_dir, f"{config.BATCH_ID}-POST-DOCZY-EXCEL-SUMMARY.csv"),
|
||||||
|
index=False,
|
||||||
|
quoting=1,
|
||||||
|
)
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
logging.error(
|
logging.error(
|
||||||
f"Unknown output_type: {output_type}. Valid types are: 'final', 'individual', 'error', 'usage', 'usage_summary', 'dtc', 'dtc_summary', 'pre_doczy', 'post_doczy', 'post_doczy_summary', 'qc_qa_validated', 'qc_qa_stats', 'cc_results_full', 'dashboard_results_full', 'qc_qa_cc_full', 'qc_qa_error', 'parent_child', 'individual_cc'"
|
f"Unknown output_type: {output_type}. Valid types are: 'final', 'individual', 'error', 'usage', 'usage_summary', 'dtc', 'dtc_summary', 'pre_doczy', 'post_doczy', 'post_doczy_summary', 'post_doczy_excel', 'post_doczy_excel_summary', 'qc_qa_validated', 'qc_qa_stats', 'cc_results_full', 'dashboard_results_full', 'qc_qa_cc_full', 'qc_qa_error', 'parent_child', 'individual_cc'"
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -1155,6 +1173,20 @@ def write_s3(
|
|||||||
config.S3_CLIENT.put_object(
|
config.S3_CLIENT.put_object(
|
||||||
Bucket=config.S3_OUTPUT_BUCKET, Key=output_path, Body=csv_buffer
|
Bucket=config.S3_OUTPUT_BUCKET, Key=output_path, Body=csv_buffer
|
||||||
)
|
)
|
||||||
|
elif output_type == "post_doczy_excel":
|
||||||
|
output_path = (
|
||||||
|
f"{config.BATCH_ID}/{run_timestamp}/{config.BATCH_ID}-POST-DOCZY-EXCEL.csv"
|
||||||
|
)
|
||||||
|
csv_buffer = df.to_csv(index=False).encode()
|
||||||
|
config.S3_CLIENT.put_object(
|
||||||
|
Bucket=config.S3_OUTPUT_BUCKET, Key=output_path, Body=csv_buffer
|
||||||
|
)
|
||||||
|
elif output_type == "post_doczy_excel_summary":
|
||||||
|
output_path = f"{config.BATCH_ID}/{run_timestamp}/{config.BATCH_ID}-POST-DOCZY-EXCEL-SUMMARY.csv"
|
||||||
|
csv_buffer = df.to_csv(index=False).encode()
|
||||||
|
config.S3_CLIENT.put_object(
|
||||||
|
Bucket=config.S3_OUTPUT_BUCKET, Key=output_path, Body=csv_buffer
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
# Fallback path for unknown output types
|
# Fallback path for unknown output types
|
||||||
output_path = f"{config.BATCH_ID}/{run_timestamp}/{config.BATCH_ID}-unknown-{output_type}.csv"
|
output_path = f"{config.BATCH_ID}/{run_timestamp}/{config.BATCH_ID}-unknown-{output_type}.csv"
|
||||||
@@ -1224,6 +1256,10 @@ def write_s3(
|
|||||||
logging.info(f"Saved QC/QA error file: {output_path}")
|
logging.info(f"Saved QC/QA error file: {output_path}")
|
||||||
elif output_type == "individual_cc":
|
elif output_type == "individual_cc":
|
||||||
logging.info(f"Saved individual CC file: {output_path}")
|
logging.info(f"Saved individual CC file: {output_path}")
|
||||||
|
elif output_type == "post_doczy_excel":
|
||||||
|
logging.info(f"Saved Post-Doczy Excel report file: {output_path}")
|
||||||
|
elif output_type == "post_doczy_excel_summary":
|
||||||
|
logging.info(f"Saved Post-Doczy Excel summary file: {output_path}")
|
||||||
else:
|
else:
|
||||||
logging.info(f"Saved unknown output type file: {output_path}")
|
logging.info(f"Saved unknown output type file: {output_path}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user