From 6679bf7f4764a6f1ee1cbe7e3570478d976ebe41 Mon Sep 17 00:00:00 2001 From: Karan Desai Date: Mon, 12 Jan 2026 21:29:53 +0000 Subject: [PATCH] Merged in feature/pc-functionality (pull request #835) bug fix for pc module * bug fix for pc module Approved-by: Katon Minhas --- fieldExtraction/src/investment/main.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/fieldExtraction/src/investment/main.py b/fieldExtraction/src/investment/main.py index 90827e2..549048f 100644 --- a/fieldExtraction/src/investment/main.py +++ b/fieldExtraction/src/investment/main.py @@ -228,7 +228,8 @@ def main(testing=False, test_params={}): if config.WRITE_TO_S3: doczy_output_for_pc = io_utils.write_s3(FINAL_RESULT_DF, "", run_timestamp, "final") if not ERROR_RESULT_DF.empty: - doczy_output_for_pc = io_utils.write_s3(ERROR_RESULT_DF, "", run_timestamp, "error") + io_utils.write_s3(ERROR_RESULT_DF, "", run_timestamp, "error") + logging.warning(f"{len(ERROR_RESULT_DF)} files failed processing - error results written to S3") # Export usage and cost tracking data to S3 only if both dataframes have data if not per_file_usage_df.empty and not batch_summary_df.empty: @@ -238,11 +239,16 @@ def main(testing=False, test_params={}): else: doczy_output_for_pc = io_utils.write_local(FINAL_RESULT_DF, "", run_timestamp, "final") if not ERROR_RESULT_DF.empty: - doczy_output_for_pc = io_utils.write_local(ERROR_RESULT_DF, "", run_timestamp, "error") + io_utils.write_local(ERROR_RESULT_DF, "", run_timestamp, "error") + logging.warning(f"{len(ERROR_RESULT_DF)} files failed processing - error results written locally") if config.PERFORM_PARENT_CHILD_MAPPING: - with timing_utils.timed_block("parent_child_mapping", log_level="INFO"): - parent_child_main.main(doczy_output_for_pc) + if FINAL_RESULT_DF.empty: + logging.warning("Skipping Parent-Child mapping: No successful results to process (FINAL_RESULT_DF is empty)") + else: + logging.info(f"Starting Parent-Child mapping with {len(FINAL_RESULT_DF)} records from: {doczy_output_for_pc}") + with timing_utils.timed_block("parent_child_mapping", log_level="INFO"): + parent_child_main.main(doczy_output_for_pc) # Export usage and cost tracking data locally only if both dataframes have data if not per_file_usage_df.empty and not batch_summary_df.empty: