From f9b88959c33710b51246dbf39af4704ca2f6c632 Mon Sep 17 00:00:00 2001 From: Mayank Aamseek Date: Thu, 22 May 2025 19:19:19 +0000 Subject: [PATCH] Merged in feature/daip2-193 (pull request #532) payemnt carveout added * payemnt carveout added * Merge branch 'main' into feature/daip2-193 * refined PAYMENT_CARVEOUT related prompts * Merge branch 'main' into feature/daip2-193 * notebook updated * notebook updated * Merge branch 'main' into feature/daip2-193 * carveout blank values and default ind corrected * print statement removed * field_type changed for default_ind * payment_carveout description updated to add code * duplicate run of get_methodology_breakout fixed * pipeline error fixed * pipeline error fixed * Merge branch 'main' into feature/daip2-193 * updated AARETE_DERIVED_REIMB_METHOD prompt * default_term prompt changed * refined copilot checked AARETE_DERIVED_REIMB_METHOD prompt * Merge branch 'main' into feature/daip2-193 * Merge remote-tracking branch 'origin/main' into feature/daip2-193 * spelling error fixed * Merged main into feature/daip2-193 Approved-by: Alex Galarce --- .../src/constants/investment_values.py | 6 +- .../src/constants/special_case_configs.py | 22 +- .../src/investment/one_to_n_funcs.py | 11 +- .../src/prompts/investment_prompts.json | 4 +- .../src/prompts/investment_prompts.py | 5 +- .../methodology_breakout_issue_fixes.ipynb | 285 ++++++++---------- fieldExtraction/tests/dynamic_test.py | 5 +- fieldExtraction/tests/one_to_n_test.py | 5 +- 8 files changed, 166 insertions(+), 177 deletions(-) diff --git a/fieldExtraction/src/constants/investment_values.py b/fieldExtraction/src/constants/investment_values.py index 63e9647..346884e 100644 --- a/fieldExtraction/src/constants/investment_values.py +++ b/fieldExtraction/src/constants/investment_values.py @@ -98,7 +98,8 @@ INVALID_REIMB_TERM = [ VALID_REIMB_TERM_FULL = VALID_REIMB_TERM + INVALID_REIMB_TERM VALID_CARVEOUTS = { - "DEFAULT_TERM" : "Describes the default payment for when there is no established payment amount on the fee schedule or elsewhere.", + "BASE_COVERED_SERVICES" : "Describes generic payments for standard covered services. This refers to the payment made for a service that is not subject to any adjustments. Example of base methodology:\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.'", + "PAYMENT_CARVEOUT" : "Describes payments for services or codes that are separately mentioned or carved out from the standard payment for all covered services. Examples include 'Radiology covered services', 'Anesthesia covered services', 'Pharmaceuticals' and 'HEMATOCRIT (CPT CODE: 85014)'. Any service or code that is specifically or separately mentioned falls under the 'payment_carveout' category.", "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.", "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.", @@ -113,7 +114,8 @@ VALID_CARVEOUTS = { "DIAGNOSTIC_PROCEDURES" : "Describes payments for diagnostic procedures.", "PREADMISSION" : None, "POST_DISCHARGE" : None, - "READMISSIONS" : "Describes payment for subsequent admission with the same diagnostic category of codes as the initial admission.", + "READMISSIONS" : "Describes payment for subsequent admission with the same diagnostic category of codes as the initial admission.", + "DEFAULT_TERM" : "Indicates whether this service/methodology serves as a default/fallback payment rate when no other payment methods apply. The default/fallback payment rate is typically a low rate and based on billed charges. This is an 'end-of-the-line' reimbursement when no other methodologies apply.\n\nThe service/methodology should meet BOTH these criteria:\n1. Contains language indicating it applies to services not covered elsewhere, such as:\n - 'services not listed in the fee schedule'\n - 'services for which no other payment method is specified'\n - 'all other services'\n - 'services not otherwise specified'\n2. Is clearly a secondary/fallback option, NOT the primary/base reimbursement method, as indicated by:\n - Position in the contract (appears after primary methodology is defined)\n - Lower reimbursement rate than the base methodology (typically 50-60% of charges)\n - Explicit 'default' or 'fallback' terminology\n - Applies to a minor subset of services (not the majority of contract services)\n\nIt should not indicate ANY of these:\n- The methodology is the primary/base reimbursement approach, even if defined by exclusion\n- The methodology applies to specific listed services/procedures\n- The methodology offers standard rates comparable to other contract methodologies\n- No default/fallback language is present\n\nExample: 'For any services not specifically listed in Exhibits A-D, reimbursement shall be 50% of billed charges.'", # + Any Reimbursement Carveouts (Codes, Services, etc) } diff --git a/fieldExtraction/src/constants/special_case_configs.py b/fieldExtraction/src/constants/special_case_configs.py index 47a4496..bae8a76 100644 --- a/fieldExtraction/src/constants/special_case_configs.py +++ b/fieldExtraction/src/constants/special_case_configs.py @@ -48,13 +48,22 @@ TRIGGER_CAP_QUESTIONS = FieldSet( SPECIAL_CASE_CONFIGS = { # Carveouts - "DEFAULT_TERM": { + "BASE_COVERED_SERVICES": { "questions": METHODOLOGY_BREAKOUT_QUESTIONS, "fs_questions": FS_BREAKOUT_QUESTIONS, "methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT, "fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT, "carveout_ind": False, - "default_ind": True, + "default_ind": False, + "term_key": None, + }, + "PAYMENT_CARVEOUT": { + "questions": METHODOLOGY_BREAKOUT_QUESTIONS, + "fs_questions": FS_BREAKOUT_QUESTIONS, + "methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT, + "fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT, + "carveout_ind": True, + "default_ind": False, "term_key": None, }, "UNLISTED_CODE": { @@ -185,6 +194,15 @@ SPECIAL_CASE_CONFIGS = { "default_ind": False, "term_key": None, }, + "DEFAULT_TERM": { + "questions": METHODOLOGY_BREAKOUT_QUESTIONS, + "fs_questions": FS_BREAKOUT_QUESTIONS, + "methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT, + "fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT, + "carveout_ind": False, + "default_ind": True, + "term_key": None, + }, # Special Cases "STOP_LOSS": { "questions": METHODOLOGY_BREAKOUT_QUESTIONS + STOP_LOSS_QUESTIONS, diff --git a/fieldExtraction/src/investment/one_to_n_funcs.py b/fieldExtraction/src/investment/one_to_n_funcs.py index 49404c2..254fdda 100644 --- a/fieldExtraction/src/investment/one_to_n_funcs.py +++ b/fieldExtraction/src/investment/one_to_n_funcs.py @@ -516,13 +516,14 @@ def reimbursement_level( carveout_answers = get_special_cases(reimbursement_primary_answers, filename) - # Later, we will only run methodology breakout for those without certain carveout indicators. We will run carveout-specific breakouts for the others - methodology_breakout_answers = get_methodology_breakout( - carveout_answers, filename - ) + # # Later, we will only run methodology breakout for those without certain carveout indicators. We will run carveout-specific breakouts for the others + # # not required now as get_special_cases will already have run the methodology breakout for all cases + # methodology_breakout_answers = get_methodology_breakout( + # carveout_answers, filename + # ) code_breakout_answers = code_funcs.get_code_breakout( - methodology_breakout_answers, filename, all_dataset + carveout_answers, filename, all_dataset ) # print(f"{datetime_str()} code_breakout_answers complete for exhibit page {exhibit_page} of {filename}...") diff --git a/fieldExtraction/src/prompts/investment_prompts.json b/fieldExtraction/src/prompts/investment_prompts.json index 3f53ce6..ae21690 100644 --- a/fieldExtraction/src/prompts/investment_prompts.json +++ b/fieldExtraction/src/prompts/investment_prompts.json @@ -27,7 +27,7 @@ "field_name": "AARETE_DERIVED_REIMB_METHOD", "relationship": "one_to_n", "field_type": "methodology_breakout", - "prompt": "What is the method of reimbursement? Choose only from the following: {valid_values}.\nFollow these rules:\n- If any of Average Sales Price (ASP), AWP (Average Wholesale Price), WAC (Wholesale Acquisition Cost), RBRVS (Resource-Based Relative Value Scale) or RVU (Relative Value Unit) is mentioned, return 'Fee Schedule'\n- In case of MS-DRG, AP-DRG, APR-DRG, APG, EAPG, APC/ OPPS or ASC, return 'Grouper'.\n- In case of Percent of Charge or Percentage of Billed, return 'Billed Charges'.\n- For mixed methodologies (e.g., 'cost plus 5% based on AWP'), prioritize the base method (AWP)\n- answer 'DOFR' only when this exact term i.e. 'DOFR' is present.\n- answer 'Medicare Member Cost Share' only when this exact phrase appears\nImportant exceptions:\n- Reimbursements with specific dollar values cannot be 'Fee Schedule'\n- Provider interest rates are not considered 'Flat Rate'. \n- ASA is not a reimbursement method and not a fee schedule. \n- For values 'Flat Rate', 'Per Visit' and 'Per Diem', REIMB_FEE_RATE field must be populated.", + "prompt": "What is the method of reimbursement? Choose only from the following valid values: {valid_values}.\nFollow these mapping rules:\n- If any of Medicare, Medicaid, Average Sales Price (ASP), AWP (Average Wholesale Price), WAC (Wholesale Acquisition Cost), RBRVS (Resource-Based Relative Value Scale) or RVU (Relative Value Unit) or any type of Fee Schedule is mentioned, return 'Fee Schedule'\n- In case of MS-DRG, AP-DRG, APR-DRG, APG, EAPG, APC/ OPPS or ASC, return 'Grouper'.\n- In case of Percent of Charge or Percentage of Billed, return 'Billed Charges'.\n- For mixed methodologies (e.g., 'cost plus 5% based on AWP'), prioritize the base method (AWP)\n- answer 'DOFR' only when this exact term i.e. 'DOFR' is present.\n- answer 'Medicare Member Cost Share' only when this exact phrase appears.\n\nImportant exceptions and additional rules:\n- Reimbursements with specific dollar values cannot be 'Fee Schedule'\n- Provider interest rates are not considered 'Flat Rate'. \n- ASA is not a reimbursement method and not a fee schedule. \n- For values 'Flat Rate', 'Per Visit' and 'Per Diem', REIMB_FEE_RATE field must be populated.\n If no specific rule is matched, map to the most appropriate value from the given valid values.", "valid_values": "VALID_REIMB_TERM_FULL" }, { @@ -426,7 +426,7 @@ { "field_name": "DEFAULT_IND", "relationship": "one_to_n", - "field_type": "methodology_breakout", + "field_type": "non_prompt", "prompt": "DEFAULT_INDICATOR:\nIndicates whether this methodology serves as a default/fallback payment rate when no other payment methods apply. The default/fallback payment rate is typically a low rate and based on billed charges. This is an 'end-of-the-line' reimbursement when no other methodologies apply.\n\nOutput 'Y' ONLY if the methodology meets BOTH these criteria:\n1. Contains language indicating it applies to services not covered elsewhere, such as:\n - 'services not listed in the fee schedule'\n - 'services for which no other payment method is specified'\n - 'all other services'\n - 'services not otherwise specified'\n2. Is clearly a secondary/fallback option, NOT the primary/base reimbursement method, as indicated by:\n - Position in the contract (appears after primary methodology is defined)\n - Lower reimbursement rate than the base methodology (typically 50-60% of charges)\n - Explicit 'default' or 'fallback' terminology\n - Applies to a minor subset of services (not the majority of contract services)\n\nOutput 'N' if ANY of these are true:\n- The methodology is the primary/base reimbursement approach, even if defined by exclusion\n- The methodology applies to specific listed services/procedures\n- The methodology offers standard rates comparable to other contract methodologies\n- No default/fallback language is present\n\nExample of TRUE default (Y): 'For any services not specifically listed in Exhibits A-D, reimbursement shall be 50% of billed charges.'\nExample of base methodology defined by exclusion (N): 'Covered Services not included in the Service Categories in Table 1 shall be reimbursed at 100% of the Medicare fee schedule.'" }, { diff --git a/fieldExtraction/src/prompts/investment_prompts.py b/fieldExtraction/src/prompts/investment_prompts.py index ffbdab2..3d699b4 100644 --- a/fieldExtraction/src/prompts/investment_prompts.py +++ b/fieldExtraction/src/prompts/investment_prompts.py @@ -643,7 +643,7 @@ def SPECIAL_CASE_CHECK(service, methodology): carveout_definitions = {carveout : definition for carveout, definition in VALID_CARVEOUTS.items() if definition} # Get only not None special_definitions = {special : definition for special, definition in VALID_SPECIAL.items() if definition} all_questions = {**carveout_definitions, **special_definitions} - return f"""Examine the Service and Methodology combination below and determine if the terms fall under one of the following special cases: + return f"""Examine the combination of Service and Methodology below and identify which of the following cases it falls under. Here are the Cases, with their definitions: {all_questions} @@ -652,8 +652,7 @@ Here is the Service and Methodology: Service: {service.replace('"', "'")} Methodology: {methodology.replace('"', "'")} -Determine if the Service and Methodology match any of the special case descriptions. -If so, write the name of the Case. If they do not, simply write N/A. +Determine which case description corresponds to the Service and Methodology combination. The Service and Methodology will always match one of the listed cases. Always return a value from the list of cases above; do not return 'N/A' or 'UNKNOWN'. {PIPE_FORMAT_INSTRUCTIONS} """ diff --git a/fieldExtraction/src/testbed/methodology_breakout_issue_fixes.ipynb b/fieldExtraction/src/testbed/methodology_breakout_issue_fixes.ipynb index ac3595c..9a16387 100644 --- a/fieldExtraction/src/testbed/methodology_breakout_issue_fixes.ipynb +++ b/fieldExtraction/src/testbed/methodology_breakout_issue_fixes.ipynb @@ -51,9 +51,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "(3218, 144)\n", - "(15, 144)\n", - "(15, 144)\n" + "(3178, 158)\n", + "(115, 158)\n", + "(6, 158)\n" ] }, { @@ -79,131 +79,42 @@ " \n", " FILE_NAME\n", " SERVICE_TERM\n", - " CARVEOUT_IND\n", " REIMB_TERM\n", " \n", " \n", " \n", " \n", - " 1366\n", - " Custom_2020-01-01 Com Affinity Amend FE - St C...\n", - " Affinity Network\n", - " N\n", - " 10% discount from the reimbursement rates list...\n", + " 53\n", + " 02-0677066-EYEMASTERS-ICMPROVIDERAGREEMENT_642...\n", + " BLOOD COUNT; SPUN MICROHEMATOCRIT (CPT CODE: 8...\n", + " CONTRACTAMOUNT : $3.35\n", " \n", " \n", - " 1367\n", - " Custom_2020-01-01 Com Affinity Amend FE - St C...\n", - " Inpatient Services\n", - " N\n", - " The lesser of the rates set forth in this Exhi...\n", + " 81\n", + " 02-0677066-EYEMASTERS-ICMPROVIDERAGREEMENT_642...\n", + " HEMATOCRIT (CPT CODE: 85014)\n", + " CONTRACTAMOUNT : $3.35\n", " \n", " \n", - " 1369\n", - " Custom_2020-01-01 Com Affinity Amend FE - St C...\n", - " Inpatient Stop Loss Provision\n", - " N\n", - " Threshold: 180% of Compensation Rate, as appli...\n", - " \n", - " \n", - " 1371\n", - " Custom_2020-01-01 Com Affinity Amend FE - St C...\n", - " Re-admission of a Member\n", - " Y\n", - " If a Member is re-admitted to Hospital within ...\n", - " \n", - " \n", - " 1372\n", - " Custom_2020-01-01 Com Affinity Amend FE - St C...\n", - " Outpatient Services within 3 days of Admission\n", - " Y\n", - " Pre-admission tests within 3 days of an admiss...\n", - " \n", - " \n", - " 1373\n", - " Custom_2020-01-01 Com Affinity Amend FE - St C...\n", - " Coding Intensity Review\n", - " N\n", - " If Hospitals Case Mix Index (CMI) increases mo...\n", - " \n", - " \n", - " 1374\n", - " Custom_2020-01-01 Com Affinity Amend FE - St C...\n", - " Outpatient Services\n", - " N\n", - " The lesser of 345% of Medicare Outpatient Pros...\n", - " \n", - " \n", - " 1376\n", - " Custom_2020-01-01 Com Affinity Amend FE - St C...\n", - " Prosthetics and Implants\n", - " N\n", - " If eligible for separate reimbursement under C...\n", - " \n", - " \n", - " 1378\n", - " Custom_2020-01-01 Com Affinity Amend FE - St C...\n", - " Surgery - Secondary procedures\n", - " Y\n", - " Secondary procedures performed on the same day...\n", - " \n", - " \n", - " 1379\n", - " Custom_2020-01-01 Com Affinity Amend FE - St C...\n", - " Surgery - Subsequent procedures\n", - " Y\n", - " Any subsequent procedures performed on the sam...\n", - " \n", - " \n", - " 1380\n", - " Custom_2020-01-01 Com Affinity Amend FE - St C...\n", - " Observation\n", - " N\n", - " Observation shall be reimbursed according to C...\n", + " 83\n", + " 02-0677066-EYEMASTERS-ICMPROVIDERAGREEMENT_642...\n", + " HEMOGLOBIN, CALORIMETRIC (CPT CODE: 85018)\n", + " CONTRACTAMOUNT : $3.35\n", " \n", " \n", "\n", "" ], "text/plain": [ - " FILE_NAME \\\n", - "1366 Custom_2020-01-01 Com Affinity Amend FE - St C... \n", - "1367 Custom_2020-01-01 Com Affinity Amend FE - St C... \n", - "1369 Custom_2020-01-01 Com Affinity Amend FE - St C... \n", - "1371 Custom_2020-01-01 Com Affinity Amend FE - St C... \n", - "1372 Custom_2020-01-01 Com Affinity Amend FE - St C... \n", - "1373 Custom_2020-01-01 Com Affinity Amend FE - St C... \n", - "1374 Custom_2020-01-01 Com Affinity Amend FE - St C... \n", - "1376 Custom_2020-01-01 Com Affinity Amend FE - St C... \n", - "1378 Custom_2020-01-01 Com Affinity Amend FE - St C... \n", - "1379 Custom_2020-01-01 Com Affinity Amend FE - St C... \n", - "1380 Custom_2020-01-01 Com Affinity Amend FE - St C... \n", + " FILE_NAME \\\n", + "53 02-0677066-EYEMASTERS-ICMPROVIDERAGREEMENT_642... \n", + "81 02-0677066-EYEMASTERS-ICMPROVIDERAGREEMENT_642... \n", + "83 02-0677066-EYEMASTERS-ICMPROVIDERAGREEMENT_642... \n", "\n", - " SERVICE_TERM CARVEOUT_IND \\\n", - "1366 Affinity Network N \n", - "1367 Inpatient Services N \n", - "1369 Inpatient Stop Loss Provision N \n", - "1371 Re-admission of a Member Y \n", - "1372 Outpatient Services within 3 days of Admission Y \n", - "1373 Coding Intensity Review N \n", - "1374 Outpatient Services N \n", - "1376 Prosthetics and Implants N \n", - "1378 Surgery - Secondary procedures Y \n", - "1379 Surgery - Subsequent procedures Y \n", - "1380 Observation N \n", - "\n", - " REIMB_TERM \n", - "1366 10% discount from the reimbursement rates list... \n", - "1367 The lesser of the rates set forth in this Exhi... \n", - "1369 Threshold: 180% of Compensation Rate, as appli... \n", - "1371 If a Member is re-admitted to Hospital within ... \n", - "1372 Pre-admission tests within 3 days of an admiss... \n", - "1373 If Hospitals Case Mix Index (CMI) increases mo... \n", - "1374 The lesser of 345% of Medicare Outpatient Pros... \n", - "1376 If eligible for separate reimbursement under C... \n", - "1378 Secondary procedures performed on the same day... \n", - "1379 Any subsequent procedures performed on the sam... \n", - "1380 Observation shall be reimbursed according to C... " + " SERVICE_TERM REIMB_TERM \n", + "53 BLOOD COUNT; SPUN MICROHEMATOCRIT (CPT CODE: 8... CONTRACTAMOUNT : $3.35 \n", + "81 HEMATOCRIT (CPT CODE: 85014) CONTRACTAMOUNT : $3.35 \n", + "83 HEMOGLOBIN, CALORIMETRIC (CPT CODE: 85018) CONTRACTAMOUNT : $3.35 " ] }, "execution_count": 3, @@ -212,26 +123,33 @@ } ], "source": [ - "labels_df = pd.read_csv('src/testbed/inv-test-0502-RESULTS.csv')\n", + "labels_df = pd.read_csv('src/testbed/v6_DoczyAI_all_test_bed_LIVE_5.6.25_POSTPROCESSED.csv',encoding='utf-8')\n", "print(labels_df.shape)\n", "labels_df = labels_df[labels_df[\n", - " 'FILE_NAME'].isin([\"Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt\"\n", - " # , \"Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt\"\n", + " 'FILE_NAME'].isin([\n", + " # \"00-125434-CENTRAL MS DIAGNOSTIC, LLC-ICMPROVIDERAGREEMENT_78285.TXT\",\n", + " \"02-0677066-EYEMASTERS-ICMPROVIDERAGREEMENT_64220_2.TXT\",\n", + " # \"050540697 DEEPAK NANDA 2017 PHSP MU.TXT\",\n", + " # \"06-1798267-ANTHONY W. LE, A PROFESSIONAL CORP-ICMPROVIDERAGREEMENT_316844.TXT\",\n", + " # \"133923495 CAIPA 2015 PHSP.TXT\",\n", + " ])]\n", + "print(labels_df.shape)\n", + "\n", + "labels_df = labels_df[labels_df[\n", + " 'REIMB_TERM'].isin([\n", + " \"CONTRACTAMOUNT : $3.35\"\n", + " # , \"One hundred thirty percent (130%) of the then-current Medicare Average Sales Price (ASP) for Medicare Part B Drugs. In the event there is no Medicare ASP for a certain prescription drug, reimbursement will be based on the Wholesale Acquisition Cost (WAC).\"\n", + " # , \"Health Net will offer $1,000,000 incremental reimbursement for the Medi-Cal line of business each year of the two year renewal effective 5/1/18 and 5/1/19, resulting in an additional $1M reimbursement from 5/1/18 through 4/30/19 and an additional $2M reimbursement from 5/1/19 through 4/30/20.\"\n", " ])]\n", "print(labels_df.shape)\n", "\n", - "# labels_df = labels_df[labels_df[\n", - "# 'REIMB_TERM'].isin([\"If eligible for separate reimbursement under CMS guidelines, Prosthetics and Implants will be paid at one hundred (100%) percent of billed charges, not to exceed acquisition cost plus five (5%) percent.\"\n", - "# # , \"One hundred thirty percent (130%) of the then-current Medicare Average Sales Price (ASP) for Medicare Part B Drugs. In the event there is no Medicare ASP for a certain prescription drug, reimbursement will be based on the Wholesale Acquisition Cost (WAC).\"\n", - "# # , \"Health Net will offer $1,000,000 incremental reimbursement for the Medi-Cal line of business each year of the two year renewal effective 5/1/18 and 5/1/19, resulting in an additional $1M reimbursement from 5/1/18 through 4/30/19 and an additional $2M reimbursement from 5/1/19 through 4/30/20.\"\n", - "# ])]\n", - "print(labels_df.shape)\n", - "\n", "labels_df= labels_df.rename(columns = {\"CONTRACT_SERVICE_CD_OR_DESC\": \"SERVICE_TERM\",\n", - " \"CONTRACT_CARVEOUT_IND\": \"CARVEOUT_IND\",\n", + " # \"CONTRACT_CARVEOUT_IND\": \"CARVEOUT_IND\",\n", " \"CONTRACT_REIMBURSEMENT_METHOD\": \"REIMB_TERM\"})\n", "\n", - "labels_df_for_prediction = labels_df[[\"FILE_NAME\", \"SERVICE_TERM\", \"CARVEOUT_IND\", \"REIMB_TERM\"]]\n", + "labels_df_for_prediction = labels_df[[\"FILE_NAME\", \"SERVICE_TERM\"\n", + " # , \"CARVEOUT_IND\"\n", + " , \"REIMB_TERM\"]]\n", "labels_df_unique_rows = labels_df_for_prediction.drop_duplicates()\n", "labels_df_unique_rows" ] @@ -245,50 +163,80 @@ "name": "stdout", "output_type": "stream", "text": [ - "{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Affinity Network', 'CARVEOUT_IND': 'N', 'REIMB_TERM': '10% discount from the reimbursement rates listed below. All claims will be processed according to the rules outlined below, with an additional 10% discount calculated and deducted from the total allowed amount for each claim.'}\n", - "[{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Affinity Network', 'CARVEOUT_IND': 'N', 'REIMB_TERM': '10% discount from the reimbursement rates listed below. All claims will be processed according to the rules outlined below, with an additional 10% discount calculated and deducted from the total allowed amount for each claim.', 'LESSER_OF_IND': 'N', 'GREATER_OF_IND': 'N', 'AARETE_DERIVED_REIMB_METHOD': 'Billed Charges', 'UNIT_OF_MEASURE': '', 'REIMB_FEE_RATE': '', 'REIMB_PCT_RATE': '90', 'NOT_TO_EXCEED_IND': 'N', 'DEFAULT_IND': 'N', 'FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE_VERSION': 'N/A'}]\n", - "{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Inpatient Services', 'CARVEOUT_IND': 'N', 'REIMB_TERM': \"The lesser of the rates set forth in this Exhibit or 100% of Hospitals' billed charges. Inpatient rate determination will utilize the Conversion Factor stated above multiplied by the 10-1-18 MS-DRG table weight (version 36), including adjustment for transfers. $21,450 Conversion Factor\"}\n", - "[{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Inpatient Services', 'CARVEOUT_IND': 'N', 'REIMB_TERM': \"The lesser of the rates set forth in this Exhibit or 100% of Hospitals' billed charges. Inpatient rate determination will utilize the Conversion Factor stated above multiplied by the 10-1-18 MS-DRG table weight (version 36), including adjustment for transfers. $21,450 Conversion Factor\", 'LESSER_OF_IND': 'Y', 'GREATER_OF_IND': 'N', 'AARETE_DERIVED_REIMB_METHOD': 'Grouper', 'UNIT_OF_MEASURE': '', 'REIMB_FEE_RATE': 21450, 'REIMB_PCT_RATE': 100, 'NOT_TO_EXCEED_IND': 'N', 'DEFAULT_IND': 'N', 'FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE_VERSION': 'N/A'}, {'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Inpatient Services', 'CARVEOUT_IND': 'N', 'REIMB_TERM': \"The lesser of the rates set forth in this Exhibit or 100% of Hospitals' billed charges. Inpatient rate determination will utilize the Conversion Factor stated above multiplied by the 10-1-18 MS-DRG table weight (version 36), including adjustment for transfers. $21,450 Conversion Factor\", 'LESSER_OF_IND': 'Y', 'GREATER_OF_IND': 'N', 'AARETE_DERIVED_REIMB_METHOD': 'Billed Charges', 'UNIT_OF_MEASURE': '', 'REIMB_FEE_RATE': '', 'REIMB_PCT_RATE': 100, 'NOT_TO_EXCEED_IND': 'N', 'DEFAULT_IND': 'N', 'FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE_VERSION': 'N/A'}]\n", - "{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Inpatient Stop Loss Provision', 'CARVEOUT_IND': 'N', 'REIMB_TERM': 'Threshold: 180% of Compensation Rate, as applicable. Percent Allowed Above Threshold: 80%. When inpatient charges exceed the Threshold, eighty percent (80%) of the amount in excess of the Threshold is allowed in addition to the applicable Case Rate.'}\n", - "[{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Inpatient Stop Loss Provision', 'CARVEOUT_IND': 'N', 'REIMB_TERM': 'Threshold: 180% of Compensation Rate, as applicable. Percent Allowed Above Threshold: 80%. When inpatient charges exceed the Threshold, eighty percent (80%) of the amount in excess of the Threshold is allowed in addition to the applicable Case Rate.', 'LESSER_OF_IND': 'N', 'GREATER_OF_IND': 'N', 'AARETE_DERIVED_REIMB_METHOD': 'Billed Charges', 'UNIT_OF_MEASURE': '', 'REIMB_FEE_RATE': '', 'REIMB_PCT_RATE': '180', 'NOT_TO_EXCEED_IND': 'N', 'DEFAULT_IND': 'N', 'FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE_VERSION': 'N/A'}, {'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Inpatient Stop Loss Provision', 'CARVEOUT_IND': 'N', 'REIMB_TERM': 'Threshold: 180% of Compensation Rate, as applicable. Percent Allowed Above Threshold: 80%. When inpatient charges exceed the Threshold, eighty percent (80%) of the amount in excess of the Threshold is allowed in addition to the applicable Case Rate.', 'LESSER_OF_IND': 'N', 'GREATER_OF_IND': 'N', 'AARETE_DERIVED_REIMB_METHOD': 'Billed Charges', 'UNIT_OF_MEASURE': '', 'REIMB_FEE_RATE': '', 'REIMB_PCT_RATE': '80', 'NOT_TO_EXCEED_IND': 'N', 'DEFAULT_IND': 'N', 'FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE_VERSION': 'N/A'}]\n", - "{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Re-admission of a Member', 'CARVEOUT_IND': 'Y', 'REIMB_TERM': 'If a Member is re-admitted to Hospital within 14 days for a service within the same Major Diagnostic Category (MDC) no payment will be made for that admission.'}\n", - "[{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Re-admission of a Member', 'CARVEOUT_IND': 'Y', 'REIMB_TERM': 'If a Member is re-admitted to Hospital within 14 days for a service within the same Major Diagnostic Category (MDC) no payment will be made for that admission.'}]\n", - "{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Outpatient Services within 3 days of Admission', 'CARVEOUT_IND': 'Y', 'REIMB_TERM': 'Pre-admission tests within 3 days of an admission should be included with the admission and not billed separately consistent with Medicare rules.'}\n", - "[{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Outpatient Services within 3 days of Admission', 'CARVEOUT_IND': 'Y', 'REIMB_TERM': 'Pre-admission tests within 3 days of an admission should be included with the admission and not billed separately consistent with Medicare rules.'}]\n", - "{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Coding Intensity Review', 'CARVEOUT_IND': 'N', 'REIMB_TERM': 'If Hospitals Case Mix Index (CMI) increases more than 4% in any 12 month period Moda Health reserves the right to audit the coding. If the CMI increase is due to coding intensity increase rather than patient severity increases Moda Health reserves the right to adjust the Hospital Rates.'}\n", - "[{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Coding Intensity Review', 'CARVEOUT_IND': 'N', 'REIMB_TERM': 'If Hospitals Case Mix Index (CMI) increases more than 4% in any 12 month period Moda Health reserves the right to audit the coding. If the CMI increase is due to coding intensity increase rather than patient severity increases Moda Health reserves the right to adjust the Hospital Rates.', 'LESSER_OF_IND': 'N', 'GREATER_OF_IND': 'N', 'AARETE_DERIVED_REIMB_METHOD': '', 'UNIT_OF_MEASURE': '', 'REIMB_FEE_RATE': '', 'REIMB_PCT_RATE': '100', 'NOT_TO_EXCEED_IND': 'N', 'DEFAULT_IND': 'N', 'FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE_VERSION': 'N/A'}]\n", - "{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Outpatient Services', 'CARVEOUT_IND': 'N', 'REIMB_TERM': \"The lesser of 345% of Medicare Outpatient Prospective Payment System (OPPS) Methodology using appropriate Tables and Schedules in effect on the date of service, including outlier payments and with GPCI and wage index adjustments, or 100% of Hospital's billed charges\"}\n", - "[{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Outpatient Services', 'CARVEOUT_IND': 'N', 'REIMB_TERM': \"The lesser of 345% of Medicare Outpatient Prospective Payment System (OPPS) Methodology using appropriate Tables and Schedules in effect on the date of service, including outlier payments and with GPCI and wage index adjustments, or 100% of Hospital's billed charges\", 'LESSER_OF_IND': 'Y', 'GREATER_OF_IND': 'N', 'AARETE_DERIVED_REIMB_METHOD': 'Grouper', 'UNIT_OF_MEASURE': '', 'REIMB_FEE_RATE': '', 'REIMB_PCT_RATE': 345, 'NOT_TO_EXCEED_IND': 'N', 'DEFAULT_IND': 'N', 'FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE_VERSION': 'N/A'}, {'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Outpatient Services', 'CARVEOUT_IND': 'N', 'REIMB_TERM': \"The lesser of 345% of Medicare Outpatient Prospective Payment System (OPPS) Methodology using appropriate Tables and Schedules in effect on the date of service, including outlier payments and with GPCI and wage index adjustments, or 100% of Hospital's billed charges\", 'LESSER_OF_IND': 'Y', 'GREATER_OF_IND': 'N', 'AARETE_DERIVED_REIMB_METHOD': 'Billed Charges', 'UNIT_OF_MEASURE': '', 'REIMB_FEE_RATE': '', 'REIMB_PCT_RATE': 100, 'NOT_TO_EXCEED_IND': 'N', 'DEFAULT_IND': 'N', 'FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE_VERSION': 'N/A'}]\n", - "{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Prosthetics and Implants', 'CARVEOUT_IND': 'N', 'REIMB_TERM': 'If eligible for separate reimbursement under CMS guidelines, Prosthetics and Implants will be paid at one hundred (100%) percent of billed charges, not to exceed acquisition cost plus five (5%) percent.'}\n", - "[{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Prosthetics and Implants', 'CARVEOUT_IND': 'N', 'REIMB_TERM': 'If eligible for separate reimbursement under CMS guidelines, Prosthetics and Implants will be paid at one hundred (100%) percent of billed charges, not to exceed acquisition cost plus five (5%) percent.', 'LESSER_OF_IND': 'N', 'GREATER_OF_IND': 'N', 'AARETE_DERIVED_REIMB_METHOD': 'Billed Charges', 'UNIT_OF_MEASURE': '', 'REIMB_FEE_RATE': '', 'REIMB_PCT_RATE': 100, 'NOT_TO_EXCEED_IND': 'Y', 'DEFAULT_IND': 'N', 'FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE_VERSION': 'N/A'}, {'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Prosthetics and Implants', 'CARVEOUT_IND': 'N', 'REIMB_TERM': 'If eligible for separate reimbursement under CMS guidelines, Prosthetics and Implants will be paid at one hundred (100%) percent of billed charges, not to exceed acquisition cost plus five (5%) percent.', 'LESSER_OF_IND': 'N', 'GREATER_OF_IND': 'N', 'AARETE_DERIVED_REIMB_METHOD': 'Cost Plus', 'UNIT_OF_MEASURE': '', 'REIMB_FEE_RATE': '', 'REIMB_PCT_RATE': 5, 'NOT_TO_EXCEED_IND': 'N', 'DEFAULT_IND': 'N', 'FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE_VERSION': 'N/A'}]\n", - "{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Surgery - Secondary procedures', 'CARVEOUT_IND': 'Y', 'REIMB_TERM': 'Secondary procedures performed on the same day as primary procedures will be reimbursed at fifty percent (50%) of the allowed amount for the procedure'}\n", - "[{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Surgery - Secondary procedures', 'CARVEOUT_IND': 'Y', 'REIMB_TERM': 'Secondary procedures performed on the same day as primary procedures will be reimbursed at fifty percent (50%) of the allowed amount for the procedure'}]\n", - "{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Surgery - Subsequent procedures', 'CARVEOUT_IND': 'Y', 'REIMB_TERM': 'Any subsequent procedures performed on the same day as the primary procedure will be reimbursed at fifty percent (50%) of the allowed amount for those procedures'}\n", - "[{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Surgery - Subsequent procedures', 'CARVEOUT_IND': 'Y', 'REIMB_TERM': 'Any subsequent procedures performed on the same day as the primary procedure will be reimbursed at fifty percent (50%) of the allowed amount for those procedures'}]\n", - "{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Observation', 'CARVEOUT_IND': 'N', 'REIMB_TERM': 'Observation shall be reimbursed according to CMS guidelines'}\n", - "[{'FILE_NAME': 'Custom_2020-01-01 Com Affinity Amend FE - St Charles Health System MU.txt', 'SERVICE_TERM': 'Observation', 'CARVEOUT_IND': 'N', 'REIMB_TERM': 'Observation shall be reimbursed according to CMS guidelines', 'LESSER_OF_IND': 'N', 'GREATER_OF_IND': 'N', 'AARETE_DERIVED_REIMB_METHOD': 'Fee Schedule', 'UNIT_OF_MEASURE': '', 'REIMB_FEE_RATE': '', 'REIMB_PCT_RATE': 100, 'NOT_TO_EXCEED_IND': 'N', 'DEFAULT_IND': 'N', 'FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE': 'CMS', 'FEE_SCHEDULE_VERSION': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE_VERSION': 'current'}]\n" + "llm_answer_raw: In this case, we have a specific CPT code (85013) mentioned for a particular service (BLOOD COUNT; SPUN MICROHEMATOCRIT). The methodology provides a specific contractual amount for this service.\n", + "\n", + "This scenario falls under the PAYMENT_CARVEOUT case. The definition for PAYMENT_CARVEOUT states: \"Describes payments for services or codes that are separately mentioned or carved out from the standard payment for all covered services. Examples include 'Radiology covered services', 'Anesthesia covered services', 'Pharmaceuticals' and 'HEMATOCRIT (CPT CODE: 85014)'. Any service or code that is specifically or separately mentioned falls under the 'payment_carveout' category.\"\n", + "\n", + "The given service is very similar to one of the examples provided (HEMATOCRIT), and it's a specific CPT code that's being mentioned separately with its own contractual amount. This fits the definition of a payment carveout perfectly.\n", + "\n", + "Therefore, my answer is:\n", + "\n", + "|PAYMENT_CARVEOUT|\n", + "{'FILE_NAME': '02-0677066-EYEMASTERS-ICMPROVIDERAGREEMENT_64220_2.TXT', 'SERVICE_TERM': 'BLOOD COUNT; SPUN MICROHEMATOCRIT (CPT CODE: 85013)', 'REIMB_TERM': 'CONTRACTAMOUNT : $3.35', 'CARVEOUT_CD': 'PAYMENT_CARVEOUT', 'CARVEOUT_IND': 'Y', 'DEFAULT_IND': 'N'}\n", + "[{'FILE_NAME': '02-0677066-EYEMASTERS-ICMPROVIDERAGREEMENT_64220_2.TXT', 'SERVICE_TERM': 'BLOOD COUNT; SPUN MICROHEMATOCRIT (CPT CODE: 85013)', 'REIMB_TERM': 'CONTRACTAMOUNT : $3.35', 'CARVEOUT_CD': 'PAYMENT_CARVEOUT', 'CARVEOUT_IND': 'Y', 'DEFAULT_IND': 'N', 'LESSER_OF_IND': 'N', 'GREATER_OF_IND': 'N', 'AARETE_DERIVED_REIMB_METHOD': 'Flat Rate', 'UNIT_OF_MEASURE': 'Per Service', 'REIMB_FEE_RATE': '3.35', 'REIMB_PCT_RATE': 'N/A', 'NOT_TO_EXCEED_IND': 'N', 'FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE_VERSION': 'N/A'}]\n", + "llm_answer_raw: Based on the given Service and Methodology, this case falls under the PAYMENT_CARVEOUT category. Here's why:\n", + "\n", + "1. The Service is specifically mentioned as \"HEMATOCRIT (CPT CODE: 85014)\". This is a specific service with a CPT code, which is separately mentioned.\n", + "\n", + "2. The Methodology provides a specific contractual amount ($3.35) for this particular service.\n", + "\n", + "3. According to the definition of PAYMENT_CARVEOUT, it \"Describes payments for services or codes that are separately mentioned or carved out from the standard payment for all covered services.\" The definition even specifically mentions \"HEMATOCRIT (CPT CODE: 85014)\" as an example.\n", + "\n", + "Therefore, the answer is:\n", + "\n", + "|PAYMENT_CARVEOUT|\n", + "{'FILE_NAME': '02-0677066-EYEMASTERS-ICMPROVIDERAGREEMENT_64220_2.TXT', 'SERVICE_TERM': 'HEMATOCRIT (CPT CODE: 85014)', 'REIMB_TERM': 'CONTRACTAMOUNT : $3.35', 'CARVEOUT_CD': 'PAYMENT_CARVEOUT', 'CARVEOUT_IND': 'Y', 'DEFAULT_IND': 'N'}\n", + "[{'FILE_NAME': '02-0677066-EYEMASTERS-ICMPROVIDERAGREEMENT_64220_2.TXT', 'SERVICE_TERM': 'HEMATOCRIT (CPT CODE: 85014)', 'REIMB_TERM': 'CONTRACTAMOUNT : $3.35', 'CARVEOUT_CD': 'PAYMENT_CARVEOUT', 'CARVEOUT_IND': 'Y', 'DEFAULT_IND': 'N', 'LESSER_OF_IND': 'N', 'GREATER_OF_IND': 'N', 'AARETE_DERIVED_REIMB_METHOD': 'Flat Rate', 'UNIT_OF_MEASURE': 'Per Service', 'REIMB_FEE_RATE': '3.35', 'REIMB_PCT_RATE': 'N/A', 'NOT_TO_EXCEED_IND': 'N', 'FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE_VERSION': 'N/A'}]\n", + "llm_answer_raw: In this case, we have a specific CPT code (85018) for a particular service (HEMOGLOBIN, CALORIMETRIC) with a defined contractual amount ($3.35). This scenario best fits the PAYMENT_CARVEOUT case.\n", + "\n", + "The PAYMENT_CARVEOUT case is described as:\n", + "\"Describes payments for services or codes that are separately mentioned or carved out from the standard payment for all covered services. Examples include 'Radiology covered services', 'Anesthesia covered services', 'Pharmaceuticals' and 'HEMATOCRIT (CPT CODE: 85014)'. Any service or code that is specifically or separately mentioned falls under the 'payment_carveout' category.\"\n", + "\n", + "This example closely matches the given description, as it's a specific service with a CPT code that has a separately mentioned payment amount. It's not part of a general covered services category but is individually specified.\n", + "\n", + "Therefore, my answer is:\n", + "\n", + "|PAYMENT_CARVEOUT|\n", + "{'FILE_NAME': '02-0677066-EYEMASTERS-ICMPROVIDERAGREEMENT_64220_2.TXT', 'SERVICE_TERM': 'HEMOGLOBIN, CALORIMETRIC (CPT CODE: 85018)', 'REIMB_TERM': 'CONTRACTAMOUNT : $3.35', 'CARVEOUT_CD': 'PAYMENT_CARVEOUT', 'CARVEOUT_IND': 'Y', 'DEFAULT_IND': 'N'}\n", + "[{'FILE_NAME': '02-0677066-EYEMASTERS-ICMPROVIDERAGREEMENT_64220_2.TXT', 'SERVICE_TERM': 'HEMOGLOBIN, CALORIMETRIC (CPT CODE: 85018)', 'REIMB_TERM': 'CONTRACTAMOUNT : $3.35', 'CARVEOUT_CD': 'PAYMENT_CARVEOUT', 'CARVEOUT_IND': 'Y', 'DEFAULT_IND': 'N', 'LESSER_OF_IND': 'N', 'GREATER_OF_IND': 'N', 'AARETE_DERIVED_REIMB_METHOD': 'Flat Rate', 'UNIT_OF_MEASURE': 'Per Service', 'REIMB_FEE_RATE': '3.35', 'REIMB_PCT_RATE': 'N/A', 'NOT_TO_EXCEED_IND': 'N', 'FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE': 'N/A', 'AARETE_DERIVED_FEE_SCHEDULE_VERSION': 'N/A'}]\n" ] } ], "source": [ - "from src.investment.one_to_n_funcs import get_methodology_breakout\n", + "# from src.investment.one_to_n_funcs import get_methodology_breakout\n", "\n", - "reimbursement_primary_answers = labels_df_unique_rows[[\"FILE_NAME\", \"SERVICE_TERM\", \"CARVEOUT_IND\", \"REIMB_TERM\"]].to_dict(orient='records')\n", + "# reimbursement_primary_answers = labels_df_unique_rows[[\"FILE_NAME\", \"SERVICE_TERM\", \"CARVEOUT_IND\", \"REIMB_TERM\"]].to_dict(orient='records')\n", + "# predictions_list = []\n", + "\n", + "# for reimbursement_primary in reimbursement_primary_answers:\n", + "# filename = reimbursement_primary[\"FILE_NAME\"]\n", + "# methodology_breakout_answers = get_methodology_breakout([reimbursement_primary], filename)\n", + "# print(reimbursement_primary)\n", + "# print(methodology_breakout_answers)\n", + "# predictions_list.extend(methodology_breakout_answers)\n", + "\n", + "# predictions_df = pd.DataFrame(predictions_list)\n", + "\n", + "from src.investment.one_to_n_funcs import get_special_cases\n", + "\n", + "reimbursement_primary_answers = labels_df_unique_rows[[\"FILE_NAME\", \"SERVICE_TERM\"\n", + " # , \"CARVEOUT_IND\"\n", + " , \"REIMB_TERM\"]].to_dict(orient='records')\n", "predictions_list = []\n", "\n", "for reimbursement_primary in reimbursement_primary_answers:\n", " filename = reimbursement_primary[\"FILE_NAME\"]\n", - " methodology_breakout_answers = get_methodology_breakout([reimbursement_primary], filename)\n", + " carveout_answers = get_special_cases([reimbursement_primary], filename)\n", " print(reimbursement_primary)\n", - " print(methodology_breakout_answers)\n", - " predictions_list.extend(methodology_breakout_answers)\n", + " print(carveout_answers)\n", + " predictions_list.extend(carveout_answers)\n", "\n", "predictions_df = pd.DataFrame(predictions_list)" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -300,16 +248,16 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "(14, 16)" + "(3, 16)" ] }, - "execution_count": 6, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -319,6 +267,33 @@ "predictions_df1.to_csv('predictions.csv', index=False)\n", "predictions_df1.shape" ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(3, 16)" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "predictions_df.shape" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/fieldExtraction/tests/dynamic_test.py b/fieldExtraction/tests/dynamic_test.py index fe4ab05..d00c3a3 100644 --- a/fieldExtraction/tests/dynamic_test.py +++ b/fieldExtraction/tests/dynamic_test.py @@ -143,14 +143,12 @@ class TestOneToN(unittest.TestCase): @patch('src.investment.one_to_n_funcs.get_reimbursement_primary') @patch('src.investment.one_to_n_funcs.get_special_cases') - @patch('src.investment.one_to_n_funcs.get_methodology_breakout') @patch('src.investment.code_funcs.get_code_breakout') - def test_reimbursement_level(self, mock_code_breakout, mock_methodology_breakout, + def test_reimbursement_level(self, mock_code_breakout, mock_special_cases, mock_reimbursement_primary): # Setup mock_reimbursement_primary.return_value = [{"REIMB_TERM": "term1"}] mock_special_cases.return_value = [{"REIMB_TERM": "term1", "CARVEOUT_IND": "N"}] - mock_methodology_breakout.return_value = [{"REIMB_TERM": "term1", "METHOD": "method1"}] mock_code_breakout.return_value = [{"REIMB_TERM": "term1", "CODE": "code1"}] mock_fields = MagicMock() @@ -167,7 +165,6 @@ class TestOneToN(unittest.TestCase): self.assertEqual(result[0]["CODE"], "code1") mock_reimbursement_primary.assert_called_once() mock_special_cases.assert_called_once() - mock_methodology_breakout.assert_called_once() mock_code_breakout.assert_called_once() if __name__ == '__main__': diff --git a/fieldExtraction/tests/one_to_n_test.py b/fieldExtraction/tests/one_to_n_test.py index 4afc807..f57385e 100644 --- a/fieldExtraction/tests/one_to_n_test.py +++ b/fieldExtraction/tests/one_to_n_test.py @@ -103,14 +103,12 @@ class TestOneToN(unittest.TestCase): @patch('src.investment.one_to_n_funcs.get_reimbursement_primary') @patch('src.investment.one_to_n_funcs.get_special_cases') - @patch('src.investment.one_to_n_funcs.get_methodology_breakout') @patch('src.investment.code_funcs.get_code_breakout') - def test_reimbursement_level(self, mock_code_breakout, mock_methodology_breakout, + def test_reimbursement_level(self, mock_code_breakout, mock_special_cases, mock_reimbursement_primary): # Setup mock_reimbursement_primary.return_value = [{"REIMB_TERM": "term1"}] mock_special_cases.return_value = [{"REIMB_TERM": "term1", "CARVEOUT_IND": "N"}] - mock_methodology_breakout.return_value = [{"REIMB_TERM": "term1", "METHOD": "method1"}] mock_code_breakout.return_value = [{"REIMB_TERM": "term1", "CODE": "code1"}] mock_fields = MagicMock() @@ -127,7 +125,6 @@ class TestOneToN(unittest.TestCase): self.assertEqual(result[0]["CODE"], "code1") mock_reimbursement_primary.assert_called_once() mock_special_cases.assert_called_once() - mock_methodology_breakout.assert_called_once() mock_code_breakout.assert_called_once() if __name__ == '__main__':