diff --git a/fieldExtraction/src/investment/file_processing.py b/fieldExtraction/src/investment/file_processing.py index 63fffbe..5f6dad2 100644 --- a/fieldExtraction/src/investment/file_processing.py +++ b/fieldExtraction/src/investment/file_processing.py @@ -32,21 +32,24 @@ def process_file(file_object, all_dataset, run_timestamp): exhibit_pages, exhibit_chunk_mapping = preprocess.one_to_n_exhibit_chunking(text_dict, filename) print(f"{datetime_str()} Preprocessing Complete - {filename}") + ################## ONE TO N ################## + if string_utils.contains_reimbursement(contract_text): + one_to_n_results = run_one_to_n_prompts(filename, text_dict, exhibit_pages, exhibit_chunk_mapping, all_dataset) # Return df + one_to_n_results['CONTRACT_FILE_NAME'] = filename + print(f"{datetime_str()} One to N Complete - {filename}") + else: + one_to_n_results = {'CONTRACT_FILE_NAME' : filename} + print(f"{datetime_str()} No One to N Found, Skipping - {filename}") + ################## ONE TO ONE ################## one_to_one_results = run_one_to_one_prompts(filename, contract_text, text_dict, top_sheet_dict) # Return df one_to_one_results['CONTRACT_FILE_NAME'] = filename print(f"{datetime_str()} One to One Complete - {filename}") # one_to_one_results = {"CONTRACT_FILE_NAME" : filename} - ################## ONE TO N ################## - if string_utils.contains_reimbursement(contract_text): - one_to_n_results = run_one_to_n_prompts(filename, text_dict, exhibit_pages, exhibit_chunk_mapping, all_dataset) # Return df - one_to_n_results['CONTRACT_FILE_NAME'] = filename - contract_results = pd.merge(one_to_one_results, one_to_n_results, how='outer', on='CONTRACT_FILE_NAME') - else: - contract_results = one_to_one_results - print(f"{datetime_str()} One to N Complete - {filename}") - + ################## MERGE ################## + contract_results = pd.merge(one_to_one_results, one_to_n_results, how='outer', on='CONTRACT_FILE_NAME') + ################## AARETE-DERIVED ################## final_results = aarete_derived.get_crosswalk_and_derived(contract_results, filename) print(f"{datetime_str()} AArete-Derived Complete - {filename}") diff --git a/fieldExtraction/src/prompts/investment_prompts.json b/fieldExtraction/src/prompts/investment_prompts.json index bd347fe..50a2025 100644 --- a/fieldExtraction/src/prompts/investment_prompts.json +++ b/fieldExtraction/src/prompts/investment_prompts.json @@ -322,8 +322,8 @@ { "field_name": "AARETE_DERIVED_PROV_TYPE", "relationship": "one_to_n", - "field_type": "service_breakout", - "prompt": "What Provider Type does the Service and Methodology apply to? Choose ONLY from the following: {valid_values}.", + "field_type": "exhibit_level", + "prompt": "What Provider Type does the Exhibit apply to? Choose ONLY from the following: {valid_values}. If there is no obvious answer, write 'N/A'.", "valid_values": "VALID_PROV_TYPE" }, {