From 91d3680ee4d04de98db58c0b0966b8d0ce6bc25a Mon Sep 17 00:00:00 2001 From: Alex Galarce Date: Mon, 16 Dec 2024 22:08:04 +0000 Subject: [PATCH] Merged in bugfix/effective-date-logic (pull request #335) fix logic error when effective date reformatting is applied twice when the date is already filled * fix logic error when effective date reformatting is applied twice when the date is already filled Approved-by: Katon Minhas --- fieldExtraction/src/cnc_hotfix.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fieldExtraction/src/cnc_hotfix.py b/fieldExtraction/src/cnc_hotfix.py index 5ba9dda..33f78aa 100644 --- a/fieldExtraction/src/cnc_hotfix.py +++ b/fieldExtraction/src/cnc_hotfix.py @@ -627,15 +627,15 @@ def clean_contract_effective_date( except Exception as e: # print(f"Error processing {file_name}, got error: {e}") answer,d,page_list,claude_answer_raw = "N/A",{},[],"" + try: + corrected_date = utils.convert_to_us_date_format(str(answer)) # apply date formatting fix + except utils.InvalidDateException as e: + corrected_date = "N/A" else: - answer = contract_effective_date + corrected_date = contract_effective_date # don't correct format when we already have an answer d,page_list,claude_answer_raw = {},[],"" - try: - corrected_date = utils.convert_to_us_date_format(str(answer)) # apply date formatting fix - except utils.InvalidDateException as e: - corrected_date = "N/A" - # print(f"Effective Date for {file_name} --> {corrected_date}") + df["Contract Effective Date_corrected"] = corrected_date df['Log Information'] = str(d)