From 6aaa3991717469da1d153b02c2022bc381db37ee Mon Sep 17 00:00:00 2001 From: Katon Minhas Date: Wed, 8 Oct 2025 21:56:51 +0000 Subject: [PATCH] Merged in bugfix/nv-issues (pull request #729) Bugfix/nv issues * remove non-prompted fields * Update prompt template * remove space * Update reimbursement primary cleaning prompt Approved-by: Faizan Mohiuddin --- .../src/investment/prompt_calls.py | 5 - .../src/prompts/investment_prompts.json | 123 ------------------ .../src/prompts/prompt_templates.py | 4 +- 3 files changed, 2 insertions(+), 130 deletions(-) diff --git a/fieldExtraction/src/investment/prompt_calls.py b/fieldExtraction/src/investment/prompt_calls.py index 3f0836e..0614a24 100644 --- a/fieldExtraction/src/investment/prompt_calls.py +++ b/fieldExtraction/src/investment/prompt_calls.py @@ -77,7 +77,6 @@ def prompt_reimbursement_primary( field_prompts = reimbursement_level_fields.print_prompt_dict(constants) prompt = prompt_templates.REIMBURSEMENT_PRIMARY(exhibit_text, field_prompts) - logging.debug( f"""Running reimbursement primary prompt for {filename} with prompt: {prompt}""" ) @@ -391,18 +390,14 @@ def validate_reimbursements_for_llm(answer_dict: dict, filename: str) -> bool: "sonnet_latest", filename, ) - print(llm_response) - logging.debug( f"LLM response for reimbursement validation in {filename}:\n{llm_response}" ) - final_answer = ( string_utils.extract_text_from_delimiters(llm_response, Delimiter.PIPE) .strip() .upper() ) - return final_answer == "YES" diff --git a/fieldExtraction/src/prompts/investment_prompts.json b/fieldExtraction/src/prompts/investment_prompts.json index 299557a..96008ea 100644 --- a/fieldExtraction/src/prompts/investment_prompts.json +++ b/fieldExtraction/src/prompts/investment_prompts.json @@ -176,26 +176,6 @@ "prompt": "", "crosswalk": "CROSSWALK_CLAIM_TYPE_CD" }, - { - "field_name": "CONTRACT_SID", - "relationship": "TBD", - "field_type": "TBD", - "prompt": "TBD" - }, - { - "field_name": "CONTRACT_CLASSIFICATION", - "relationship": "TBD", - "field_type": "TBD", - "prompt": "TBD" - }, - { - "field_name": "AARETE_DERIVED_CONTRACT_CLASSIFICATION", - "base_field": "CONTRACT_CLASSIFICATION", - "relationship": "TBD", - "field_type": "TBD", - "prompt": "TBD", - "valid_values" : "VALID_AARETE_DERIVED_CONTRACT_CLASSIFICATION" - }, { "field_name": "CONTRACT_TITLE", "relationship": "one_to_one", @@ -223,12 +203,6 @@ "field_type": "full_context", "prompt": "What US state is the payer based in or incorporated in? Look for:\n\n1. Payer address information in the contract header, preamble, or signature sections\n2. State names or abbreviations in payer contact information\n3. State of incorporation or principal place of business\n4. Payer headquarters location\n5. Payer licensing information that mentions a specific state\n\nReturn the full state name (e.g., 'California', 'Texas', 'New York') or standard 2-letter abbreviation (e.g., 'CA', 'TX', 'NY') as it appears in the document.\n\nIf multiple states are mentioned, prioritize:\n1. The state in the payer's primary/headquarters address\n2. The state of incorporation\n3. The state most frequently referenced for the payer organization\n\nIf no state can be determined, return 'N/A'." }, - { - "field_name": "CLIENT_NAME", - "relationship": "one_to_one", - "field_type": "TBD", - "prompt": "TBD" - }, { "field_name": "PAYER_NAME", "relationship": "one_to_one", @@ -321,37 +295,6 @@ "methodology" : "or", "case_sensitive" : "True" }, - { - "field_name": "SIGNATORY_COMPLETE_IND", - "relationship": "TBD", - "field_type": "TBD", - "prompt": "TBD" - }, - { - "field_name": "SERVICE_AREA", - "relationship": "TBD", - "field_type": "TBD", - "prompt": "TBD" - }, - { - "field_name": "AARETE_DERIVED_SERVICE_AREA", - "relationship": "TBD", - "field_type": "TBD", - "prompt": "TBD" - }, - { - "field_name": "PROV_TYPE", - "relationship": "one_to_n", - "field_type": "TBD", - "prompt": "TBD" - }, - { - "field_name": "AARETE_DERIVED_PROV_TYPE", - "relationship": "one_to_n", - "field_type": "TBD", - "prompt": "What Provider Type does the Exhibit apply to? Choose ONLY from the following: {valid_values}. If no provider type form the list is mentioned, write 'N/A'.", - "valid_values": "VALID_PROV_TYPE" - }, { "field_name": "PROV_TAXONOMY_CD", "relationship": "one_to_n", @@ -422,30 +365,6 @@ "field_type": "dynamic_reimb_info", "prompt": "List any patient age ranges described in the text that relate to a reimbursement term. Write the age ranges mentioned in the format 'X-Y' (e.g., '0-18', '18-65'). If the age range is not specified but the text indicates a specific age group (e.g., 'pediatric', 'adult'), return that exact text instead. If an age is listed as simply 'Over X', write 'X-None', to indicate that there is no upper bound to the age range. If no age ranges are mentioned, return N/A." }, - { - "field_name": "PROV_PATIENT_AGE_MIN", - "relationship": "one_to_n", - "field_type": "TBD", - "prompt": "TBD" - }, - { - "field_name": "PROV_PATIENT_AGE_MAX", - "relationship": "one_to_n", - "field_type": "TBD", - "prompt": "TBD" - }, - { - "field_name": "CARVEOUT_IND", - "relationship": "one_to_n", - "field_type": "TBD", - "prompt": "TBD" - }, - { - "field_name": "CARVEOUT_CD", - "relationship": "one_to_n", - "field_type": "TBD", - "prompt": "TBD" - }, { "field_name": "DEFAULT_IND", "relationship": "one_to_n", @@ -458,48 +377,24 @@ "field_type": "code_primary_breakout", "prompt": "Identify all Procedure (CPT or HCPCS) Codes in the text: - CPT codes are exactly 5 numeric digits (00100-99999) - HCPCS codes are 1 letter followed by 4 numbers (A0000-V9999)." }, - { - "field_name": "PROCEDURE_CD_DESC", - "relationship": "one_to_n", - "field_type": "TBD", - "prompt": "TBD" - }, { "field_name": "CPT4_PROC_MOD", "relationship": "one_to_n", "field_type": "code_primary_breakout", "prompt": "Identify all CPT code modifiers in the text: Identify CPT modifiers in the text: - Modifiers are 2-character codes (alphanumeric) appended to the end of a five-character Procedure code." }, - { - "field_name": "CPT4_PROC_MOD_DESC", - "relationship": "one_to_n", - "field_type": "TBD", - "prompt": "TBD" - }, { "field_name": "REVENUE_CD", "relationship": "one_to_n", "field_type": "code_primary_breakout", "prompt": "Identify all Revenue codes (Rev codes) in the text: - 3-4 digit numeric codes - May have 'X' as a wildcard character - Start with digits 0-9." }, - { - "field_name": "REVENUE_CD_DESC", - "relationship": "one_to_n", - "field_type": "TBD", - "prompt": "TBD" - }, { "field_name": "DIAG_CD", "relationship": "one_to_n", "field_type": "code_primary_breakout", "prompt": "Identify diagnosis codes (ICD-10) in the text: - 3-7 characters in length - First character must be a letter - Characters 2-3 must be numbers - Characters 4-7 (if present) can be numbers or letters." }, - { - "field_name": "DIAG_CD_DESC", - "relationship": "one_to_n", - "field_type": "TBD", - "prompt": "TBD" - }, { "field_name": "GROUPER_TYPE", "relationship": "one_to_n", @@ -578,36 +473,18 @@ "field_type": "code_primary_breakout", "prompt": "Identify National Drug Code (NDC) numbers present. Look for an 11-digit number of the format XXXXX-XXXX-XX." }, - { - "field_name": "LINE_NDC_CD_DESC", - "relationship": "one_to_n", - "field_type": "TBD", - "prompt": "TBD" - }, { "field_name": "CLAIM_ADMIT_TYPE_CD", "relationship": "one_to_n", "field_type": "code_primary_breakout", "prompt": "Identify Admit Type codes in the text: - Single digit numeric codes (1-9) - Used to indicate hospital admission type." }, - { - "field_name": "AUTH_ADMIT_TYPE_DESC", - "relationship": "one_to_n", - "field_type": "TBD", - "prompt": "TBD" - }, { "field_name": "CLAIM_STATUS_CD", "relationship": "one_to_n", "field_type": "code_primary_breakout", "prompt": "Identify Claim Status codes in the text. Look for numbers between 1-999 that refer specifically to the status of a claim being submitted." }, - { - "field_name": "CLAIM_STATUS_CD_DESC", - "relationship": "one_to_n", - "field_type": "TBD", - "prompt": "TBD" - }, { "field_name": "OUTLIER_TERM", "relationship": "one_to_n", diff --git a/fieldExtraction/src/prompts/prompt_templates.py b/fieldExtraction/src/prompts/prompt_templates.py index eb23cd5..09242bb 100644 --- a/fieldExtraction/src/prompts/prompt_templates.py +++ b/fieldExtraction/src/prompts/prompt_templates.py @@ -266,7 +266,7 @@ Note: Both services receive the same global cap treatment regardless of table po {context.replace('"', "'")} [End Context] -Return properly formatted JSON array with all extracted reimbursement items. +Briefly talk through your reasoning, then return a properly formatted JSON array with all extracted reimbursement items. """ @@ -314,7 +314,6 @@ Return a properly formatted JSON dictionary containing lists of all extracted re ################################# BREAKOUT PROMPTS ################################## ##################################################################################### - def METHODOLOGY_BREAKOUT(term, questions): """ This prompt is used for the fields with field_type="methodology_breakout" + any other fields we need to run based on the result of special case. @@ -900,6 +899,7 @@ INVALID entries - return NO unless there is VALID language as well: HARD INVALID entries - return NO even if there is VALID reimbursement language present as well: - Any reference to Coordination of Benefits or general benefit descriptions +- Any reference to Clean Claims - Risk-sharing arrangements, surplus/deficit distributions, settlement payments - Performance bonuses and incentive payments, or administrative compensation - Non-reimbursement statements ("not covered", "excluded", "not payable")