diff --git a/src/codes/code_funcs.py b/src/codes/code_funcs.py index 4b4e77a..25e04f5 100644 --- a/src/codes/code_funcs.py +++ b/src/codes/code_funcs.py @@ -113,6 +113,7 @@ def code_explicit(service: str, methodology: str, filename: str) -> dict: instruction=prompt_templates.CODE_EXPLICIT_INSTRUCTION(), usage_label="CODE_EXPLICIT", ) + logging.info("LLM raw answer for code_explicit: %s", llm_answer_raw) try: code_answer_dict = _parser(llm_answer_raw) return code_answer_dict diff --git a/src/pipelines/runner.py b/src/pipelines/runner.py index 8bf5c59..548fa13 100644 --- a/src/pipelines/runner.py +++ b/src/pipelines/runner.py @@ -353,7 +353,7 @@ def main(client: str = "saas", testing=False, test_params={}): validated_cc_df = None qc_qa_stats_df = None - if not FINAL_RESULT_DF_CC.empty: + if config.ENABLE_QC_QA and not FINAL_RESULT_DF_CC.empty: logging.info("=" * 80) logging.info("Running QC/QA Validation Pipeline on CC results...") logging.info("=" * 80) diff --git a/src/prompts/investment_prompts.json b/src/prompts/investment_prompts.json index 4e09f30..5e61080 100644 --- a/src/prompts/investment_prompts.json +++ b/src/prompts/investment_prompts.json @@ -440,7 +440,7 @@ "field_name": "PROCEDURE_CD", "relationship": "one_to_n", "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)." + "prompt": "Identify all Procedure (CPT or HCPCS) Codes explicitly applied or covered in the text. Do NOT extract codes that appear only in exclusion or exception context (e.g., 'except for', 'excluding', 'not including'): - CPT codes are exactly 5 numeric digits (00100-99999) - HCPCS codes are 1 letter followed by 4 numbers (A0000-V9999)." }, { "field_name": "CPT4_PROC_MOD", diff --git a/src/prompts/prompt_templates.py b/src/prompts/prompt_templates.py index 86ff22c..1f4bc9e 100644 --- a/src/prompts/prompt_templates.py +++ b/src/prompts/prompt_templates.py @@ -1420,6 +1420,7 @@ Extract explicit procedure, revenue, diagnosis, and other healthcare codes from - If any of the codes are not found, do not write a list for that field. Simply populate the field with an empty list []. - If a standalone 3-digit code appears without explicit labels (e.g., "DRG," "revenue," "Rev code"), analyze the surrounding context for clues. Look for any direct or indirect references-no matter how subtle-that may suggest a connection to either a Revenue Code or a Grouper Code. If any contextual clues imply relevance to either classification, categorize the code accordingly. - Return only valid codes that match the stated format (e.g. CPT exactly 5 digits, HCPCS 1 letter + 4 digits); do not invent or guess codes. +- If a code appears only in an exclusion, exception, or negation context (e.g., "except for", "excluding", "not including", "other than", "does not include"), do NOT extract it. Only extract codes that are explicitly being applied, covered, or referenced as the subject of the service description. [FIELDS] Populate a JSON dictionary with the following fields: