Merged in bugfix/Molina-UT-carveout-cd (pull request #762)

Bugfix/Molina UT carveout cd

* handle multiple default_terms in one reimb_term

* remove incorrect trigger cap cases

* carveout_cd fixes

* Merge branch 'main' into bugfix/Molina-UT-carveout-cd

* fix variable naming

* methodology prompt updated

* Merge branch 'main' into bugfix/Molina-UT-carveout-cd

* revert test changes

* revert test changes

* Merged main into bugfix/Molina-UT-carveout-cd


Approved-by: Katon Minhas
This commit is contained in:
Mayank Aamseek
2025-11-07 21:02:17 +00:00
committed by Katon Minhas
parent 212f93257a
commit 67e93b7de6
3 changed files with 15 additions and 13 deletions
@@ -4,10 +4,10 @@
},
"mapping": {
"BASE_COVERED_SERVICES": "Describes foundational payment methodologies for standard covered services, including primary coverage determinations. This refers to payment methodologies that establish the fundamental reimbursement structure, not exceptions or adjustments to it. Examples:\n- 'covered services'\n- 'Covered Services not included in the Service Categories in Table 1 shall be reimbursed at 100% of the Medicare fee schedule'\n- Primary coverage methodologies in dual products (e.g., 'services primary to Medicare', 'services primary to Medicaid')\n- Base reimbursement rates that form the foundation of the payment structure",
"PAYMENT_CARVEOUT": "Describes payments for specific services, procedures, level designations, or specific DRG or codes that are carved out from the base/foundational payment methodology with distinct payment terms. These are exceptions or specialty payments that differ from the standard approach. Examples include 'Radiology covered services', 'Anesthesia covered services', 'Pharmaceuticals' and 'HEMATOCRIT (CPT CODE: 85014)'. Do NOT classify as payment carveout if the service represents a foundational coverage determination (such as primary payer methodologies in dual products) rather than a true exception to standard payment.",
"PAYMENT_CARVEOUT": "Describes payments for specific services, procedures, level designations, or specific DRG or codes that are carved out from the base/foundational payment methodology with distinct payment terms. These are exceptions or specialty payments that differ from the payments for standard/ base services. Examples include 'Radiology covered services', 'Anesthesia covered services', 'Pharmaceuticals' and 'HEMATOCRIT (CPT CODE: 85014)'. Do NOT classify as payment carveout if the service represents a foundational coverage determination (such as primary payer methodologies in dual products) rather than a different payment to standard one.",
"UNLISTED_CODE": "Describes payments for codes that are not listed on a fee schedule. This is similar to DEFAULT_TERM. Only populate with Y if the Service or Methodology specifically mentions Codes.",
"ADDITION": "Describes payments that include a supplemental amount added to or above the base reimbursement rate. Populate with Y if the Methodology describes any additional payments, supplemental amounts, or add-on fees beyond the standard reimbursement.",
"TRIGGER_CAP": "Describes the payments that trigger a complete shift to a new payment methodology after a defined quantitative threshold is reached. Unlike supplemental payments, this fundamentally changes how reimbursement is calculated beyond the threshold. Valid thresholds can be based on dollar amounts, number of days, visits, units, or other measurable metrics (but not qualitative thresholds, e.g., 'where there is no Marketplace Medicare Rate'). Look for language indicating a clear change in the payment methodology when a defined quantitative threshold is exceeded, such as 'when charges exceed X, pay Y', or 'after 3 days, payment changes to $1,200 per diem'. Do not classify outlier threshold reimbursements or stop-loss provisions as TRIGGER_CAP eventhough they may share similar characteristics.",
"TRIGGER_CAP": "Describes a new payment methodology which becomes applicable/ gets triggered after a defined quantitative threshold is reached. Unlike supplemental payments, this refers to fundamentally changed new reimbursement methodology applicable only beyond the threshold. Valid thresholds can be based on dollar amounts, number of days, visits, units, or other measurable metrics (but not qualitative thresholds, e.g., 'where there is no Marketplace Medicare Rate'). Look for language indicating a clear change in the payment methodology when a defined quantitative threshold is exceeded, such as 'when charges exceed X, pay Y', or 'after 3 days, payment changes to $1,200 per diem'. Do NOT classify as TRIGGER_CAP if:\n - it is outlier threshold value\n - it is stop-loss provision \n - the methodology is just the threshold value",
"NEVER_EVENT": "Indicates that Never Events (e.g. sepsis acquired while inpatient) will not be covered. This may be phrased as 'no liability' or 'no payment'.",
"EXPERIMENTAL_INVESTIGATIONAL": "Describes payments for experimental and investigational procedures.",
"NOT_MEDICALLY_NECESSARY": "Describes payments for procedures deemed not medically necessary (or medically unnecessary)",
@@ -232,39 +232,41 @@ def breakout(
- list[dict]: The processed reimbursement primary answers with breakout details.
- dict[str, list]: The processed special case primary answers with breakout details.
"""
reimbursement_primary_answers = methodology_breakout(
reimbursement_breakout_answers = methodology_breakout(
reimbursement_primary_answers, constants, filename
) # Including base methodology breakout, grouper, and fee schedule
# Standard Methodology Breakout
reimbursement_primary_answers = carveout_check(
reimbursement_primary_answers, constants, filename
reimbursement_breakout_answers = carveout_check(
reimbursement_breakout_answers, constants, filename
)
# Special Case Breakout
special_case_answers = special_case_breakout(
special_case_primary_answers, special_case_primary_fields, filename
)
print("Special Case Primary Answers:", special_case_primary_answers)
print("Special Case Breakout Answers:", special_case_answers)
return reimbursement_primary_answers, special_case_answers
return reimbursement_breakout_answers, special_case_answers
def carveout_check(
reimbursement_primary_answers: list[dict], constants: Constants, filename: str
reimbursement_breakout_answers: list[dict], constants: Constants, filename: str
) -> list[dict]:
"""
Performs carveout check on reimbursement primary answers.
Args:
reimbursement_primary_answers (list[dict]): List of dictionaries containing reimbursement details.
reimbursement_breakout_answers (list[dict]): List of dictionaries containing reimbursement details.
constants (Constants): A Constants object
filename (str): The name of the file
Returns:
list[dict]: The updated reimbursement primary answers with carveout details.
list[dict]: The updated reimbursement breakout answers with carveout details.
"""
# additional fields besides service and reimb term to pass to LLM for context
additional_fields_for_carveout = ['AARETE_DERIVED_REIMB_METHOD', 'UNIT_OF_MEASURE', 'REIMB_FEE_RATE'
, 'REIMB_PCT_RATE', 'REIMB_CONVERSION_FACTOR', 'FEE_SCHEDULE']
for answer_dict in reimbursement_primary_answers:
for answer_dict in reimbursement_breakout_answers:
service_term = answer_dict.get("SERVICE_TERM")
reimb_term = answer_dict.get("REIMB_TERM")
base_reimb_answer_dict = {key: answer_dict[key] for key in additional_fields_for_carveout if key in answer_dict}
@@ -285,7 +287,7 @@ def carveout_check(
"Y" if carveout_answer in ["DEFAULT_TERM", "UNLISTED_CODE"] else "N"
)
return reimbursement_primary_answers
return reimbursement_breakout_answers
def methodology_breakout(
@@ -498,7 +498,7 @@ For any fields that don't apply to a particular methodology, use "N/A" as the va
- If the methodology includes two reimbursement methodologies that are comparative or equal, such as "70% of Billed Charges equal to Provider's Acquisition Cost plus five percent (5%)", each should be represented as a separate dictionary in the output list.
- For each dictionary, only one of the following fields should be present: REIMB_FEE_RATE, REIMB_PCT_RATE, or REIMB_CONVERSION_FACTOR. The others should be "N/A".
- Do not repeat the same reimbursement information in different output entries. For example, if 'cost of vaccines plus a $5 administration fee' is present and $5 is already captured as an addition, do not create a separate dictionary with $5 as a flat fee. Include it only once as an addition.
- Similarly, for provisions like stop-loss, outlier, trigger cap, discount, premium, rate escalator, and facility adjustments (e.g., DSH, IME, NTAP, UC, GME adjustments), separate rows should not be created as these are not considered reimbursement methodologies and are captured separately.
- Similarly, for provisions like stop-loss, outlier, trigger cap, discount, premium, rate escalator, different threshold values, and facility adjustments (e.g., DSH, IME, NTAP, UC, GME adjustments), separate rows should not be created as these are not considered reimbursement methodologies and are captured separately.
In the case of 'RBRVS', 'RVU', or American Society of Anesthesiology ('ASA'), any dollar amount mentioned refers to a conversion factor (even if it is not explicitly labeled as such), and not to a flat fee rate. In such cases, the output should have 'REIMB_CONVERSION_FACTOR' field populated with the dollar amount, and 'REIMB_FEE_RATE' field should be blank.
@@ -1259,7 +1259,7 @@ Service: {service.replace('"', "'")}
Reimbursement Terms: {methodology.replace('"', "'")}
Specific reimbursement method details: {base_reimb_answer.replace('"', "'")}
Determine which case description corresponds to the specific reimbursement method. It will always match one of the listed cases. If multiple cases apply, choose the one that describes the specific reimbursement method, or choose a special case if applicable. Always return a value from the list of cases above; do not return 'N/A' or 'UNKNOWN'.
Determine which case description corresponds to the specific reimbursement method. It will always match one of the listed cases. If multiple cases apply, choose the one that describes the specific reimbursement method, or choose a special case if applicable. Always return a value from the list of cases above; do not return 'N/A' or 'UNKNOWN'. Also explain why it is not a payment_carveout, default_term, or base_covered_service, if that is the case.
{PIPE_FORMAT_INSTRUCTIONS}
"""