querying multiple fields - added

This commit is contained in:
Mayank Aamseek
2024-03-22 23:59:54 +05:30
parent dc1976e5b2
commit c28978091c
4 changed files with 1412 additions and 1241 deletions
+1000 -1011
View File
File diff suppressed because it is too large Load Diff
+221 -135
View File
@@ -39,19 +39,73 @@ with st.sidebar:
# st.write("Doczy")
try:
util.setup_page(REDIRECT_URI)
# util.setup_page(REDIRECT_URI)
_,c1= st.columns([4,1])
c1.write(f"User: **{st.session_state.user_info['displayName']}**")
user_mail = st.session_state.user_info['mail']
except:
user_mail = 'maamseek@aarete.com'
def file_selector(folder_path=SOURCE_DIRECTORY):
filenames = os.listdir(folder_path)
selected_filename = st.selectbox('Select a file', filenames, label_visibility = "collapsed")
# return os.path.join(folder_path, selected_filename)
return selected_filename
try:
sf_secrets = json.loads(get_secret())
conn = snowflake.connector.connect(
user=sf_secrets.get('user'),
password=sf_secrets.get('password'),
account="aarete-doczyai",
role = "DEVADMIN",
warehouse="DEV_XS",
database="DOCZY_DEV",
schema="STG"
)
cur = conn.cursor()
query = 'select * from "TRAINING_DATA_RAW"'
cur.execute(query)
field_values = pd.DataFrame.from_records(iter(cur), columns=[x[0] for x in cur.description])
# st.write(field_values)
field_values['Document_Name'] = field_values['DOCUMENT_NAME']
# field_values['Contract ID'] = field_values['CONTRACT_TITLE']
# error('table values are incorrect')
except:
field_values = pd.read_csv('contract_field_values.csv', encoding='unicode_escape', skipinitialspace=True)
field_values.rename(columns={'(internal) Document Name': 'Document_Name'}, inplace = True)
# field_values.rename(columns={'(Internal) Carveout ID': 'Contract ID'}, inplace = True)
# st.write("conn failed")
try:
query = 'select * from "PROMPT_CONFIG"'
cur.execute(query)
fields = pd.DataFrame(cur.fetchall())
fields.rename(columns={'FIELD_DESC': 'Field Name'}, inplace = True)
fields.rename(columns={'PROMPT': 'Interrogation Question?'}, inplace = True)
fields.rename(columns={'GROUP_ID': 'PRIORITY'}, inplace = True)
fields.rename(columns={'FIELD_NAME': 'SF_DB_COL_NAME'}, inplace = True)
fields.rename(columns={'FM_MODEL_ID': 'llm_selected'}, inplace = True)
error('table is empty')
except:
fields = pd.read_csv('contract_fields.csv', encoding='unicode_escape', skipinitialspace=True)
fields = fields.drop_duplicates(subset='Field Name', keep="first").sort_values('Field Name')
fields = fields[~fields['Field Name'].isnull()]
s3_client = boto3.client('s3',
region_name="us-east-1"
)
bucket = 'doczy-dev-infra-textract'
objects = s3_client.list_objects_v2(Bucket=bucket, Prefix="training-data/contract-text-file/")
file_list = []
for obj in objects['Contents']:
if not obj['Key'].endswith('/'):
file_list.append(obj['Key'])
contract_list = sorted(file_list)
# to be deleted later
contract_list = [contract for contract in contract_list if contract.rsplit('/',1)[1].replace(' MU','').replace('_MU','').replace('.txt','') in list(field_values['Document_Name'])]
# def file_selector(folder_path=SOURCE_DIRECTORY):
# filenames = os.listdir(folder_path)
# selected_filename = st.selectbox('Select a file', filenames, label_visibility = "collapsed")
# # return os.path.join(folder_path, selected_filename)
# return selected_filename
if user_mail in user_list:
@@ -60,7 +114,7 @@ if user_mail in user_list:
st.write("**Contract Name**")
with file_row[1]:
# file_name = st.text_input("**Contract Name**", label_visibility = "collapsed")
file_name = file_selector()
file_name = st.selectbox('Select a file', contract_list + ['All'], label_visibility = "collapsed")
# lob_row = st.columns([0.2, 0.7, 0.1])
# with lob_row[0]:
@@ -84,10 +138,6 @@ if user_mail in user_list:
with llm_row[1]:
llm_selected = st.selectbox('Langauge Model',('Claude 2', 'Claude Instant', 'Llama 2 Chat 70B'
, 'Titan Text Express'), index=1, label_visibility = "collapsed")
fields = pd.read_csv('contract_fields.csv', encoding='unicode_escape', skipinitialspace=True)
fields = fields.drop_duplicates(subset='Field Name', keep="first").sort_values('Field Name')
fields = fields[~fields['Field Name'].isnull()]
if field_group == 'Unique Key':
fields = fields[fields['PRIORITY'] == 'A']
@@ -128,10 +178,6 @@ if user_mail in user_list:
fields['Interrogation Question?'] = fields['Interrogation Question?'].fillna(' ')
field_prompt_mapping = dict(zip(fields['Field Name'], fields['Interrogation Question?']))
with open(os.path.join(SOURCE_DIRECTORY, file_name), 'r') as infile:
context = infile.read()
# page_count = context.count('Start of Page No. = ')
# Setup bedrock
bedrock_runtime = boto3.client(
service_name="bedrock-runtime",
@@ -169,130 +215,144 @@ if user_mail in user_list:
# question_with_schema = f'{question}{OutputList.schema_json()}'
question_with_schema = question
if llm_selected == "Titan Text Express":
context = context[:16000]
prompt_data = f"""Answer the question based only on the information provided between ## and give step by step guide. You must answer in correct JSON format.
#
{context}
#
Question: {question}
Answer: Answer in JSON format: {{
"""
parameters = {
"maxTokenCount":512,
"stopSequences":[],
"temperature":0,
"topP":0.9
}
body = json.dumps({"inputText": prompt_data, "textGenerationConfig": parameters})
model_id = "amazon.titan-text-express-v1" # change this to use a different version from the model provider
elif llm_selected == 'Llama 2 Chat 70B':
context = context[:7000]
prompt_data = f"""Answer the question based only on the information provided between ## and give step by step guide. You must answer in correct JSON format.
##
{context}
##
Question: {question}
Answer: Answer in JSON format: {{
"""
payload={
"prompt":"[INST]"+ prompt_data +"[/INST]",
"max_gen_len":512,
"temperature":0.0,
"top_p":0.9
}
body=json.dumps(payload)
model_id="meta.llama2-70b-chat-v1"
elif llm_selected in ['Claude Instant', 'Claude 2']:
prompt_data = f"""
Human: Use the following pieces of context to provide a concise answer to the questions at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. You must answer in JSON format.
{context}
Question: {question_with_schema}
Assistant: Answer in JSON format: {{
"""
body = json.dumps(
{"prompt": anthropic.HUMAN_PROMPT + prompt_data + anthropic.AI_PROMPT,
"max_tokens_to_sample": 1024,
"temperature":0.0,
"top_p":1,
"top_k":250,
"stop_sequences":[anthropic.HUMAN_PROMPT]
})
if llm_selected == "Claude 2":
model_id = "anthropic.claude-v2:1"
else:
model_id = "anthropic.claude-instant-v1"
# def claude_prompt_format(prompt: str) -> str:
# # Add headers to start and end of prompt
# return "\n\nHuman: " + prompt + "\n\nAssistant:"
# # Call Claude model
# def call_claude(prompt):
# prompt_config = {
# "prompt": claude_prompt_format(prompt),
# "max_tokens_to_sample": 4096,
# "temperature": 0.5,
# "top_k": 250,
# "top_p": 0.5,
# "stop_sequences": [],
# }
# body = json.dumps(prompt_config)
# modelId = "anthropic.claude-instant-v1"
# accept = "application/json"
# contentType = "application/json"
# response = bedrock_runtime.invoke_model(
# body=body, modelId=modelId, accept=accept, contentType=contentType
# )
# response_body = json.loads(response.get("body").read())
# results = response_body.get("completion")
# return results
# prompt = SECOND_PROMPT
# result = call_claude(prompt)
# st.write(result)
df = pd.DataFrame(columns=['Contract Name','Field Name','Snippet','Page Number',
'Field Extracted Value','Imputed Value'])
# field_list = list(field_prompt_mapping.keys())
# query_list = [field_prompt_mapping[x] for x in field_list]
# st.write(field_prompt_mapping)
# st.write(prompt_data)
if st.button("Show Results"):
response = bedrock_runtime.invoke_model(
body=body,
modelId=model_id,
accept="application/json",
contentType="application/json"
)
response_body = json.loads(response.get("body").read())
def run_llm(bucket, file_name, llm_selected, field_values):
# with open(os.path.join(SOURCE_DIRECTORY, file_name), 'r') as infile:
# context = infile.read()
# # page_count = context.count('Start of Page No. = ')
data = s3_client.get_object(Bucket=bucket, Key=file_name)
contents = data['Body'].read()
context = contents.decode("utf-8")
if llm_selected == "Titan Text Express":
response_text = response_body.get("results")[0].get("outputText")
context = context[:16000]
prompt_data = f"""Answer the question based only on the information provided between ## and give step by step guide. You must answer in correct JSON format.
#
{context}
#
Question: {question}
Answer: Answer in JSON format: {{
"""
parameters = {
"maxTokenCount":1024,
"stopSequences":[],
"temperature":0,
"topP":0.9
}
body = json.dumps({"inputText": prompt_data, "textGenerationConfig": parameters})
model_id = "amazon.titan-text-express-v1" # change this to use a different version from the model provider
elif llm_selected == 'Llama 2 Chat 70B':
response_text = response_body['generation']
context = context[:6000]
prompt_data = f"""Answer the question based only on the information provided between ## and give step by step guide. You must answer in correct JSON format.
##
{context}
##
Question: {question}
Answer: Answer in JSON format: {{
"""
payload={
"prompt":"[INST]"+ prompt_data +"[/INST]",
"max_gen_len":1024,
"temperature":0.0,
"top_p":0.9
}
body=json.dumps(payload)
model_id="meta.llama2-70b-chat-v1"
elif llm_selected in ['Claude Instant', 'Claude 2']:
response_text = response_body['completion']
# st.write(response_text)
if llm_selected == 'Claude Instant':
context = context[:150000]
prompt_data = f"""
Human: Use the following pieces of context to provide a concise answer to the questions at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. You must answer in JSON format.
{context}
Question: {question_with_schema}
Assistant: Answer in JSON format: {{
"""
body = json.dumps(
{"prompt": anthropic.HUMAN_PROMPT + prompt_data + anthropic.AI_PROMPT,
"max_tokens_to_sample": 1024,
"temperature":0.0,
"top_p":1,
"top_k":250,
"stop_sequences":[anthropic.HUMAN_PROMPT]
})
if llm_selected == "Claude 2":
model_id = "anthropic.claude-v2:1"
else:
model_id = "anthropic.claude-instant-v1"
# def claude_prompt_format(prompt: str) -> str:
# # Add headers to start and end of prompt
# return "\n\nHuman: " + prompt + "\n\nAssistant:"
# # Call Claude model
# def call_claude(prompt):
# prompt_config = {
# "prompt": claude_prompt_format(prompt),
# "max_tokens_to_sample": 4096,
# "temperature": 0.5,
# "top_k": 250,
# "top_p": 0.5,
# "stop_sequences": [],
# }
# body = json.dumps(prompt_config)
# modelId = "anthropic.claude-instant-v1"
# accept = "application/json"
# contentType = "application/json"
# response = bedrock_runtime.invoke_model(
# body=body, modelId=modelId, accept=accept, contentType=contentType
# )
# response_body = json.loads(response.get("body").read())
# results = response_body.get("completion")
# return results
# prompt = SECOND_PROMPT
# result = call_claude(prompt)
# st.write(result)
df = pd.DataFrame(columns=['Contract Name','Field Name','Snippet','Page Number',
'Field Extracted Value','Imputed Value'])
# field_list = list(field_prompt_mapping.keys())
# query_list = [field_prompt_mapping[x] for x in field_list]
# st.write(field_prompt_mapping)
# st.write(prompt_data)
try:
response = bedrock_runtime.invoke_model(
body=body,
modelId=model_id,
accept="application/json",
contentType="application/json"
)
response_body = json.loads(response.get("body").read())
if llm_selected == "Titan Text Express":
response_text = response_body.get("results")[0].get("outputText")
elif llm_selected == 'Llama 2 Chat 70B':
response_text = response_body['generation']
elif llm_selected in ['Claude Instant', 'Claude 2']:
response_text = response_body['completion']
except:
response_text = "failed"
raw_response_text = response_text
response_text = response_text.strip()
try:
if response_text.split("{",1)[1].strip()[0] == '"':
response_text = "{" + response_text.split("{",1)[1]
@@ -336,7 +396,30 @@ if user_mail in user_list:
df['Page Number'] = page_no_list
# df['Confidence Level'] = ' '
df['Field Extracted Value'] = answer_list
df.to_csv('temp2.csv', index=False)
df = pd.merge(df, fields[['Field Name', 'SF_DB_COL_NAME']], how ='left', on ='Field Name')
document_name = [x for x in list(field_values['Document_Name']) if not pd.isna(x) and file_name.rsplit('/',1)[1].replace(' MU','').replace(
'_MU','').replace('.txt','') in x][0]
field_values = field_values[field_values['Document_Name'] == document_name].head(1).transpose().reset_index()
field_values.columns = ['SF_DB_COL_NAME', 'Actual Value']
df = pd.merge(df, field_values, how ='left', on ='SF_DB_COL_NAME')
df = df[['Contract Name','Field Name', 'SF_DB_COL_NAME', 'Snippet','Page Number', 'Field Extracted Value', 'Actual Value','Imputed Value']]
return df, raw_response_text
raw_response_text = '{"Test value": "Failed to extract"}'
if st.button("Show Results"):
if file_name == 'All':
df_1 = pd.DataFrame(columns=['Contract Name','Field Name', 'SF_DB_COL_NAME', 'Snippet','Page Number'
, 'Field Extracted Value', 'Actual Value','Imputed Value'])
for contract in contract_list:
print(contract)
df, raw_response_text = run_llm(bucket, contract, llm_selected, field_values)
df_1 = pd.concat([df_1, df], ignore_index = True)
else:
df_1, raw_response_text = run_llm(bucket, file_name, llm_selected, field_values)
df_1.to_csv('temp2.csv', index=False)
df2 = pd.read_csv('temp2.csv')
df2['Imputed Value'] = ''
@@ -356,6 +439,9 @@ if user_mail in user_list:
with buttons[2]:
st.button("Kickoff Database Integration")
add_vertical_space(20)
st.write(raw_response_text)
else:
st.write("Access Denied")
+176 -95
View File
@@ -79,11 +79,11 @@ try:
query = 'select * from "PROMPT_CONFIG"'
cur.execute(query)
fields = pd.DataFrame(cur.fetchall())
field_values.rename(columns={'FIELD_DESC': 'Field Name'}, inplace = True)
field_values.rename(columns={'PROMPT': 'Interrogation Question?'}, inplace = True)
field_values.rename(columns={'GROUP_ID': 'PRIORITY'}, inplace = True)
field_values.rename(columns={'FIELD_NAME': 'SF_DB_COL_NAME'}, inplace = True)
field_values.rename(columns={'FM_MODEL_ID': 'llm_selected'}, inplace = True)
fields.rename(columns={'FIELD_DESC': 'Field Name'}, inplace = True)
fields.rename(columns={'PROMPT': 'Interrogation Question?'}, inplace = True)
fields.rename(columns={'GROUP_ID': 'PRIORITY'}, inplace = True)
fields.rename(columns={'FIELD_NAME': 'SF_DB_COL_NAME'}, inplace = True)
fields.rename(columns={'FM_MODEL_ID': 'llm_selected'}, inplace = True)
error('table is empty')
except:
fields = pd.read_csv('contract_fields.csv', encoding='unicode_escape', skipinitialspace=True)
@@ -144,11 +144,21 @@ if user_mail in user_list:
fields['Interrogation Question?'] = fields['Interrogation Question?'].fillna(' ')
field_prompt_mapping = dict(zip(fields['Field Name'], fields['Interrogation Question?']))
mode_row = st.columns([0.15, 0.45, 0.4])
with mode_row[0]:
st.write("**Mode**")
with mode_row[1]:
mode = st.selectbox('Mode',('Single field', 'Single field - Only Non Empty values', 'Multiple fields'), index=0, label_visibility = "collapsed")
field_row = st.columns([0.15, 0.45, 0.4])
with field_row[0]:
st.write("**Field Name**")
if mode != 'Multiple fields':
st.write("**Field Name**")
with field_row[1]:
field = st.selectbox('Field Name',sorted(set(field_prompt_mapping.keys())), index=0, label_visibility = "collapsed")
if mode != 'Multiple fields':
field = st.selectbox('Field Name',sorted(set(field_prompt_mapping.keys())), index=0, label_visibility = "collapsed")
else:
field = sorted(set(field_prompt_mapping.keys()))
contract_count_row = st.columns([0.15, 0.45, 0.4])
with contract_count_row[0]:
@@ -156,8 +166,6 @@ if user_mail in user_list:
with contract_count_row[1]:
contract_count = st.selectbox('Contract count',('1', '10', '20', '30', '50', '100', '200', 'All'), index=1, label_visibility = "collapsed")
seed_row = st.columns([0.15, 0.45, 0.4])
s3_client = boto3.client('s3',
region_name="us-east-1"
)
@@ -173,10 +181,15 @@ if user_mail in user_list:
contract_list = sorted(file_list)
# contract_list = sorted(os.listdir(SOURCE_DIRECTORY))
if mode == 'Single field - Only Non Empty values':
column_name = fields.loc[fields['Field Name'] == field, 'SF_DB_COL_NAME'].iloc[0]
field_values = field_values[~field_values[column_name].isnull()]
# to be deleted later
contract_list = [contract for contract in contract_list if contract.rsplit('/',1)[1].replace(' MU','').replace('_MU','').replace('.txt','') in list(field_values['Document_Name'])]
if contract_count == 'All':
contract_count = len(contract_list)
seed_row = st.columns([0.15, 0.45, 0.4])
with seed_row[0]:
if contract_count in ['10', '20', '30', '50', '100', '200']:
st.write("**Seed Value**")
@@ -187,7 +200,7 @@ if user_mail in user_list:
seed_value = st.text_input("**Seed Value**", value = 20, label_visibility = "collapsed")
random.seed(seed_value)
# contract_list = sorted(random.choices(os.listdir(SOURCE_DIRECTORY), k=int(contract_count)))
contract_list = sorted(random.choices(file_list, k=int(contract_count)))
contract_list = sorted(random.choices(contract_list, k=int(contract_count)))
elif contract_count == '1':
contract_name = st.selectbox('Contract Name', (contract_list), label_visibility = "collapsed")
contract_list = [contract_name]
@@ -201,7 +214,10 @@ if user_mail in user_list:
, 'Titan Text Express'), index=1, label_visibility = "collapsed")
st.write("**Prompt**")
sequence_input = field_prompt_mapping.get(field)
if mode == 'Multiple fields':
sequence_input = json.dumps(field_prompt_mapping)
else:
sequence_input = field_prompt_mapping.get(field)
prompt_row = st.columns([0.8, 0.2])
with prompt_row[1]:
if st.button("Clear Prompt"):
@@ -213,14 +229,15 @@ if user_mail in user_list:
prompt = st.text_area("**Prompt**", sequence_input, height = 150, label_visibility = "collapsed")
column_name = fields.loc[fields['Field Name'] == field, 'SF_DB_COL_NAME'].iloc[0]
column_list = ['Document_Name', column_name]
# column_list = ['Document_Name', 'Contract ID', column_name]
if column_name+'_PG' in list(field_values.columns):
column_list.append(column_name+'_PG')
field_values = field_values[column_list]
field_values.rename(columns={'Document_Name': 'Contract Name', column_name: 'Actual Value Stored'
, column_name+'_PG': 'Original Page Number'}, inplace=True)
# column_name = fields.loc[fields['Field Name'] == field, 'SF_DB_COL_NAME'].iloc[0]
# column_list = ['Document_Name', column_name]
# # column_list = ['Document_Name', 'Contract ID', column_name]
# if column_name+'_PG' in list(field_values.columns):
# column_list.append(column_name+'_PG')
# # field_values = field_values[column_list]
# # field_values.rename(columns={'Document_Name': 'Contract Name', column_name: 'Actual Value Stored'
# # , column_name+'_PG': 'Original Page Number'}, inplace=True)
field_values.rename(columns={'Document_Name': 'Contract Name'}, inplace=True)
field_values = field_values.drop_duplicates(subset='Contract Name', keep="first").sort_values('Contract Name')
# Setup bedrock
@@ -229,26 +246,26 @@ if user_mail in user_list:
region_name="us-east-1",
)
# df = pd.DataFrame(columns=['Contract Name','Contract ID','Actual Value Stored','New Extracted value','Confidence Level','Snippet',
# 'Original Page Number', 'New Page Number', 'Revised Prompt', 'Result'])
df = pd.DataFrame(columns=['Contract Name','Raw value','New Extracted value','Confidence Level','Snippet','New Page Number'
, 'Revised Prompt', 'Result'])
try:
history = pd.read_csv('history.csv')
except:
history = pd.DataFrame(columns=['Field Name','# Contracts Tested', 'Username', 'Date/Time', 'Accuracy', 'Attempt #'])
question = prompt
question_with_schema = question
attempt = 0
def run_llm(attempt, bucket, contract_list, llm_selected, field_values):
if st.button("Test Configuration"):
# df = pd.DataFrame(columns=['Contract Name','Contract ID','Actual Value Stored','New Extracted value','Confidence Level','Snippet',
# 'Original Page Number', 'New Page Number', 'Revised Prompt', 'Result'])
df = pd.DataFrame(columns=['Contract Name' ,'New Extracted value','Confidence Level','Snippet','New Page Number'
, 'Revised Prompt', 'Result'])
try:
history = pd.read_csv('history.csv')
except:
history = pd.DataFrame(columns=['Field Name','# Contracts Tested', 'Username', 'Date/Time', 'Accuracy', 'Attempt #'])
field_list = []
answer_list = []
snippet_list = []
page_no_list = []
contract_list_f = []
attempt = attempt + 1
for contract in contract_list:
@@ -262,15 +279,15 @@ if user_mail in user_list:
# Add Answer in JSON format: {{
if llm_selected == "Titan Text Express":
context = context[:16000]
prompt_data = f"""Answer the question based only on the information provided between ## and give step by step guide.
prompt_data = f"""Answer the question based only on the information provided between ## and give step by step guide. You must answer in correct JSON format.
#
{context}
#
Question: {question}
Answer:"""
Answer: Answer in JSON format: {{"""
parameters = {
"maxTokenCount":512,
"maxTokenCount":1024,
"stopSequences":[],
"temperature":0,
"topP":0.9
@@ -281,16 +298,16 @@ if user_mail in user_list:
elif llm_selected == 'Llama 2 Chat 70B':
context = context[:6000]
prompt_data = f"""Answer the question based only on the information provided between ## and give step by step guide.
prompt_data = f"""Answer the question based only on the information provided between ## and give step by step guide. You must answer in correct JSON format.
##
{context}
##
Question: {question}
Answer:"""
Answer: Answer in JSON format: {{"""
payload={
"prompt":"[INST]"+ prompt_data +"[/INST]",
"max_gen_len":512,
"max_gen_len":1024,
"temperature":0.0,
"top_p":0.9
}
@@ -299,20 +316,20 @@ if user_mail in user_list:
elif llm_selected in ['Claude Instant', 'Claude 2']:
if llm_selected == 'Claude Instant':
context = context[:150000]
context = context[:175000]
prompt_data = f"""
Human: Use the following pieces of context to provide a concise answer to the questions at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.
Human: Use the following pieces of context to provide a concise answer to the questions at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. You must answer in correct JSON format.
{context}
Question: {question_with_schema}
Assistant:"""
Assistant: Answer in JSON format: {{"""
body = json.dumps(
{"prompt": anthropic.HUMAN_PROMPT + prompt_data + anthropic.AI_PROMPT,
"max_tokens_to_sample": 100,
"max_tokens_to_sample": 1024,
"temperature":0.0,
"top_p":1,
"top_k":250,
@@ -338,84 +355,137 @@ if user_mail in user_list:
response_text = response_body['generation']
elif llm_selected in ['Claude Instant', 'Claude 2']:
response_text = response_body['completion']
except:
response_text = "failed"
# st.write(response_text)
raw_response_text = response_text
response_text = response_text.strip()
try:
if response_text.split("{",1)[1].strip()[0] == '"':
response_text = "{" + response_text.split("{",1)[1]
else:
response_text = "{" + response_text
except:
response_text = "{" + response_text
if len(response_text.split("}",1)) > 1:
if response_text.rsplit("}",1)[0].strip()[-1] == '"':
response_text = response_text.rsplit("}",1)[0] + "}"
else:
response_text = response_text.rstrip(",")
response_text = response_text + "}"
try:
response_text = "{" + response_text.split("{",1)[1]
response_text = response_text.split("}",1)[0] + "}"
response_dict = json.loads(response_text)
except:
response_dict = {field:response_text}
if mode == 'Multiple fields':
response_dict = {"Test field": "Failed to extract"}
else:
response_dict = {field:response_text.strip("{").strip("}")}
answer = response_dict.get(field, " ")
answer_list.append(answer)
location = context.find(answer) if isinstance(answer, str) and answer != "" else -1
snippet = ' '.join(context[:location].split()[-25:]) + ' ' + ' '.join(context[location:].split()[:30]) if location != -1 else ' '
page_no = " " if location == -1 else context[:location].rsplit("Start of Page No. = ", 1)[1] if len(context[:location].rsplit(
"Start of Page No. = ", 1)) > 1 else context[:location].rsplit("Start of Page No. = ", 1)[0]
page_no = re.search(r'\d+', page_no).group() if page_no != " " and re.search(r'\d+', page_no) is not None else ""
snippet_list.append(snippet)
page_no_list.append(page_no)
df['Raw value'] = answer_list
# post-processing
if 'Date' in field:
date_list = []
for answer in answer_list:
if mode == 'Multiple fields':
field_l = list(response_dict.keys())
answer_l = list(response_dict.values())
else:
field_l = [field]
# answer = response_dict.get(field, " ")
try:
extracted_date = dateutil.parser.parse(str(answer).replace('"',''), fuzzy=True).date()
if isinstance(response_dict, dict):
answer_l = list(response_dict.values())[:1]
else:
answer_l = list(response_dict)[:1]
except:
extracted_date = " "
date_list.append(extracted_date)
answer_list = date_list
elif llm_selected in ['Llama 2 Chat 13B', 'Llama 2 Chat 70B']:
answer_list = [answer.rstrip(".") for answer in answer_list]
answer_list = [answer if "I don't know" not in str(answer) else " " for answer in answer_list]
answer_list = [answer if "N/A" not in str(answer) else " " for answer in answer_list]
answer_list = [answer if "does not contain" not in str(answer) else " " for answer in answer_list]
answer_list = [answer if "None" not in str(answer) else " " for answer in answer_list]
answer_list = [answer if "Not specified in the contract" not in str(answer) else " " for answer in answer_list]
answer_list = [answer if "Not applicable" not in str(answer) else " " for answer in answer_list]
elif llm_selected in ['Claude 2', 'Claude Instant']:
answer_list = [answer if "do not have" not in str(answer) else " " for answer in answer_list]
answer_list = [answer if "does not specify" not in str(answer) else " " for answer in answer_list]
answer_list = [answer if "does not explicitly" not in str(answer) else " " for answer in answer_list]
answer_list = [answer.rstrip(".") for answer in answer_list]
else:
answer_list = [answer.rstrip(".") for answer in answer_list]
# answer_list = [str(x).rsplit(':',1)[0] if len(str(x).rsplit(':',1)) < 2 else str(x).rsplit(':',1)[1] for x in answer_list]
answer_l = [response_dict]
field_list.extend(field_l)
answer_list.extend(answer_l)
contract_list_f.extend([contract]*len(field_l))
# location = context.find(answer) if isinstance(answer, str) and answer != "" else -1
# snippet = ' '.join(context[:location].split()[-25:]) + ' ' + ' '.join(context[location:].split()[:30]) if location != -1 else ' '
# page_no = " " if location == -1 else context[:location].rsplit("Start of Page No. = ", 1)[1] if len(context[:location].rsplit(
# "Start of Page No. = ", 1)) > 1 else context[:location].rsplit("Start of Page No. = ", 1)[0]
# page_no = re.search(r'\d+', page_no).group() if page_no != " " and re.search(r'\d+', page_no) is not None else ""
location_l = [context.find(answer) if isinstance(answer, str) and answer != "" else -1 for answer in answer_l]
snippet_l = [' '.join(context[:location].split('.')[-4:]) + ' ' + ' '.join(context[location:].split('. ')[:5]
) if location != -1 else ' ' for location in location_l]
page_no_l = [" " if location == -1 else context[:location].rsplit("Start of Page No. = ", 1)[1] if len(context[:location].rsplit(
"Start of Page No. = ", 1)) > 1 else context[:location].rsplit("Start of Page No. = ", 1)[0] for location in location_l]
# st.write(location_list)
page_no_l = [re.search(r'\d+', page).group() if page != " " and re.search(r'\d+', page) is not None else "" for page in page_no_l]
snippet_list.extend(snippet_l)
page_no_list.extend(page_no_l)
df['Field Name'] = field_list
# df['Raw value'] = answer_list
# post-processing
# if 'Date' in field:
# date_list = []
# for answer in answer_list:
# try:
# extracted_date = dateutil.parser.parse(str(answer).replace('"',''), fuzzy=True).date()
# except:
# extracted_date = " "
# date_list.append(extracted_date)
# answer_list = date_list
try:
answer_list = [answer.strip("\n").strip().strip("{").strip("}").strip('"').rstrip('"') for answer in answer_list]
if llm_selected in ['Llama 2 Chat 13B', 'Llama 2 Chat 70B']:
answer_list = [answer.rstrip(".") for answer in answer_list]
answer_list = [answer if "I don't know" not in str(answer) else " " for answer in answer_list]
answer_list = [answer if "N/A" not in str(answer) else " " for answer in answer_list]
answer_list = [answer if "does not contain" not in str(answer) else " " for answer in answer_list]
answer_list = [answer if "None" not in str(answer) else " " for answer in answer_list]
answer_list = [answer if "Not specified in the contract" not in str(answer) else " " for answer in answer_list]
answer_list = [answer if "Not applicable" not in str(answer) else " " for answer in answer_list]
elif llm_selected in ['Claude 2', 'Claude Instant']:
answer_list = [answer if "do not have" not in str(answer) else " " for answer in answer_list]
answer_list = [answer if "does not specify" not in str(answer) else " " for answer in answer_list]
answer_list = [answer if "does not explicitly" not in str(answer) else " " for answer in answer_list]
answer_list = [answer.rstrip(".") for answer in answer_list]
else:
answer_list = [answer.rstrip(".") for answer in answer_list]
# answer_list = [str(x).rsplit(':',1)[0] if len(str(x).rsplit(':',1)) < 2 else str(x).rsplit(':',1)[1] for x in answer_list]
except:
print('post processing failed')
df['Contract ID'] = contract_list
df['Contract ID'] = contract_list_f
# to be deleted later
contract_list = [contract.rsplit('/',1)[1].replace(' MU','').replace('_MU','').replace('.txt','') for contract in contract_list]
contract_list_f = [contract.rsplit('/',1)[1].replace(' MU','').replace('_MU','').replace('.txt','') for contract in contract_list_f]
df['Contract Name'] = contract_list
df['Contract Name'] = contract_list_f
df['New Extracted value'] = answer_list
df['Confidence Level'] = ' '
df['Snippet'] = snippet_list
df['New Page Number'] = page_no_list
df['Revised Prompt'] = [prompt] * len(contract_list)
df['Revised Prompt'] = [prompt] * len(contract_list_f)
df = pd.merge(df, field_values, how ='left', on ='Contract Name')
df = pd.merge(df, fields[['Field Name', 'SF_DB_COL_NAME']], how ='left', on ='Field Name')
field_values_2 = pd.DataFrame(columns=['Contract Name', 'SF_DB_COL_NAME', 'Actual Value Stored'])
for file_name in contract_list:
document_name = [x for x in list(field_values['Contract Name']) if not pd.isna(x) and file_name.rsplit('/',1)[1].replace(' MU','').replace(
'_MU','').replace('.txt','') in x][0]
field_values_1 = field_values[field_values['Contract Name'] == document_name].head(1).transpose().reset_index()
field_values_1.columns = ['SF_DB_COL_NAME', 'Actual Value Stored']
field_values_1['Contract Name'] = document_name
field_values_2 = pd.concat([field_values_2, field_values_1], ignore_index = True)
df = pd.merge(df, field_values_2, how ='left', on =['Contract Name', 'SF_DB_COL_NAME'])
answer_list = list(df['New Extracted value'])
if 'Date' in field:
df['Actual Value Stored'] = pd.to_datetime(df['Actual Value Stored'],errors='coerce').dt.date
# if 'Date' in field:
# df['Actual Value Stored'] = pd.to_datetime(df['Actual Value Stored'],errors='coerce').dt.date
df.fillna(" ", inplace=True)
actual_value_list = list(df['Actual Value Stored'])
result_list = [i==j for i, j in zip(actual_value_list, answer_list)]
df['Result'] = [str(x) for x in result_list]
df = df[~df['Contract ID'].isnull()]
if 'Original Page Number' in df.columns:
df = df[['Contract Name','Contract ID','Actual Value Stored','Raw value','New Extracted value','Confidence Level'
,'Snippet','Original Page Number', 'New Page Number', 'Revised Prompt', 'Result']]
else:
df = df[['Contract Name','Contract ID','Actual Value Stored','Raw value','New Extracted value','Confidence Level'
,'Snippet', 'New Page Number', 'Revised Prompt', 'Result']]
if 'Original Page Number' not in df.columns:
df['Original Page Number'] = ' '
df = df[['Contract Name','Contract ID', 'Field Name', 'SF_DB_COL_NAME', 'Actual Value Stored','New Extracted value','Confidence Level'
,'Snippet','Original Page Number', 'New Page Number', 'Revised Prompt', 'Result']]
try:
accuracy = round(sum(bool(x) for x in result_list) * 100 / len(list(df['Result'])), 2)
@@ -424,14 +494,23 @@ if user_mail in user_list:
history.loc[len(history.index)] = [field, str(contract_count), None, datetime.now().strftime("%Y-%m-%d %H:%M:%S"), accuracy, attempt]
# df.to_csv("RESULTS\\"+field.replace("?","").replace("/","_")+'-'+llm_selected+'.csv', index=False)
return df, history, attempt, raw_response_text
raw_response_text = ''
if st.button("Test Configuration"):
df, history, attempt, raw_response_text = run_llm(attempt, bucket, contract_list, llm_selected, field_values)
df.to_csv('results.csv', index=False)
history.to_csv('history.csv', index=False)
# df_copy = df.set_index(df.columns[0]).copy()
# df_2_copy = history.set_index(history.columns[0]).copy()
df = pd.read_csv('results.csv')
df['Result'] = df['Result'].astype('str')
history = pd.read_csv('history.csv')
st.dataframe(df)
st.dataframe(history)
# @st.cache_data
# def convert_df(df):
# return df.to_csv(index=False).encode('utf-8')
@@ -446,9 +525,11 @@ if user_mail in user_list:
# with buttons[2]:
# st.button("Kickoff Database Integration")
st.write(column_name)
add_vertical_space(20)
st.write(field)
# st.write(column_name)
st.write(len(contract_list))
st.write(raw_response_text)
else:
st.write("Access Denied")
+15
View File
@@ -0,0 +1,15 @@
Contract Name,Contract ID,Field Name,SF_DB_COL_NAME,Actual Value Stored,New Extracted value,Confidence Level,Snippet,Original Page Number,New Page Number,Revised Prompt,Result
Boilerplate_AMEND - BAYLOR MEDCARE - 74-1613878 - 46-2714379,training-data/contract-text-file/0. Professional Boilerplate/Boilerplate_AMEND - BAYLOR MEDCARE - 74-1613878 - 46-2714379 MU.txt,Associated Provider Full Names,PROV_DOING_BUSINESS_AS,"See ""MOHTX26BaylorProvRoster"" tab","['Baylor Medcare (Orthopedic Surgery)', 'BMC Physicians of San Antonio']", , , ,,"What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names.",False
ICMProviderAgreement_AvenueMedicalAssociatesPA_212330_5,training-data/contract-text-file/0. Professional Boilerplate/ICMProviderAgreement_AvenueMedicalAssociatesPA_212330_5.txt,Associated Provider Full Names,PROV_DOING_BUSINESS_AS,Avenue Medical Associates PA,I do not see any other provider names listed in the agreement. The agreement is between Granite State Health Inc. d/b/a Delaware First Health and Avenue Medical Associates PA., , , ,,"What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names.",False
"Molina Healthcare of Texas, Inc. Amendment 4 - HIX ACA__EFF 01012016","training-data/contract-text-file/0. Professional Boilerplate/Molina Healthcare of Texas, Inc. Amendment 4 - HIX ACA__EFF 01012016_MU.txt",Associated Provider Full Names,PROV_DOING_BUSINESS_AS,Dallas County Hospital District dba Parkland Health & Hospital System,"I do not see any other provider names or TINs listed in the context provided.
", , , ,,"What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names.",False
Custom_PSA - Advanced Gastroenterology of Texas PLLC -Executed 47-4543923,training-data/contract-text-file/1. Professional Custom/Custom_PSA - Advanced Gastroenterology of Texas PLLC -Executed 47-4543923 MU.txt,Associated Provider Full Names,PROV_DOING_BUSINESS_AS,Advanced Gastroenterology of Texas PLC,"I do not see any other provider names listed in the agreement. The agreement is between Molina Healthcare of Texas, Inc. and Advanced Gastroenterology of Texas PLLC.", , , ,,"What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names.",False
Laboratory Corporation of America Holdings_2023.06.16.Fifth Amendment_OH MCD Comp Chg and TINs add,training-data/contract-text-file/3. Ancillary Custom/Laboratory Corporation of America Holdings_2023.06.16.Fifth Amendment_OH MCD Comp Chg and TINs add_MU.txt,Associated Provider Full Names,PROV_DOING_BUSINESS_AS,"See ""CSNP11 - Lab Corp Provider Roster""","['Laboratory Corporation of America Holdings', 'Laboratory Corporation of America', 'Dianon Systems, Inc.', 'Esoterix Genetic Laboratories, LLC', 'Esoterix Genetic Counseling, LLC', 'Accupath Diagnostic Laboratories, Inc.', 'Esoterix, Inc.', 'National Genetics Institute', 'Monogram Biosciences, Inc.', 'Litholink Corporation', 'MedTox Laboratories, Inc.', 'Sequenom Center for Molecular Medicine, LLC', 'Center for Disease Detection, LLC', 'LabCorp Indiana, Inc.']", , , ,,"What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names.",False
2021-07-15 COMM Agmt FE - Samaritan Health Services,training-data/contract-text-file/5. Multiple Custom/2021-07-15 COMM Agmt FE - Samaritan Health Services MU.txt,Associated Provider Full Names,PROV_DOING_BUSINESS_AS,"See ""ModaSamaritanCareveouts"" tab","""Samaritan Lebanon Community Hospital"",""93-0396847""},{""Samaritan North Lincoln Hospital"",""93-1305493""},{""Samaritan Pacific Communities Hospital"",""93-1329784""},{""Albany General Hospital"",""93-0110095""},{""Samaritan Medical Supplies"",""46-5619962""},{""Samaritan Endoscopy Center LLC"",""202860067""},{""Good Samaritan Home Health"",""930391573""},{""Good Samaritan Home Infusion Services"",""930391573""},{""Samaritan Evergreen Hospice, Albany, Corvallis"",""930110095""},{""North Lincoln Home Health"",""931305493""},{""Pacific Communities Home Health"",""931329784""},{""Corvallis MRI"",""93-0949704""},{""East Linn MRI"",""320229399""", , , ,,"What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names.",False
2021-07-15 COMM Agmt FE - Samaritan Health Services,training-data/contract-text-file/5. Multiple Custom/2021-07-15 COMM Agmt FE - Samaritan Health Services MU.txt,Associated Provider Full Names,PROV_DOING_BUSINESS_AS,"See ""ModaSamaritanCareveouts"" tab","""Samaritan Lebanon Community Hospital"",""93-0396847""},{""Samaritan North Lincoln Hospital"",""93-1305493""},{""Samaritan Pacific Communities Hospital"",""93-1329784""},{""Albany General Hospital"",""93-0110095""},{""Samaritan Medical Supplies"",""46-5619962""},{""Samaritan Endoscopy Center LLC"",""202860067""},{""Good Samaritan Home Health"",""930391573""},{""Good Samaritan Home Infusion Services"",""930391573""},{""Samaritan Evergreen Hospice, Albany, Corvallis"",""930110095""},{""North Lincoln Home Health"",""931305493""},{""Pacific Communities Home Health"",""931329784""},{""Corvallis MRI"",""93-0949704""},{""East Linn MRI"",""320229399""", , , ,,"What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names.",False
2021-07-15 COMM Agmt FE - Samaritan Health Services,training-data/contract-text-file/5. Multiple Custom/2021-07-15 COMM Agmt FE - Samaritan Health Services MU.txt,Associated Provider Full Names,PROV_DOING_BUSINESS_AS,"See ""ModaSamaritanCareveouts"" tab","""Samaritan Lebanon Community Hospital"",""93-0396847""},{""Samaritan North Lincoln Hospital"",""93-1305493""},{""Samaritan Pacific Communities Hospital"",""93-1329784""},{""Albany General Hospital"",""93-0110095""},{""Samaritan Medical Supplies"",""46-5619962""},{""Samaritan Endoscopy Center LLC"",""202860067""},{""Good Samaritan Home Health"",""930391573""},{""Good Samaritan Home Infusion Services"",""930391573""},{""Samaritan Evergreen Hospice, Albany, Corvallis"",""930110095""},{""North Lincoln Home Health"",""931305493""},{""Pacific Communities Home Health"",""931329784""},{""Corvallis MRI"",""93-0949704""},{""East Linn MRI"",""320229399""", , , ,,"What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names.",False
2021-07-15 COMM Agmt FE - Samaritan Health Services,training-data/contract-text-file/5. Multiple Custom/2021-07-15 COMM Agmt FE - Samaritan Health Services MU.txt,Associated Provider Full Names,PROV_DOING_BUSINESS_AS,"See ""ModaSamaritanCareveouts"" tab","""Samaritan Lebanon Community Hospital"",""93-0396847""},{""Samaritan North Lincoln Hospital"",""93-1305493""},{""Samaritan Pacific Communities Hospital"",""93-1329784""},{""Albany General Hospital"",""93-0110095""},{""Samaritan Medical Supplies"",""46-5619962""},{""Samaritan Endoscopy Center LLC"",""202860067""},{""Good Samaritan Home Health"",""930391573""},{""Good Samaritan Home Infusion Services"",""930391573""},{""Samaritan Evergreen Hospice, Albany, Corvallis"",""930110095""},{""North Lincoln Home Health"",""931305493""},{""Pacific Communities Home Health"",""931329784""},{""Corvallis MRI"",""93-0949704""},{""East Linn MRI"",""320229399""", , , ,,"What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names.",False
"Custom_Parkview Health Systems-OH MP, IN MP-ID C15656222AA","training-data/contract-text-file/CareSource -Professional/Custom_Parkview Health Systems-OH MP, IN MP-ID C15656222AA MU.txt",Associated Provider Full Names,PROV_DOING_BUSINESS_AS,Midwest Community Health Associates,"['Midwest Community Health Associates', 'Parkview Physicians Group']", , , ,,"What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names.",False
Custom_TriHealth_Group Practice_Sixth Amendment_20140101,training-data/contract-text-file/CareSource -Professional/Custom_TriHealth_Group Practice_Sixth Amendment_20140101 MU.txt,Associated Provider Full Names,PROV_DOING_BUSINESS_AS,"TriHealth OS, LLC","['Dirk Pruis', 'David Taylor', 'Lisa Vickers', 'Joseph Thomas', 'Paul Gangl', 'Arnold Penix', 'Emily Dixon', 'David Doyle', 'Monty Backus', 'Connie Chiu', 'Susan Segerman', 'Julie Novotny', 'Dianne Otten', 'Carmen Palascak', 'Richard Okragly', 'Walter Zancan', 'Kevin Reilly', 'Joel Sorger', 'Mark Snyder', 'Christopher Ruhnke', 'James Leonard', 'Robert Raines', 'Kristi White', 'Jessica Spears', 'Tina Mckinney', 'Erin Voss', 'Kyle Danemayer', 'Jeffery Riesenbeck', 'Mary Lutz', 'Steven Wurzelbacher', 'Steven Kinzer', 'Shaun White', 'Nicole Overbeck-Lynch', 'Sean Lynch', 'Mary Pfiester', 'Keene Bryant', 'Todd Heidrick', 'John McDonough', 'Thomas Kiefhaber', 'Daniel Reilly', 'Andrew Markiewitz', 'Paul Fassler', 'Andrew Cross', 'Benjamin Kleinhenz', 'Peter Stern', 'T. Gregory Sommerkamp', 'Paul Fassier', 'Brian Crellin']", , , ,,"What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names.",False
Anc2_060117 Barnet Dulaney Perkins Eye Cntr Care1st Anc - 562589722,training-data/contract-text-file/Centene/CNC AZ - Ancillary/Anc2_060117 Barnet Dulaney Perkins Eye Cntr Care1st Anc - 562589722 MU.txt,Associated Provider Full Names,PROV_DOING_BUSINESS_AS,"Barnet Dulaney Surgery Centers, LLC","['Barnet Dulaney Perkins Eye Center, PLLC', 'Barnet Dulaney Surgery Centers, LLC']", , , ,,"What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names.",False
1 Contract Name Contract ID Field Name SF_DB_COL_NAME Actual Value Stored New Extracted value Confidence Level Snippet Original Page Number New Page Number Revised Prompt Result
2 Boilerplate_AMEND - BAYLOR MEDCARE - 74-1613878 - 46-2714379 training-data/contract-text-file/0. Professional Boilerplate/Boilerplate_AMEND - BAYLOR MEDCARE - 74-1613878 - 46-2714379 MU.txt Associated Provider Full Names PROV_DOING_BUSINESS_AS See "MOHTX26BaylorProvRoster" tab ['Baylor Medcare (Orthopedic Surgery)', 'BMC Physicians of San Antonio'] What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names. False
3 ICMProviderAgreement_AvenueMedicalAssociatesPA_212330_5 training-data/contract-text-file/0. Professional Boilerplate/ICMProviderAgreement_AvenueMedicalAssociatesPA_212330_5.txt Associated Provider Full Names PROV_DOING_BUSINESS_AS Avenue Medical Associates PA I do not see any other provider names listed in the agreement. The agreement is between Granite State Health Inc. d/b/a Delaware First Health and Avenue Medical Associates PA. What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names. False
4 Molina Healthcare of Texas, Inc. Amendment 4 - HIX ACA__EFF 01012016 training-data/contract-text-file/0. Professional Boilerplate/Molina Healthcare of Texas, Inc. Amendment 4 - HIX ACA__EFF 01012016_MU.txt Associated Provider Full Names PROV_DOING_BUSINESS_AS Dallas County Hospital District dba Parkland Health & Hospital System I do not see any other provider names or TINs listed in the context provided. What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names. False
5 Custom_PSA - Advanced Gastroenterology of Texas PLLC -Executed 47-4543923 training-data/contract-text-file/1. Professional Custom/Custom_PSA - Advanced Gastroenterology of Texas PLLC -Executed 47-4543923 MU.txt Associated Provider Full Names PROV_DOING_BUSINESS_AS Advanced Gastroenterology of Texas PLC I do not see any other provider names listed in the agreement. The agreement is between Molina Healthcare of Texas, Inc. and Advanced Gastroenterology of Texas PLLC. What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names. False
6 Laboratory Corporation of America Holdings_2023.06.16.Fifth Amendment_OH MCD Comp Chg and TINs add training-data/contract-text-file/3. Ancillary Custom/Laboratory Corporation of America Holdings_2023.06.16.Fifth Amendment_OH MCD Comp Chg and TINs add_MU.txt Associated Provider Full Names PROV_DOING_BUSINESS_AS See "CSNP11 - Lab Corp Provider Roster" ['Laboratory Corporation of America Holdings', 'Laboratory Corporation of America', 'Dianon Systems, Inc.', 'Esoterix Genetic Laboratories, LLC', 'Esoterix Genetic Counseling, LLC', 'Accupath Diagnostic Laboratories, Inc.', 'Esoterix, Inc.', 'National Genetics Institute', 'Monogram Biosciences, Inc.', 'Litholink Corporation', 'MedTox Laboratories, Inc.', 'Sequenom Center for Molecular Medicine, LLC', 'Center for Disease Detection, LLC', 'LabCorp Indiana, Inc.'] What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names. False
7 2021-07-15 COMM Agmt FE - Samaritan Health Services training-data/contract-text-file/5. Multiple Custom/2021-07-15 COMM Agmt FE - Samaritan Health Services MU.txt Associated Provider Full Names PROV_DOING_BUSINESS_AS See "ModaSamaritanCareveouts" tab "Samaritan Lebanon Community Hospital","93-0396847"},{"Samaritan North Lincoln Hospital","93-1305493"},{"Samaritan Pacific Communities Hospital","93-1329784"},{"Albany General Hospital","93-0110095"},{"Samaritan Medical Supplies","46-5619962"},{"Samaritan Endoscopy Center LLC","202860067"},{"Good Samaritan Home Health","930391573"},{"Good Samaritan Home Infusion Services","930391573"},{"Samaritan Evergreen Hospice, Albany, Corvallis","930110095"},{"North Lincoln Home Health","931305493"},{"Pacific Communities Home Health","931329784"},{"Corvallis MRI","93-0949704"},{"East Linn MRI","320229399" What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names. False
8 2021-07-15 COMM Agmt FE - Samaritan Health Services training-data/contract-text-file/5. Multiple Custom/2021-07-15 COMM Agmt FE - Samaritan Health Services MU.txt Associated Provider Full Names PROV_DOING_BUSINESS_AS See "ModaSamaritanCareveouts" tab "Samaritan Lebanon Community Hospital","93-0396847"},{"Samaritan North Lincoln Hospital","93-1305493"},{"Samaritan Pacific Communities Hospital","93-1329784"},{"Albany General Hospital","93-0110095"},{"Samaritan Medical Supplies","46-5619962"},{"Samaritan Endoscopy Center LLC","202860067"},{"Good Samaritan Home Health","930391573"},{"Good Samaritan Home Infusion Services","930391573"},{"Samaritan Evergreen Hospice, Albany, Corvallis","930110095"},{"North Lincoln Home Health","931305493"},{"Pacific Communities Home Health","931329784"},{"Corvallis MRI","93-0949704"},{"East Linn MRI","320229399" What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names. False
9 2021-07-15 COMM Agmt FE - Samaritan Health Services training-data/contract-text-file/5. Multiple Custom/2021-07-15 COMM Agmt FE - Samaritan Health Services MU.txt Associated Provider Full Names PROV_DOING_BUSINESS_AS See "ModaSamaritanCareveouts" tab "Samaritan Lebanon Community Hospital","93-0396847"},{"Samaritan North Lincoln Hospital","93-1305493"},{"Samaritan Pacific Communities Hospital","93-1329784"},{"Albany General Hospital","93-0110095"},{"Samaritan Medical Supplies","46-5619962"},{"Samaritan Endoscopy Center LLC","202860067"},{"Good Samaritan Home Health","930391573"},{"Good Samaritan Home Infusion Services","930391573"},{"Samaritan Evergreen Hospice, Albany, Corvallis","930110095"},{"North Lincoln Home Health","931305493"},{"Pacific Communities Home Health","931329784"},{"Corvallis MRI","93-0949704"},{"East Linn MRI","320229399" What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names. False
10 2021-07-15 COMM Agmt FE - Samaritan Health Services training-data/contract-text-file/5. Multiple Custom/2021-07-15 COMM Agmt FE - Samaritan Health Services MU.txt Associated Provider Full Names PROV_DOING_BUSINESS_AS See "ModaSamaritanCareveouts" tab "Samaritan Lebanon Community Hospital","93-0396847"},{"Samaritan North Lincoln Hospital","93-1305493"},{"Samaritan Pacific Communities Hospital","93-1329784"},{"Albany General Hospital","93-0110095"},{"Samaritan Medical Supplies","46-5619962"},{"Samaritan Endoscopy Center LLC","202860067"},{"Good Samaritan Home Health","930391573"},{"Good Samaritan Home Infusion Services","930391573"},{"Samaritan Evergreen Hospice, Albany, Corvallis","930110095"},{"North Lincoln Home Health","931305493"},{"Pacific Communities Home Health","931329784"},{"Corvallis MRI","93-0949704"},{"East Linn MRI","320229399" What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names. False
11 Custom_Parkview Health Systems-OH MP, IN MP-ID C15656222AA training-data/contract-text-file/CareSource -Professional/Custom_Parkview Health Systems-OH MP, IN MP-ID C15656222AA MU.txt Associated Provider Full Names PROV_DOING_BUSINESS_AS Midwest Community Health Associates ['Midwest Community Health Associates', 'Parkview Physicians Group'] What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names. False
12 Custom_TriHealth_Group Practice_Sixth Amendment_20140101 training-data/contract-text-file/CareSource -Professional/Custom_TriHealth_Group Practice_Sixth Amendment_20140101 MU.txt Associated Provider Full Names PROV_DOING_BUSINESS_AS TriHealth OS, LLC ['Dirk Pruis', 'David Taylor', 'Lisa Vickers', 'Joseph Thomas', 'Paul Gangl', 'Arnold Penix', 'Emily Dixon', 'David Doyle', 'Monty Backus', 'Connie Chiu', 'Susan Segerman', 'Julie Novotny', 'Dianne Otten', 'Carmen Palascak', 'Richard Okragly', 'Walter Zancan', 'Kevin Reilly', 'Joel Sorger', 'Mark Snyder', 'Christopher Ruhnke', 'James Leonard', 'Robert Raines', 'Kristi White', 'Jessica Spears', 'Tina Mckinney', 'Erin Voss', 'Kyle Danemayer', 'Jeffery Riesenbeck', 'Mary Lutz', 'Steven Wurzelbacher', 'Steven Kinzer', 'Shaun White', 'Nicole Overbeck-Lynch', 'Sean Lynch', 'Mary Pfiester', 'Keene Bryant', 'Todd Heidrick', 'John McDonough', 'Thomas Kiefhaber', 'Daniel Reilly', 'Andrew Markiewitz', 'Paul Fassler', 'Andrew Cross', 'Benjamin Kleinhenz', 'Peter Stern', 'T. Gregory Sommerkamp', 'Paul Fassier', 'Brian Crellin'] What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names. False
13 Anc2_060117 Barnet Dulaney Perkins Eye Cntr Care1st Anc - 562589722 training-data/contract-text-file/Centene/CNC AZ - Ancillary/Anc2_060117 Barnet Dulaney Perkins Eye Cntr Care1st Anc - 562589722 MU.txt Associated Provider Full Names PROV_DOING_BUSINESS_AS Barnet Dulaney Surgery Centers, LLC ['Barnet Dulaney Perkins Eye Center, PLLC', 'Barnet Dulaney Surgery Centers, LLC'] What are the names of other providers associated with this agreement? The names can be found across multiple pages after the signature page. These names can be found in a roster and can be a list of provider names or TINs. Do not provide any context or explanation, simply state the names. False