From 5d5f633f02ec2597c1b02d8b84b7abdeea8dbabd Mon Sep 17 00:00:00 2001 From: Alex Galarce Date: Wed, 11 Jun 2025 23:15:31 +0000 Subject: [PATCH] Merged in feature/formatted-prov-info-json (pull request #572) Feature/formatted prov info json * Add newline and pipe-delimited formatting for provider info JSON * Add new investment column names for nicely-formatted PROV_INFO_JSON Approved-by: Katon Minhas --- fieldExtraction/src/constants/investment_columns.py | 2 ++ fieldExtraction/src/investment/file_processing.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/fieldExtraction/src/constants/investment_columns.py b/fieldExtraction/src/constants/investment_columns.py index 9b49082..f598c1d 100644 --- a/fieldExtraction/src/constants/investment_columns.py +++ b/fieldExtraction/src/constants/investment_columns.py @@ -17,6 +17,8 @@ COLUMN_ORDER = [ "PROV_OTHER_NPI", "PROV_OTHER_NAME_FULL", "PROV_INFO_JSON", + "PROV_INFO_JSON_NEWLINE", + "PROV_INFO_JSON_PIPE", "AARETE_DERIVED_EFFECTIVE_DT", "TERMINATION_DT", "AARETE_DERIVED_TERMINATION_DT", diff --git a/fieldExtraction/src/investment/file_processing.py b/fieldExtraction/src/investment/file_processing.py index a9c35e8..9d5614b 100644 --- a/fieldExtraction/src/investment/file_processing.py +++ b/fieldExtraction/src/investment/file_processing.py @@ -78,6 +78,12 @@ def run_one_to_one_prompts(filename, contract_text, text_dict, top_sheet_dict, d regex_answers_dict = one_to_one_funcs.run_provider_info_fields(contract_text, text_dict, filename) one_to_one_results = {} one_to_one_results['PROV_INFO_JSON'] = json.dumps(regex_answers_dict) + ## Easier formatting for customers: + # Create newline-delimited version + one_to_one_results['PROV_INFO_JSON_NEWLINE'] = '\n'.join([json.dumps(provider) for provider in regex_answers_dict]) + # Create pipe-delimited version + one_to_one_results['PROV_INFO_JSON_PIPE'] = '|'.join([json.dumps(provider) for provider in regex_answers_dict]) + one_to_one_results = merge_provider_info(one_to_one_results, regex_answers_dict) # What if the TIN/NPI regexes don't find anything? Add PROV_GROUP_NAME_FULL to full context