diff --git a/fieldExtraction/src/investment/aarete_derived.py b/fieldExtraction/src/investment/aarete_derived.py new file mode 100644 index 0000000..8d434e1 --- /dev/null +++ b/fieldExtraction/src/investment/aarete_derived.py @@ -0,0 +1,19 @@ +import src.config as config +from src.prompts.investment_prompts import Field, FieldSet + + +def get_aarete_derived(contract_answers: dict): + aarete_derived_fields = FieldSet(file_path=config.FIELD_JSON_PATH, field_type="aarete_derived") + + for field in aarete_derived_fields.fields: + pass + # 1. Get base field + # 2. Get base field answer from contract_answer + # 3. Run relevant prompt/crosswalk process + # 4. Add AARETE_DERIVED_ answers to contract_answers + + # contract_answers should have all fields, both CONTRACT_ and AARETE_DERIVED_ now + return contract_answers + + + diff --git a/fieldExtraction/src/investment/file_processing.py b/fieldExtraction/src/investment/file_processing.py index 1d20216..88ac305 100644 --- a/fieldExtraction/src/investment/file_processing.py +++ b/fieldExtraction/src/investment/file_processing.py @@ -7,6 +7,7 @@ import src.investment.one_to_n_funcs as one_to_n_funcs import src.investment.one_to_one_funcs as one_to_one_funcs import src.investment.postprocess as postprocess import src.investment.preprocess as preprocess +import src.investment.aarete_derived as aarete_derived import src.investment.smart_chunking_funcs as smart_chunking_funcs from src.prompts.investment_prompts import Field, FieldSet from src import config @@ -35,9 +36,12 @@ def process_file(file_object, run_timestamp): if string_utils.contains_reimbursement(contract_text): one_to_n_results = run_one_to_n_prompts(filename, text_dict, exhibit_pages, exhibit_chunk_mapping) # Return df one_to_n_results['CONTRACT_FILE_NAME'] = filename - final_results = pd.merge(one_to_one_results, one_to_n_results, how='right', on='CONTRACT_FILE_NAME') + contract_results = pd.merge(one_to_one_results, one_to_n_results, how='right', on='CONTRACT_FILE_NAME') else: - final_results = one_to_n_results + contract_results = one_to_n_results + + ################## AARETE-DERIVED ################## + final_results = aarete_derived.get_aarete_derived(contract_results) ################## POSTPROCESS ################## final_df = postprocess.postprocess(final_results)