Resolve Lesser of Check issue

This commit is contained in:
Katon Minhas
2026-02-03 01:10:41 -05:00
parent 4701f7039a
commit ef70ddf3be
4 changed files with 17 additions and 42 deletions
@@ -759,7 +759,6 @@ def prompt_lesser_of_check(
instruction=prompt_templates.LESSER_OF_CHECK_INSTRUCTION(),
usage_label="LESSER_OF_CHECK",
)
try:
# Extract JSON from pipes
llm_answer_final = _parser(
+6 -11
View File
@@ -503,7 +503,7 @@ def prompt_exhibit_header(page_content, filename):
usage_label="EXHIBIT_HEADER",
)
llm_answer_extracted = _parser(llm_answer_raw)
return llm_answer_extracted
return llm_answer_extracted[0]
def prompt_date_fix(date: str) -> str:
@@ -724,14 +724,9 @@ def prompt_lesser_of_check(
)
try:
# Extract JSON from pipes
llm_answer_final = _parser(llm_answer_raw)
logging.debug(f"LESSER_OF_CHECK extracted from pipes: {llm_answer_final}")
# Parse JSON
lesser_of_answer_dict = json.loads(llm_answer_final)
# Validate required fields
required_fields = [
"service_term",
@@ -741,7 +736,7 @@ def prompt_lesser_of_check(
"exhibit_reference",
]
for field in required_fields:
if field not in lesser_of_answer_dict:
if field not in llm_answer_final:
logging.warning(
f"LESSER_OF_CHECK missing field '{field}' for service '{service_term}', "
f"exhibit '{exhibit_title}', defaulting to STANDALONE"
@@ -755,13 +750,13 @@ def prompt_lesser_of_check(
}
logging.info(
f"LESSER_OF_CHECK classification: scope={lesser_of_answer_dict['scope']}, "
f"target={lesser_of_answer_dict['target_exhibit']}, "
f"exhibit_ref={lesser_of_answer_dict.get('exhibit_reference')}, "
f"LESSER_OF_CHECK classification: scope={llm_answer_final['scope']}, "
f"target={llm_answer_final['target_exhibit']}, "
f"exhibit_ref={llm_answer_final.get('exhibit_reference')}, "
f"service='{service_term}...', exhibit='{exhibit_title}'"
)
return lesser_of_answer_dict
return llm_answer_final
except json.JSONDecodeError as e:
logging.error(
+7 -27
View File
@@ -5,34 +5,14 @@ from src.utils import io_utils
from src.pipelines.saas.prompts import prompt_calls
from src.pipelines.shared.extraction.one_to_n_funcs import reimbursement_level
constants = Constants()
# constants = Constants()
all_exhibit_rows = [
{"LOB" : ['Medicaid']}
]
service_term = "Covered Services provided to KIDSfirst Members"
reimb_term = "One hundred percent (100%) of the prevailing yearly and current Medicaid fee schedule for the State of Texas or the Participating Ancillary Services Provider's usual and customary charge, whichever is less."
exhibit_title = 'Attachment B SECTION 1 - PCHP MEDICAID STAR HMO SERVICES'
filename = ""
page_text = """
PARKLAND COMMUNITY HEALTH PLAN, INC.
A PROGRAM OF DALLAS COUNT HOSPITAL DISTRICT
PARTICIPATING ANCILLARY SERVICES PROVIDER AGREEMENT
Attachment B
SECTION 1 - PCHP MEDICAID STAR HMO SERVICES
Participating Ancillary Services Provider shall be reimbursed for medically necessary Covered
Services provided to HEALTHfirst Members as follows:
1. One hundred percent (100%) of the prevailing yearly and current Medicaid fee schedule for
the State of Texas or the Participating Ancillary Services Provider's usual and customary
charge, whichever is less.
SECTION 2 PCHP CHIP HMO SERVICES
Participating Ancillary Services Provider shall be reimbursed for Covered Services provided to
KIDSfirst Members as follows:
1. One hundred percent (100%) of the prevailing yearly and current Medicaid fee schedule for
the State of Texas or the Participating Ancillary Services Provider's usual and customary
charge, whichever is less.
"""
filename= "sample_files"
reimbursement_primary_answers = reimbursement_level(
page_text, constants, filename
)
lesser_of_answer_dict = prompt_calls.prompt_lesser_of_check(service_term, reimb_term, exhibit_title, filename)
print("FInal: ", reimbursement_primary_answers)
print(lesser_of_answer_dict)
+4 -3
View File
@@ -727,14 +727,15 @@ Reimbursement: "lesser of Allowable Charges or Company's fee schedule in effect
**OUTPUT FORMAT:**
Briefly explain your reasoning, then return a properly-formatted JSON dictionary with the following structure:
{
{{
"service_term": "<service term>",
"reimb_term": "<reimbursement term>",
"scope": "<one of: GLOBAL, EXHIBIT_SPECIFIC, STANDALONE>",
"target_exhibit": "<one of: ALL, CURRENT, OTHER, or null>",
"exhibit_reference": "<exhibit name if OTHER, else null>"
}
{JSON_DICT_WITH_LISTS_FORMAT_INSTRUCTIONS}"""
}}
{JSON_DICT_FORMAT_INSTRUCTIONS}"""
def LESSER_OF_CHECK(service_term: str, reimb_term: str, exhibit_title: str) -> Tuple[str, Callable[[str], dict]]: