diff --git a/.gitignore b/.gitignore index 365cb50..d3a45ab 100644 --- a/.gitignore +++ b/.gitignore @@ -90,6 +90,8 @@ myenv/ subset/ output/ docs/ +local_scripts/ +untracked_tests/ .mypy_cache/ .pytest_cache/ diff --git a/fieldExtraction/constants/mappings/crosswalk_product_lob.json b/fieldExtraction/constants/mappings/crosswalk_product_lob.json index 3c6a072..b5314a3 100644 --- a/fieldExtraction/constants/mappings/crosswalk_product_lob.json +++ b/fieldExtraction/constants/mappings/crosswalk_product_lob.json @@ -19,7 +19,7 @@ }, "Fidelis" : { - "Medicaid Managed Care" : "Medicaid" + }, "Parkland" : { "HEALTHfirst" : "Medicaid", diff --git a/fieldExtraction/constants/mappings/crosswalk_program.json b/fieldExtraction/constants/mappings/crosswalk_program.json index 5872538..69d26c8 100644 --- a/fieldExtraction/constants/mappings/crosswalk_program.json +++ b/fieldExtraction/constants/mappings/crosswalk_program.json @@ -7,6 +7,7 @@ "Children's Health Insurance Program (CHIP)" : "CHIP", "Children's Health Insurance Program Perinate (CHIP-P)" : "CHIPP", "Healthy Kids" : "CHIP", + "Medicaid Managed Care" : "MMC", "Affordable Care Act (ACA)" : "ACA", "Aged, Blind, and Disabled (ABD)" : "ABD", "Alternative Benefit Plan (ABP)" : "ABP", diff --git a/fieldExtraction/constants/mappings/crosswalk_program_lob.json b/fieldExtraction/constants/mappings/crosswalk_program_lob.json index 315ff7d..9b2889b 100644 --- a/fieldExtraction/constants/mappings/crosswalk_program_lob.json +++ b/fieldExtraction/constants/mappings/crosswalk_program_lob.json @@ -6,6 +6,7 @@ "mapping": { "CHIP" : "Medicaid", "CHIPP" : "Medicaid", + "MMC" : "Medicaid", "ACA" : "Marketplace", "ABD" : "Medicaid", "ABP" : "Medicaid", diff --git a/fieldExtraction/src/investment/dynamic_funcs.py b/fieldExtraction/src/investment/dynamic_funcs.py index 3451647..7e68741 100644 --- a/fieldExtraction/src/investment/dynamic_funcs.py +++ b/fieldExtraction/src/investment/dynamic_funcs.py @@ -35,7 +35,7 @@ def dynamic_primary( dynamic_reimbursement_fields = FieldSet() exhibit_level_answer_dict = {} - + for field in dynamic_primary_fields.fields: exhibit_text_answer = prompt_calls.prompt_dynamic_primary( exhibit_text, @@ -240,7 +240,7 @@ def get_dynamic_one_to_one_fields(answer_dicts: list[dict[str, str]], constants: ) # Try base_field first, fall back to field_name if base_field is None/empty one_to_one_fields = add_one_to_one_field( one_to_one_fields, field_to_add, answer_dicts, constants - ) + ) return one_to_one_fields diff --git a/fieldExtraction/src/investment/file_processing.py b/fieldExtraction/src/investment/file_processing.py index 7015327..fdec681 100644 --- a/fieldExtraction/src/investment/file_processing.py +++ b/fieldExtraction/src/investment/file_processing.py @@ -59,7 +59,7 @@ def process_file(file_object, constants: Constants, run_timestamp): logging.info(f"{datetime_str()} Fields not configured for One to N, Skipping - {filename}") # ONE TO ONE PROCESSING - if process_one_to_one: + if process_one_to_one: one_to_one_results = run_one_to_one_prompts( filename, contract_text, @@ -262,7 +262,7 @@ def run_one_to_n_prompts(text_dict: dict[str, str], dynamic_one_to_one_fields = dynamic_funcs.get_dynamic_one_to_one_fields( one_to_n_results, constants ) - + ################## CONVERT TO DF ################## one_to_n_df = pd.DataFrame(one_to_n_results) @@ -273,7 +273,7 @@ def process_page_one_to_n(text_dict: dict[str, str], exhibit_page_nums: list[str page_text = text_dict[page_num] exhibit_text_simplified = preprocessing_funcs.simplify_exhibit(text_dict, exhibit_page_nums, page_num) - + ############################### Reimbursement Primary ############################### reimbursement_level_answers = one_to_n_funcs.reimbursement_level( page_text, diff --git a/fieldExtraction/src/investment/prompt_calls.py b/fieldExtraction/src/investment/prompt_calls.py index 2b971fa..03bb7b4 100644 --- a/fieldExtraction/src/investment/prompt_calls.py +++ b/fieldExtraction/src/investment/prompt_calls.py @@ -209,7 +209,6 @@ def prompt_carveout_check( instruction=prompt_templates.CARVEOUT_CHECK_INSTRUCTION(), usage_label="CARVEOUT_CHECK", ) - logging.debug(f"Carveout/ special case check for {filename}: {llm_answer_raw}") carveout_answer = string_utils.extract_text_from_delimiters( llm_answer_raw, Delimiter.PIPE diff --git a/fieldExtraction/src/prompts/prompt_templates.py b/fieldExtraction/src/prompts/prompt_templates.py index b6b47e9..ea4113b 100644 --- a/fieldExtraction/src/prompts/prompt_templates.py +++ b/fieldExtraction/src/prompts/prompt_templates.py @@ -1359,14 +1359,15 @@ It was previously identified that the Exhibit contains the following LOB and Pro - Some examples of language indicating an exlusive relationship are "Medicaid: CHIP", "Medicare advantage only", and "Duals - only the following SNP programs" - If the programs are represented with different sections of the Exhibit under the same higher-level LOB section, this is indicative of an Exclusive relationship. - For example, if an exhibit has a header that says "Medicaid & CHIP", but then there are different subsections within the Exhibit for "Medicaid" and "CHIP", this is an Exclusive relationship even though the "&" language is Inclusive. -- Closely read the text, then write either |Inclusive| or |Exclusive| to indicate the nature of the relationship. [CONTEXT] Here is the Exhibit to be analyzed: {exhibit_text.replace('"', "'")} -[OUTPUT] -Briefly explain your reasoning, then put your final answer in |pipes|. +[OUTPUT FORMAT - REQUIRED] +You MUST format your response with pipe delimiters. Example format: +"Based on the analysis... |Inclusive|" or "The relationship is... |Exclusive|" +Your final answer MUST be enclosed in pipe delimiters: |Inclusive| or |Exclusive| """ @@ -1389,7 +1390,13 @@ def DERIVED_TERM_DATE_PROMPT( def LOB_RELATIONSHIP_INSTRUCTION() -> str: return ( "[OBJECTIVE]\n" - "Determine if LOB and Program relationship in the exhibit is Inclusive or Exclusive." + "Determine if LOB and Program relationship in the exhibit is Inclusive or Exclusive.\n\n" + "[OUTPUT FORMAT - CRITICAL]\n" + "You MUST format your response as follows:\n" + "1. Briefly explain your reasoning\n" + "2. Then put your final answer in pipe delimiters: |Inclusive| or |Exclusive|\n" + "Example: 'The contract shows... |Inclusive|'\n" + "Your response MUST include the pipe delimiters (|) around your final answer." )