56e3fdd1f8
DRAFT: Bugfix/all cnc hotfixes * Pipeline fix - health plan state * Update for prompt vs non-prompt fixes * Revert utils.find_regex_matches() * Remove prints * Non-prompt run * Health Plan State, IRS, NPI, LOB, Lesser, Prov 2, Default, Rate Standard, Contract Effective Date, Term Group * Merged in bugfix/agreement_name (pull request #294) contract title fixed * contract title fixed * Merged bugfix/all_cnc_hotfixes into bugfix/agreement_name Approved-by: Katon Minhas * All hotfixes added * Fixed utils * fix for clean_contract_effective_date * Merged in default-fix (pull request #296) moved default funcs to the top, dropped intermediate columns * moved default funcs to the top, dropped intermediate columns Approved-by: Katon Minhas * quick fix to dropping extra columns * Merged in bugfix/effective_date_meridian (pull request #297) fixed effective date for meridian contracts * fixed effective date for meridian contracts Approved-by: Katon Minhas * Default rate and Lesser fix * Merged in hotfix/irs_npi_updated (pull request #298) updated irs and npi hotfix funcs * updated irs and npi hotfix funcs * Merged bugfix/all_cnc_hotfixes into hotfix/irs_npi_updated Approved-by: Katon Minhas * non-functional commit - default only * debug commit - premerge * Batch 1 Dup File Reconciliation * Default rate fix * Full CNC 1A Run Config * Standard column refactor * Working stitching for 1A * Merged in Alex-Galarce/cnc_hotfix_effective_date_utilspy-edited-1732659983687 (pull request #301) Remove "license" from effective date smart chunking * Remove "license" from effective date smart chunking * Merged bugfix/all_cnc_hotfixes into Alex-Galarce/cnc_hotfix_effective_date_utilspy-edited-1732659983687 Approved-by: Katon Minhas * Merged in hotfix/irs_batch2_feedback (pull request #300) IRS fix for feedback on batch2 * IRS fix for feedback on batch2 * Merged bugfix/all_cnc_hotfixes into hotfix/irs_batch2_feedback Approved-by: Katon Minhas * Merged main into bugfix/all_cnc_hotfixes Approved-by: Katon Minhas
496 lines
44 KiB
Python
496 lines
44 KiB
Python
import valid
|
||
|
||
#####################################################################################
|
||
##################################### BOTTOM UP #####################################
|
||
#####################################################################################
|
||
|
||
|
||
def BOTTOM_UP_PRIMARY(page, payer):
|
||
return f"""
|
||
### PAGE START ### {page} ### PAGE END
|
||
|
||
The preceding text is one page of a contract between a Payer {payer} and a provider in their network. Your job is to extract attributes related to the reimbursement of different services and specialties. Ensure every compensation term (with a % or $ value) is captured.
|
||
|
||
Some values are found in sections explicitly identified as examples - these must be omitted from output. Other values might be related to liability - these must also be excluded.
|
||
|
||
Return at least one json object for each combination of attributes seen. It is possible that a page will not have any attributes. When this is the case, return an empty list.
|
||
|
||
Here are the attributes to be included in each dictionary, and instructions on how to correctly answer:
|
||
'FULL_SERVICE' : What is the Service that is being reimbursed? Include the full Service, including any distinguishing context. Include any codes that are part of the service, including revenue codes and procedure codes. Use only exact text from the document. Do not leave this field N/A.
|
||
'SUBHEADER' : What subheader or subsection name does the FULL_SERVICE belong to? This may be include crucial additional detail about the Service. Note that this is not a primary header like that of a compensation schedule or exhibit. If there is no subheader, write 'N/A'.
|
||
'FULL_METHODOLOGY' : Write the full sentence or paragraph in the text describing the reimbursement methodology.
|
||
'PROV_TYPE' : Write the Provider Type of the service. Choose ONLY from the following: {valid.VALID_PROV_TYPES}. Note that Facility may also be referred to as Hospital, Clinic, Institutional or similar. Professional may also be referred to as Physician, Physician Services, Practicioner, Provider or similar. Make sure to break out/differentiate between Professional, Facility, and Ancillary. Do not mix the two. Do NOT write 'N/A' for this field.
|
||
|
||
Ensure any relevant detail is included, including rates in tables if applicable. Include any 'Lesser of' statement that applies to the reimbursement. The 'Lesser of' statement might not be found in immediate proximity to the reimbursement term and may instead be found in a paragraph above. If the methodology is presented in a table, concatenate any relevant lesser of statement that applies to the table with the portion of the methodology found in the table.
|
||
|
||
Here are some examples of language with additional context to be included in the FULL_SERVICE:
|
||
Text: 'Covered Services that are Medicare Covered Services and are not Medicaid Covered Services',
|
||
Text: 'Covered Services rendered to Covered Person who are eligible for Medicare and enrolled in a MMP Plan that may include coverage for both Medicare and Medicaid Covered Services'
|
||
|
||
Here are some examples of SUBHEADER values:
|
||
Text: 'Where Payor is the Payor for both Medicare Covered Services and Medicaid Covered Services:'
|
||
Text: 'Outpatient Services'
|
||
|
||
Here is an example of text with a Lesser of statement and a table that should be included as a FULL_METHODOLOGY answer:
|
||
Text: 'Professional Covered Services is the lesser of: (i) Allowable Charges; or (ii) the "Contracted Rate" percentage found in Table 1. Table 1 - OB and Anesthesia Services : 100% of the Payor's Oregon Health Plan DMAP fee schedule. Radiology Services : 110% of Medicare Fee Schedule'
|
||
Answer: "[{{'FULL_SERVICE' : 'OB and Anesthesia Services', 'SUBHEADER' : 'N/A', 'FULL_METHODOLOGY' : 'lesser of (i) Allowable Charges; or (ii) 100% of the Payor's Oregon Health Plan DMAP fee schedule', 'PROV_TYPE' :'Professional'}},
|
||
{{'FULL_SERVICE' : 'Radiology Services', 'SUBHEADER' : 'N/A', 'FULL_METHODOLOGY' : 'lesser of (i) Allowable Charges; or (ii) 110% of Medicare Fee Schedule', 'PROV_TYPE' :'Professional'}}]"
|
||
|
||
If there is no clear FULL_SERVICE, then fill in 'Covered Services' for the FULL_SERVICE value.
|
||
|
||
Ensure that you do not forget to extract reimbursement items. MAKE SURE THAT YOU DON'T MISS ANY REIMBURSEMENT ITEMS AND RETURN ALL NECESSARY AND RELEVANT JSON OBJECTS.
|
||
Only return the list, with no other commentary or explanation. Ensure you abide by proper JSON formatting.
|
||
"""
|
||
|
||
|
||
def BOTTOM_UP_METHODOLOGY_BREAKOUT(d):
|
||
return f"""Analyze the full methodology text listed below:
|
||
{d['FULL_METHODOLOGY']}
|
||
|
||
Populate a dictionary with the following values:
|
||
|
||
LESSER : If the methodology contains the words 'lesser of' or similar, write 'Y'. Otherwise, write 'N'.
|
||
RATE_STANDARD : If there is only one rate in the methodology, write that rate here. Use the format 'X% of Y'. Do not include Flat Fees here. If there is no rate in the methodology, write 'N/A'. This value MUST be different than the LESSER_RATE and NOT_TO_EXCEED values.
|
||
RATE_SHORT : Return only the percentage from RATE_STANDARD in decimal form, with no other text. For example, 100% -> 1.
|
||
FLAT_FEE_STANDARD : If any part of the methodology is a flat fee (e.g. $X), write that value here. Do not include percentages here. If there is a 'Per' statement like 'Per Diem', 'Per Unit', etc, inclue that here as well. If there is no dollar value in the methodology, leave this field N/A. This value MUST be different than the LESSER_RATE and NOT_TO_EXCEED values.
|
||
LESSER_RATE : If the methodology contains the words 'lesser of' or similar, what is the rate listed that is NOT the RATE_STANDARD or the FLAT_FEE_STANDARD? Answer in the format 'X% of Y', where X is a numeric value. If there is no 'lesser of' in the text, write 'N/A'.
|
||
NOT_TO_EXCEED : Only if the methodology contains the specific phrase "Not to exceed", write the amount that the payment is not to exceed using the template "X% of Y" where X is a numeric value, if the value is a %. If the value is a dollar value, use the format "$X", where X is the numeric value. If "Not to exceed" is not found, write 'N/A'.
|
||
|
||
For the format 'X% of Y', if Y is in the below list, then apply the indicated abbreviation. If Y is not in the list, then write the full Y value:
|
||
Medicare --> MCR
|
||
Medicare Advantage --> MCR
|
||
Medicaid --> MCD
|
||
Medicare Advantage --> MA
|
||
Allowable Charges --> AC
|
||
Allowed Amount --> AA
|
||
Billed Charges --> BC
|
||
Average Sales Price --> ASP
|
||
Average Wholesale Price --> AWP
|
||
DMAP --> DMAP
|
||
Amount Payable by MCR --> MCR
|
||
Amount Payable by MCD --> MCD
|
||
|
||
Here are some examples of methodology text, and the correct response:
|
||
Example 1 -
|
||
Methodology: "The maximum compensation for Covered Services rendered to a Covered Person shall be the "Allowed Amount." The Allowed Amount for Covered Services is the lesser of: (i) Allowable Charges; or (ii) as applicable, (a) 100% of the Payor's Medicaid fee schedule in effect on the date of service, or (b) for those Covered Services included in the Service Categories in Table 1 below, the applicable "Contracted Rate" set forth in Table 1 below. Example Service | 80% of the Medicare Rate in effect on the date of service."
|
||
Correct Response:
|
||
{{'LESSER' : 'Y', 'RATE_STANDARD' : '80% of MCR', 'RATE_SHORT' : '0.8', 'FLAT_FEE_STANDARD' : 'N/A', 'LESSER_RATE' : '100% of AC', 'NOT_TO_EXCEED' : 'N/A'.}}
|
||
|
||
Example 2 -
|
||
Methodology: "The maximum compensation for Covered Services rendered to a Covered Person shall be the "Allowed Amount." The Allowed Amount for Covered Services is the lesser of: (i) Allowable Charges; (ii) 100% of the Payor's HEDIS target value in effect on the date of service, or (iii) for those Covered Services included in the Service Categories in Table 1 below, the applicable "Contracted Rate" set forth in Table 1 below. Example Service | $900.00 Per Unit"
|
||
Correct Response: {{'LESSER' : 'Y', 'RATE_STANDARD' : '100% of Payor's HEDIS target value', 'RATE_SHORT' : '1', 'FLAT_FEE_STANDARD' : '$900.00 Per Unit', 'LESSER_RATE' : '100% of AC', 'NOT_TO_EXCEED' : 'N/A'.}}
|
||
|
||
Example 3 -
|
||
Methodology: "The maximum compensation for Covered Services rendered to a Covered Person shall be the "Allowed Amount." The Allowed Amount for Covered Services is the lesser of: (i) Allowable Charges or (ii) Medicaid Allowed Amount"
|
||
Correct Response: {{'LESSER' : 'Y', 'RATE_STANDARD' : '100% of MCD', 'RATE_SHORT' : '1', 'FLAT_FEE_STANDARD' : 'N/A', 'LESSER_RATE' : '100% of AC', 'NOT_TO_EXCEED' : 'N/A'.}}
|
||
|
||
Example 4 -
|
||
Methodology: "The maximum compensation for Covered Services rendered to a Covered Person shall be the "Allowed Amount." The Allowed Amount for Covered Services is the lesser of: (i) Provider's Billed Charges or (ii) The amount payable by Medicare"
|
||
Correct Response: {{'LESSER' : 'Y', 'RATE_STANDARD' : '100% of MCR', 'RATE_SHORT' : '1', 'FLAT_FEE_STANDARD' : 'N/A', 'LESSER_RATE' : '100% of BC', 'NOT_TO_EXCEED' : 'N/A'.}}
|
||
|
||
Example 5 -
|
||
Methodology: "Multiple procedures performed during the same day will be reimbursed at 100% for the primary procedure, 50% for the second procedure, and 50% for the third procedure, subsequent procedures shall not be eligible for reimbursement."
|
||
Correct Response: {{'LESSER' : 'N', 'RATE_STANDARD' : '100% of AC / 50% of AC / 50% of AC / 0% of AC', 'RATE_SHORT' : '1 / 0.5 / 0.5 / 0', 'FLAT_FEE_STANDARD' : 'N/A', 'LESSER_RATE' : 'N/A', 'NOT_TO_EXCEED' : 'N/A'.}}
|
||
|
||
Example 6 -
|
||
Methodology: "Provider shall be entitled to the lesser of: (1) Anciliary Provider's billed charges; or (2) the amount payable by Medicare, not including Medicare coinsurance and deductibles, plus the amount payable by Medicaid as a secondary coverage based on the Medicaid fee schedule in effect on the date of service."
|
||
|
||
Correct Response: {{'LESSER' : 'Y', 'RATE_STANDARD' : '100% of MCR', 'RATE_SHORT' : '1', 'FLAT_FEE_STANDARD' : 'N/A', 'LESSER_RATE' : '100% of BC', 'NOT_TO_EXCEED' : 'N/A'.}}
|
||
|
||
Example 7 -
|
||
Methodology: "The Compensation Schedule for the Medicare Product at any given time is the lesser of (i) the Allowable Charges for the particular Covered Service, or (ii) the appropriate amount for such Covered Service under the Company's fee schedule in effect on the date of service for the Medicare Product."
|
||
Correct Response: {{'LESSER' : 'Y', 'RATE_STANDARD' : '100% of MCR', 'RATE_SHORT' : '1', 'FLAT_FEE_STANDARD' : 'N/A', 'LESSER_RATE' : '100% of AC', 'NOT_TO_EXCEED' : 'N/A'.}}
|
||
|
||
Only return the dictionary, with no other commentary or explanation. Ensure you abide by proper JSON formatting.
|
||
"""
|
||
|
||
|
||
def BOTTOM_UP_ESCALATOR(d, page):
|
||
return f"""### PAGE START ### {page} ### PAGE END
|
||
|
||
The above text contains a number of reimbursement terms. For the rest of this request, focus only on the specific term listed below:
|
||
Service: {d['FULL_SERVICE']}
|
||
Methodology: {d['FULL_METHODOLOGY']}
|
||
|
||
Identify if the above reimbursement term is subject to any escalators, or increases in rate over time. Also identify if there are any exclusions. Fill out the following fields:
|
||
'RATE_ESCALATOR_IND' : If there is language on the page stating that the given rate will increase over time, return 'Y'. Otherwise return 'N'.
|
||
'RATE_ESCALATOR_DT' : If there is a rate escalator, on what date or time period does it kick in? Write the date or time period only. If 'N', return 'N/A' for this field.
|
||
|
||
For the escalator fields, ensure that only updates and increases to the RATE itself (the percentage) are counted. Updates to Codes and other features do not apply here.
|
||
|
||
Only return the dictionary, with no other commentary or explanation. Ensure you abide by proper JSON formatting.
|
||
"""
|
||
|
||
|
||
#####################################################################################
|
||
##################################### TOP DOWN ######################################
|
||
#####################################################################################
|
||
|
||
|
||
def TOP_DOWN_PRIMARY(page):
|
||
return f"""### PAGE START ### {page} ### PAGE END
|
||
|
||
The preceding text is one page of a contract between a Payer and a provider in their network. Extract the names of certain entities listed in the contract and return a single dictionary with the values below:
|
||
|
||
Here are the attributes to be included in each dictionary, and instructions on how to correctly answer:
|
||
'EXHIBIT' : List any exhibit, attachment, or amendment names found on the page. Write the full name of the exhibit, including the exhibit number or letter, as well as any other subtitles describing the contents of the exhibit. Do NOT write the page number. If no Exhibit, Attachment, or Amendment is found, write 'N/A'.
|
||
'CONTRACT_LOB' : List the Line of Business mentioned on the page. Choose ONLY from the following: {valid.VALID_LOBS}. If there are multiple on the page, write them in a comma-separated list. If no LOB is found, write 'N/A'.
|
||
'CONTRACT_PROGRAM' : List any Programs or Plans mentioned on the page. {valid.VALID_PROGRAMS}. If no program is found, write 'N/A'.
|
||
|
||
'DEFAULT_TERM' : If there is a section labelled 'Default' or similar, write that entire section here. It may also be a term that describes the payment rate if there is no established payment amount. If there is no such term, write 'N/A'.
|
||
'DEFAULT_RATE' : Write the rate from the Default Term in the form 'X% of Y'. If there is no Default Term, or no rate in the Default Term, write 'N/A'.
|
||
'CDM_IND' : Is there language on the page regarding CDM Neutralization? Write 'Y' if yes, 'N' if no.
|
||
'CHARGEMASTER' : Is there language on the page related to Chargemaster Protections? If so, return the sentence or sentences. If not, return 'N/A'.
|
||
'ADD_ON_REIMBURSEMENT_LANGUAGE' : Extract the Add On Reimbursement language present in the contract. If it is not present, answer N/A.
|
||
|
||
If there are multiple answers for a given attribute, return the answers in a comma-separated list.
|
||
|
||
For all attributes, only write an answer if it is written on the page. Do not make up new phrases or words or try to deduce answers that are not seen. Simply write 'N/A' if none of the listed options are seen.
|
||
|
||
Only return the dictionary, with no other commentary or explanation. Ensure you abide by proper JSON formatting.
|
||
"""
|
||
|
||
|
||
TD_PRIMARY_FIELDS = [
|
||
"EXHIBIT",
|
||
"CONTRACT_LOB",
|
||
"CONTRACT_PROGRAM",
|
||
"DEFAULT_TERM",
|
||
"DEFAULT_RATE",
|
||
"CDM_IND",
|
||
"CHARGEMASTER",
|
||
"ADD_ON_REIMBURSEMENT_LANGUAGE",
|
||
]
|
||
|
||
|
||
def TOP_DOWN_EXHIBIT_CHECK(page_start):
|
||
return f"""Text: {page_start}
|
||
|
||
The above text is the start of a page.
|
||
Return 'Y' ONLY if the text contains the header of an Exhibit, Article, Amendment, Schedule, Attachment, or Addendum.
|
||
|
||
'Additional Provisions' is not an Exhibit name.
|
||
|
||
Otherwise, return 'N'.
|
||
"""
|
||
|
||
|
||
def TOP_DOWN_EXCLUSIONS(page):
|
||
return f"""### PAGE START ### {page} ### PAGE END
|
||
|
||
The above text contains a page with at least one term related to exclusions or inclusions
|
||
|
||
If it is indicated that any type of service or other situation should be EXCLUDED (or NOT INCLUDED), write just the exclusion clause here.
|
||
|
||
Include language that specifically has words like 'exclusion', 'excluded', 'not to include'.
|
||
If there is no exclusion clause, write 'N/A'.
|
||
The exclusion clause may be a single sentence, an entire paragraph, or multiple paragraphs.
|
||
|
||
Only write the EXACT text from the page, with no other commentary or explanation. Do not write ANY words in your response that are not found on the page.
|
||
"""
|
||
|
||
|
||
def TOP_DOWN_MEDICALLY_NECESSARY(page):
|
||
return f"""### PAGE START ### {page} ### PAGE END
|
||
|
||
The above text contains a page with at least one Medical Necessity term.
|
||
|
||
Extract the Medical Necessity paragraph from the page.
|
||
|
||
Only write the EXACT text from the page, with no other commentary or explanation. Do not write ANY words in your response that are not found on the page.
|
||
"""
|
||
|
||
|
||
#####################################################################################
|
||
#################################### CONDITIONAL ####################################
|
||
#####################################################################################
|
||
|
||
|
||
def CONDITIONAL_IP_OP_SMALL(s, m):
|
||
return f"""Service: {s}
|
||
Methodology: {m}
|
||
|
||
Is the term above related to Inpatient or Outpatient services?
|
||
|
||
Write only 'IP' for Inpatient, 'OP' for Outpatient, or 'N/A' if the answer is unclear.
|
||
|
||
Only write IP or OP if 'Inpatient' or 'Outpatient' is clearly and explicitly written in the Service or Methodology. Otherwise, write 'N/A'. Do not attempt to deduce the answer based on your prior knowledge.
|
||
|
||
Return only the answer, without using complete sentences.
|
||
"""
|
||
|
||
|
||
def CONDITIONAL_IP_OP_BIG(d, page):
|
||
return f"""### PAGE START ### {page} ### PAGE END
|
||
|
||
The above text contains a number of reimbursement terms. For the rest of this request, focus only on the specific term listed below:
|
||
Service: {d['FULL_SERVICE']}
|
||
Methodology: {d['FULL_METHODOLOGY']}
|
||
|
||
Based on the context given, is the term above related to Inpatient or Outpatient services.
|
||
|
||
Write only 'IP' for Inpatient, 'OP' for Outpatient. Only write IP or OP if it is EXPLICITLY written on the page and applies to the Service and Methodology.
|
||
|
||
If neither, simply write 'N/A'.
|
||
|
||
Return only the answer, without using complete sentences.
|
||
"""
|
||
|
||
|
||
def CONDITIONAL_PROV_2(d, page):
|
||
if "PROFESSIONAL" in d["PROV_TYPE"].upper():
|
||
valid_list = valid.VALID_PROF
|
||
elif "ANCILLARY" in d["PROV_TYPE"].upper():
|
||
valid_list = valid.VALID_ANC
|
||
elif "FACILITY" in d["PROV_TYPE"].upper():
|
||
valid_list = valid.VALID_FAC
|
||
else:
|
||
|
||
valid_list = valid.VALID_PROF + valid.VALID_ANC + valid.VALID_FAC
|
||
return f"""### PAGE START ### {page} ### PAGE END
|
||
|
||
The above text contains a number of reimbursement terms. For the rest of this request, focus only on the specific term listed below:
|
||
Service: {d['FULL_SERVICE']}
|
||
Methodology: {d['FULL_METHODOLOGY']}
|
||
Exhibit Name: {d['EXHIBIT']}
|
||
|
||
Based on the context given, what is the Provider Type applicable to the term above?
|
||
|
||
Choose ONLY from the following:
|
||
{valid_list}
|
||
Do not attempt to deduce the Provider Type from context clues. It will be clearly and explicitly written in the text itself. If there is not clear Provider Type from the list, write 'N/A'.
|
||
|
||
Return only the answer, without using complete sentences.
|
||
"""
|
||
|
||
|
||
def CONDITIONAL_DSH_IME_UC(page):
|
||
return f"""### PAGE START ### {page} ### PAGE END
|
||
|
||
Is there language on the page saying that DSH, GME, IME, or UC is included? Write 'Y' or 'N'.
|
||
|
||
Return only the answer, without using complete sentences.
|
||
"""
|
||
|
||
|
||
def CONDITIONAL_RBRVS(page):
|
||
return f"""### PAGE START ### {page} ### PAGE END
|
||
|
||
Is RBRVS language found anywhere on the page? Write 'Y' or 'N'.
|
||
|
||
Return only the answer 'Y' or 'N', without using complete sentences.
|
||
"""
|
||
|
||
|
||
def CONDITIONAL_STOP_LOSS(page):
|
||
return f"""### PAGE START ### {page} ### PAGE END
|
||
|
||
Does the page include a sentence describing stop-loss thresholds? If yes, write the threshold dollar value only. If not, write 'N/A'.
|
||
|
||
Return only the answer, without using complete sentences.
|
||
"""
|
||
|
||
|
||
def CONDITIONAL_LOB_CHECK(d, page):
|
||
return f"""### PAGE START ### {page} ### PAGE END
|
||
|
||
Above is a page of a contract, with several Services listed. For the rest of this task, focus only on the Service and methodology listed below:
|
||
Service: {d['FULL_SERVICE']}
|
||
Methodology: {d['FULL_METHODOLOGY']}
|
||
|
||
Below are the Line of Business values previously identified as being present on this page.
|
||
CONTRACT_LOB : {d['CONTRACT_LOB']}
|
||
|
||
First, identify the section of the page that the Service and Methodology belong to. This may be a specific subsection or paragraph. Do not write this answer out, only use it to inform your search for the LOB value.
|
||
|
||
Next, identify which single value of CONTRACT_LOB the given Service falls under. It can ONLY be ONE of values in the list. Do NOT return the original list.
|
||
The correct answer will likely be found in the same subsection or paragraph that the Service and Methodology are in. It might be listed somewhere close above the Service and Methodology text.
|
||
|
||
Again, there is only ONE correct answer in the list. Choose carefully.
|
||
|
||
Return only the Line of Business answer, without using complete sentences.
|
||
"""
|
||
|
||
|
||
#####################################################################################
|
||
############################# PRE- AND POST-PROCESSING ##############################
|
||
#####################################################################################
|
||
def FIX_JSON(d):
|
||
return f"""dict: {d}
|
||
|
||
The above dictionary was not parsable by the json.loads() function.
|
||
This may be due to the keys having commas, single- or double-quotes, or other json characters.
|
||
Modify the values and formatting of the string to make it json parsable. Remove punctuation from the values if needed.
|
||
|
||
Return only the json object, with no other commentary.
|
||
"""
|
||
|
||
|
||
def ALIGN_AND_FORMAT_TABLES(page):
|
||
return f"""{page}
|
||
|
||
----- End Page -----
|
||
|
||
Above is a page with one or more misplaced tables in json format.
|
||
|
||
Return the exact same page with the tables properly aligned and formatted, without changing anything else about the page. Here are instructions and examples to help:
|
||
|
||
Alignment Instructions:
|
||
Align the tables in the text using the Table Header text found after -------Table Start--------. If there is no header, align based on context clues in the text such as "the table below", etc.
|
||
If there are multiple tables on the page, the first table should be placed in the first valid spot, the second in the second, etc.
|
||
If the Table Header is None, place the updated table at the top of the page.
|
||
|
||
Formatting Instructions:
|
||
Here is a template format to use:
|
||
|
||
Original JSON: "-------Table Start-------- Table Header {{'Column 1' : ['Value 1', 'Value 2', 'Value 3'], 'Column 2' : ['Value 4', 'Value 5', 'Value 6']}}-------Table End--------"
|
||
|
||
Output Format:
|
||
Table Header
|
||
Column 1 : Value 1 | Column 2 : Value 4
|
||
Column 1 : Value 2 | Column 2 : Value 5
|
||
Column 1 : Value 3 | Column 2 : Value 6
|
||
|
||
Ensure that all text other than the tables is exactly the same
|
||
|
||
Write only the page text, with no additional commentary.
|
||
"""
|
||
|
||
|
||
def LOB_SWEEPER(exhibit):
|
||
return f"""Exhibit Name: {exhibit}
|
||
|
||
Based on the above Exhibit Name, which one or more of the following LOB values does the Exhibit refer to? Only choose LOBs that are explicitely written in the Exhibit.
|
||
|
||
Valid LOBs: {valid.VALID_LOBS}
|
||
|
||
Return ONLY the LOB, with no additional commentary or explanation. If there are no LOBs written, simply write 'N/A'.
|
||
"""
|
||
|
||
|
||
#####################################################################################
|
||
###################################### AC Fields ####################################
|
||
#####################################################################################
|
||
|
||
|
||
def AC_SINGLE_FIELD_TEMPLATE(context, question):
|
||
return f"""## START CONTRACT TEXT ##
|
||
{context}
|
||
## END CONTRACT TEXT ##
|
||
|
||
Answer the following question, using the above contract text given as context: {question}.
|
||
|
||
Do NOT add any additional commentary explaining the answer. Return ONLY the exact text from the contract, or N/A.
|
||
"""
|
||
|
||
|
||
def AC_MULTI_FIELD_TEMPLATE(context, questions):
|
||
return f"""## START CONTRACT TEXT ##
|
||
{context}
|
||
## END CONTRACT TEXT ##
|
||
|
||
Answer the following questions, using the above contract text given as context.
|
||
For each question, provide ONLY the answer, with no additional commentary or explanation. Answer in JSON dictionary format, with every key included and no missing answers.
|
||
If for any question, no correct answer is found, return 'N/A'.
|
||
{questions}.
|
||
"""
|
||
|
||
|
||
AC_DICT = {
|
||
"CONTRACT_EFFECTIVE_DT": "Extract the contract effective date. This may be mentioned in one of the following locations: the signatory section, the preamble of the agreement, or the start of the amendment. Look for phrases such as /'This amendment is effective/'. Return this date in YYYY-MM-DD format.",
|
||
"CONTRACT_TITLE": "What is the complete title of the contract or the document? It is generally written in CAPITAL LETTERS and is found at the beginning of the document before a paragraph containing provider and payer name. It typically contains the words AGREEMENT, AMENDMENT, CONTRACT, ADDENDUM, MEMORANDUM, LETTER, PROVIDER or REQUEST. In case of agreement, typical structure is the provider name, followed by the phrase with agreement, followed potentially by a number signifying a version of the contract. In case of amendment, typical structure is word amendment followed by number, followed by the phrase with agreement. Extract the complete title of the contract or document as accurately as possible. Ensure: All leading characters are included for each word (e.g. 'NETWORK' instead of 'ETWORK'). Spaces between words are preserved in phrases (e.g., 'PROVIDER COLLABORATION' instead of 'PROVIDERCOLLABORATION'). If text appears incomplete or lacks spacing, use logical patterns like capitalization or common formatting rules to infer and correct the output. Replace new lines and line breaks with space.",
|
||
"PAYER_NAME": "What is the name of the payer that is a party to the contract as stated in the Preamble?",
|
||
"PROV_GROUP_NAME": "What is the name of the Group provider that is a party to the contract? This is generally found near keyword provider. Only return the name of the Group provider along with dba name.",
|
||
"PROV_GROUP_NPI": "What is the group provider's national provider identifier number mentioned in the contract? This may be found on the signature page or on the roster. It consists of 10 digits. Only return these 10 digits.",
|
||
"PROV_GROUP_TIN_SIGNATORY": "What is the Group provider's taxpayer identification number stated near signature in the contract? This is a 9 digit long number typically with a hyphen after the first 2 digits. Return only this 9 digit number with a hyphen after the first 2 digits.",
|
||
"PROV_GROUP_TIN": "What is the Group provider's taxpayer identification number stated in the contract? This is a 9 digit long number typically with a hyphen after the first 2 digits in it. Return only this 9 digit number with a hyphen after the first 2 digits. As an example, it has the format of XX-XXXXXXX Do not elaborate or add context. Do not pull any dates, do not pull any numbers that deviate from earlier described pattern. It must always be 9 digits. Strictly follow this instructions. Do not return any other information.",
|
||
"PROV_NPI_OTHER": 'What are all the other provider national provider identifier numbers (NPI) associated with this agreement? They consist of 10 digits and do not contain "-". Provide the list of all the other provider identifier numbers including those that are present in the table or attachment.',
|
||
"PROV_TIN_OTHER": "What are the provider taxpayer identification numbers (TIN) for each of the other providers associated with this agreement? They consist of 9 digits and may contain a hyphen after the first 2 digits. This is usually listed in the preample of the contract or on a roster. Provide only the 9 digit TINs.",
|
||
"TERMINATION_UPON_NOTICE": 'Extract the number of days can the contract be terminated by either party by giving notice. The answer may be found near the words "written notice of such termination" or "prior to the expiration". Only extract a value if one is present. Only return the number of days and nothing else.',
|
||
"TERMINATION_UPON_CAUSE": 'After how many days can the contract be terminated by either party upon breach of material term? The answer is usually found in section 7.2.2 or 10.2 but might be present in other sections as well. The answer is present after the Term language section. The answer may be found near the words "is in breach of any material term or condition". Here is an example of possible input text and the correct response. EXAMPLE INPUT TEXT: "By either party upon ninety (90) days prior written notice if the other party is in material breach of this Agreement, except that such termination shall not take place if the breach is cured within sixty (60) days following the written notice". EXAMPLE RESPONSE: 90.',
|
||
"TIME_TO_OBJECT": "How many days does the provider have to object to the amendment? The answer may be present in the Amendment section.",
|
||
"ASSIGNMENTS_CLAUSE_IND": 'Is assignment clause present in contract language? The answer is usually found in section 8.3 but might not always be present there. It can be found in the section with title containing "Assignment". Answer ONLY with Y or N. Do NOT write N/A.',
|
||
"NOTICE_PROVIDER_NAME": 'What is the notice provider name present usually near keywords like "Attn:". Return the full name, do not return any context. If it only says President/CEO and not the name itself then return N/A. Ensure that you do not pull the Payer\'s (EG. Superior Health Plan) info instead. Only pull the provider name.',
|
||
"NOTICE_PROVIDER_ADDRESS": "What is the notice provider address mentioned after the name of the provider. Only return the address of the provider, do not return any context. New Info --> Ensure Payer address (Eg. Superior Health Plan) isn't pulled. The payer address usually starts with 2100 South... Ensure you do not pull this. Always pull the provider address only. Ensure that you pull the full address with the city and state and zipcode. MAKE SURE YOU ALWAYS PULL THE CITY AND STATE AND ZIPCODE AT THE END. If it is not present in the text file, then do your best to at least return the state.",
|
||
"NPI_NAME": "What is the group provider's name whose national provider identifier number is mentioned in the contract? This may be found on the signature page or on the roster.",
|
||
"HEALTH_PLAN_STATE": "Which state is this health plan for?",
|
||
"SEQUESTRATION_LANGUAGE": "Is sequestration language present in the contract? It may be after reimbursement or compensation section. It is only present in case of medicare and medicare advantage. If Yes, extract the complete paragraph.",
|
||
# "SEQUESTRATION_REDUCTIONS_IND":"Are sequestration and reduction percentage present in the contract? Answer Yes if both are present otherwise answer No.",
|
||
"CONTRACT_AUTO_RENEWAL_IND": "If this contract automatically renews, answer Y. If this contract will remain in effect unless terminated, answer Y. If it will terminate after the mentioned termination date, answer N.",
|
||
"AMEND_CONTRACT_NOTICE_IND": 'Is amendment clause present in contract language? The answer is usually found in section 8.7 but might not always be present there. It may be found in the section with title containing "Amendment". Answer may be found near keywords "Agreement may be amended". Answer ONLY with Y or N. Do NOT write N/A.. Here is an example of possible input text and the correct response. EXAMPLE INPUT TEXT: "may amend this Agreement by giving Provider written notice". EXAMPLE RESPONSE: "Y". If the agreement does not explicitly indicate that it can be amended by giving written notice, the answer will be "N".',
|
||
"AFFILIATION_CLAUSE_IND": 'Is affiliation clause present in contract language? Answer may be found near keywords like "affiliate means a person or entity directly". Answer ONLY with Y or N. Do NOT write N/A.',
|
||
# "TERM_CLAUSE": """Extract the subsection or paragraph(s) labeled Term. It may also be labeled Termination. In instances there may be 2 bodies of text that you will need to pull. For example, first paragraph may be 'MCO must follow the procedures outlines in Section...' and the second one may be 'Not later than thirty (30) days following receipt of the termination notice...'. In this case, ensure that YOU ALWAYS PULL the whole text of the two paragraphs. If there are no such sections, extract the paragraph that most closely resembles this label. If there is still no correct answer, simply return 'N/A'.""",
|
||
"TERM_CLAUSE": """Extract the term or termination sections (or subsections or paragraphs), which are always present in the contract. They contain information related to term and termination of the contract. The biggest hint of a term or termination section will be the heading 'Term and Termination'. A secondary hint is that the first paragraph may be 'MCO must follow the procedures outlined in Section...' followed by 'Not later than XX days following receipt of the termination notice...'. In this case, ensure that YOU ALWAYS PULL the whole text of all relevant paragraphs.""",
|
||
# "TIMELY_FILING": "Extract all of the clauses of text and section paragraphs along with their section number that are pertaining to the Timely Filing clause. This clause usually details the conditions and days for when a provider must submit a claim by. Look for section heading titled /'Payment of Clean Claims/'. Look for language such as /'all provider claims shall be processed within 30 days from the date of claim reciept by the MCO/'. We want to extract all following langauage such as MCO shall not pay any claim submitted by provider..., MCO must adjudicate all appealed claims, till the whole section that starts with 'MCO may deny a claim for failure to file'.",
|
||
"CREDENTIALING_APP_IND": "Is credentialing defined in section 2.4 or any other subsection of the contract? Answer ONLY with Y or N. Do NOT write N/A.",
|
||
"CONTRACT_TERMINATION_DT": "What is the contract termination date? This might be listed within the Terms or Terms of Agreement section of the contract, or can be calculated by adding contract duration to the contract effective date. Return the date in YYYY-MM-DD format.",
|
||
"TIME_TO_OBJECT": "How many days does the provider have to object to the amendment? The answer may be present in the Amendment section. Only return the number of days, as an integer.",
|
||
"NON_RENEWAL_LANGUAGE": "Extract the section of the contract that describes non-renewal obligations, especially the number of days notice that must be given. Write the full relevant sentence or paragraph. Ensure that the exact term 'non-renewal' is present in the answer. Do NOT return an answer that does not have 'non-renewal'.",
|
||
"NON_RENEWAL_DAYS": "How many days of notice does the section indicate must be given to terminate the agreement? Examples are: 30, 60, 90, 180. Only return the number of days.",
|
||
"ACCESS_TO_MEDICAL_RECORDS": "Access clause contains information regarding access to medical records. It may be found in section 4.2 of the contract. Extract the Access clause present in the contract.",
|
||
# "ADD_ON_REIMBURSEMENT_IND":"Add On Reimbursement is usually present in Compensation section of the contract. Is Add On Reimbursement present in the Compensation section of the contract? Answer with a Yes or No, do not provide any other context.",
|
||
# "ADD_ON_REIMBURSEMENT_LANGUAGE":"Add On Reimbursement language is usually present in Compensation section of the contract. Extract the Add On Reimbursement language present in the contract. If it is not present, answer N/A.",
|
||
"CARVEOUT_VENDORS": "Carve-Out Vendors clause may be found in section 2.9 of the contract. Extract the Carve-Out Vendors clause present in the contract.",
|
||
"CLAIMS_EDITING_LANGUAGE": "Claims Editing Language is typically found in the claims section in the beginning parts of the contract. Extract Claims Editing Language present in the contract.",
|
||
# "CLAIMS_EDITING_LANGUAGE_IND":"Claims Editing Language is typically found in the claims section in the beginning parts of the contract. Is Claims Editing Language present in the contract? Answer with a Yes or No, do not provide any other context.",
|
||
"CLEAN_CLAIM": 'Extract the "Clean Claim" subsection present in definition section of the contract.',
|
||
# "CONFLICTS_BETWEEN_CERTAIN_DOCUMENTS_IND":"Is Conflicts Between Certain Documents clause present in the contract? Answer with a Yes or No, do not provide any other context.",
|
||
"CONFLICTS_BETWEEN_CERTAIN_DOCUMENTS_LANGUAGE": "Extract the Conflicts Between Certain Documents clause present in the contract.",
|
||
# "COST_SETTLEMENT_IND":"Is cost settlement language present in the contract? Answer with a Yes or No, do not provide any other context.",
|
||
"COST_SETTLEMENT_LANGUAGE": "Cost settlement language may be present in disputes and arbitration subsection of the contract. It usually contains keywords like settlementor cost settlement. Extract the cost settlement language present in the contract.",
|
||
"DEEMER_AMENDMENT": "Deemer Amendment clause may be found in section 8.7.2 of the contract. Extract the Deemer Amendment clause present in the contract.",
|
||
# "DELEGATED_FUNCTION_IND":"Is Delegated Function clause present in the contract? Answer with a Yes or No, do not provide any other context.",
|
||
"DELEGATED_TERMS": "Extract Delegated Terms present in the contract.",
|
||
"ECM": 'What is the "ECM" number mentioned in the contract? Only Answer the ECM number, do not provide any context. Do not provide ICM number.',
|
||
# "EXCLUSIVITY_REQUIREMENT_IND":"Is Exclusivity requirement clause present in the contract? Answer with a Yes or No, do not provide any other context.",
|
||
"EXCLUSIVITY_REQUIREMENT_LANGUAGE": "Extract Exclusivity requirement clause present in the contract.",
|
||
# "GUARANTEE_OF_PROVIDER_YIELD_IND":"Is Guarantee of Provider Yield Language present in the contract? Answer with a Yes or No, do not provide any other context.",
|
||
"GUARANTEE_OF_PROVIDER_YIELD_LANGUAGE": "Extract Guarantee of Provider Yield Language present in the contract.",
|
||
"HCBS_SERVICES": 'Extract HCBS services clause present either in the compensation or exhibit section of the contract. It may contain keywords like "for covered HCBS services, plan shall pay". Do not include definitions of HCBS.',
|
||
"INDEMNIFICATION": "Indemnification clause may be found in section 5.2 of the contract. Extract the Indemnification clause present in the contract. ",
|
||
# "INDEPENDENT_REVIEW_IND":"Is Independent Review language present in the contract? Answer with a Yes or No, do not provide any other context.",
|
||
"INDEPENDENT_REVIEW_LANGUAGE": "Extract Independent Review language present in the contract.",
|
||
# "INVOICE_PRICING_IND":"Is table with heading \"INVOICED SERVICES\" present in compensation schedule of the contract?",
|
||
"INVOICE_PRICING_LANGUAGE": 'Extract table with heading "INVOICED SERVICES" if it is present in compensation schedule of the contract.',
|
||
# "LATE_PAID_CLAIMS_IND":"Is Late Paid Claims language present in the contract? Answer with a Yes or No, do not provide any other context.",
|
||
"LATE_PAID_CLAIMS_LANGUAGE": "Extract Late Paid Claims language present in the contract. This will be a sentence or paragraph describing late paid claims, interest payments or similar. Here is an example of a correct response: 'Any Clean Claim, as defined in 42 C.F.R. § 422.500, shall be paid within thirty (30) days of receipt by Plan at such address as may be designated by Plan, and Plan shall pay interest on any Clean Claim not paid within thirty (30) days of such receipt by Plan at the rate of interest required by law, or as otherwise set forth in the Provider Manual.'. Here is an example of an incorrect response: 'Any Clean Claim, as defined in 42 C.F.R. 422.500, shall be paid within thirty (30) days of receipt by Health Plan, Payor or (if Provider contracts with Downstream Entities) Provider, as applicable, as designated by Provider or such Downstream Entity, as applicable.'.",
|
||
# "MEDICAL_NECESSITY_LANGUAGE":"Extract the \"Medically Necessary\" or \"Medical Necessity\" care (or services) verbiage mentioned in the compensation schedule or section of the contract. Do not mention what \"Medically Necessary\" means. If it is not present in compensation schedule or section, answer N/A.",
|
||
# "MEDICAL_NECESSITY_LANGUAGE_IND":"Is \"Medically Necessary\" or \"Medical Necessity\" care (or services) verbiage mentioned in the compensation schedule or section of the contract? Answer with a Yes or No, do not provide any other context.",
|
||
"MEMBER_CONFINEMENT_DAYS_LANGUAGE": "Extract Member Confinement Days Language present in the contract.",
|
||
# "MEMBER_CONFINEMENT_DAYS_LANGUAGE_IND":"Is Member Confinement Days Language present in the contract? Answer with a Yes or No, do not provide any other context.",
|
||
"NATIONAL_AGREEMENT_IND": "Are more than one states covered in the contract? Answer ONLY with Y or N. Do NOT write N/A.",
|
||
# "NETWORK_ACCESS_FEES_IND":"Is \"Network Access Fee\" present in the contract? If yes what is the fee mentioned?",
|
||
"NETWORK_ACCESS_FEES_LANGUAGE": 'Extract "Network Access Fee" verbiage present in the contract.',
|
||
# "NONSTANDARD_APPEALS_PROCESS_IND":"Is Nonstandard Appeals Process present in the contract? Answer with a Yes or No, do not provide any other context.",
|
||
"NONSTANDARD_APPEALS_PROCESS_LANGUAGE": "Extract Nonstandard Appeals Process language present in the contract.",
|
||
"PAYMENT_IN_ADVANCE_OF_CLAIMS_SUBMISSION_LANGUAGE": "Extract Payment in Advance of Claims Submission language present in the contract.",
|
||
# "PAYMENT_IN_ADVANCE_OF_CLAIMS_SUBMISSION_LANGUAGE_IND":"Is Payment in Advance of Claims Submission language present in the contract? Answer with a Yes or No, do not provide any other context.",
|
||
"PAYOR": '"Payor" is usually found in section 1.12 of the contract. Extract the "Payor" subsection present in definition section of the contract.',
|
||
"PMPM": "What is the PMPM rate mentioned in the contract? Only return the rate. Do not provide any context.",
|
||
"PREAUTHORIZATION": "Preauthorization clause may be found in section 2.7 of the contract. Extract the Preauthorization clause present in the contract.",
|
||
"PRODUCT_REMOVAL": "Product removal may be found in the products attachment, stating a product is being removed. Extract product removal language present in the contract.",
|
||
# "PROVIDER_BASED_BILLING_EXCLUSION_IND":"Provider-based Billing Exclusion is often listed under the ‘Additional Provisions’ section. Is Provider-based Billing Exclusion mentioned the contract? Answer with a Yes or No, do not provide any other context.",
|
||
"PROVIDER_BASED_BILLING_EXCLUSION_LANGUAGE": "Provider-based Billing Exclusion is often listed under the ‘Additional Provisions’ section. Extract the Provider-based Billing Exclusion language mentioned in the contract.",
|
||
"RECOVERY_RIGHTS": "Recovery Rights clause may be found in section 3.5 of the contract. Extract the entire Recovery Rights sentence or paragraph present in the contract.",
|
||
# "SINGLE_CODE_MULTIPLE_RATES_IND":"Is Single Code Multiple Rates present in the compensation or exhibit section of the contract? Answer with a Yes or No, do not provide any other context.",
|
||
# "SINGLE_CODE_MULTIPLE_RATES_LANGUAGE":"Extract Single Code Multiple Rates present in the compensation or exhibit section of the contract. If it is not present, answer N/A.",
|
||
"TEMPLATE": "Is this contract in standard Centene template containing definition, terms clauses and other standard sections. Answer with 'Y' or 'N'.",
|
||
"ARBITRATION_AND_DISPUTES": "Dispute Resolution clause is usually found in section 6.1 of the contract. Arbitration clause is usually found in section 6.2 of the contract. Extract both the Dispute Resolution and the arbitration clause present in the contract. In case one of them is present, extract that one.",
|
||
# "DISPARAGEMENT_PROHIBITION_IND":"Is Disparagement Prohibition clause present in the contract? It may be found in section 2.1 of the contract. Answer with a Yes or No, do not provide any other context.",
|
||
"DISPARAGEMENT_PROHIBITION_LANGUAGE": "Disparagement Prohibition clause may be found in section 2.1 of the contract. Extract the Disparagement Prohibition clause present in the contract.",
|
||
"ELIGIBILITY_VERIFICATION": "Eligibility Verification or Determination clause may be found in section 2.6 of the contract. Extract the Eligibility Verification or Determination clause present in the contract.",
|
||
"INSURANCE_REQUIREMENT": "Extract Insurance requirement mentioned in the contract.",
|
||
"PARTICIPATION_IN_PRODUCTS": "Participation in Products clause may be found in section 2.2.2 of the contract. Extract the Participation in Products clause present in the contract.",
|
||
"POLICIES_AND_PROCEDURES": "Extract the entire Policies and Procedures sentence or paragraph present in the contract. Do not extract language about conflicts and construction. Do not extract language about PP (Preferred Provider) nor PPG (Preferred Provider Group).",
|
||
"REGULATORY_REQUIREMENTS": 'Extract the entire Regulatory Requirements paragraph present in the contract. It usually contains the keyword "Regulatory Requirements".',
|
||
# "RELATIONSHIP_OF_PARTIES_IND":"Is Relationship of Parties clause present in the contract? Answer with a Yes or No, do not provide any other context.",
|
||
"RELATIONSHIP_OF_PARTIES_LANGUAGE": "Extract the entire Relationship of Parties passage present in the contract.",
|
||
}
|
||
|
||
|
||
def AC_EFFECTIVE_DATE_CLEANUP(contract_text):
|
||
return f"""### Contract Start ### {contract_text} ### Contract End ###
|
||
Above is a contract. What is the contract effective date mentioned in any of the following locations: the signatory section, the preamble of the agreement, or the start of the amendment? Look for phrases such as /'This amendment is effective/'.
|
||
If there is no clear effective date, return the date from the signature page.
|
||
Return the date converted to YYYY-MM-DD format, with no other commentary or explanation. If there is no date, simply return 'N/A'."""
|