Merged in feature/streamlit_multipageApp (pull request #112)

New changes to multipageApp functionality

Approved-by: Priya Iragavarapu
This commit is contained in:
Aryan Gupta
2024-06-19 02:00:00 +00:00
committed by Priya Iragavarapu
7 changed files with 66 additions and 66 deletions
+4 -3
View File
@@ -145,12 +145,13 @@ with buttons[1]:
try:
batch_id = json.loads(json.loads(response.text)['body'])['batch_id']
landing_zone = json.loads(json.loads(response.text)['body'])['landing_zone']
landing_zone = 'contracts-landing-zone/'
except:
# st.write(myobj)
# st.write(response.text)
st.write("Internal Error. Reach out to Doczy.AI Team.")
batch_id = 'failed_cases'
landing_zone = 'contracts-landing-zone'
landing_zone = 'contracts-landing-zone/'
else:
st.error("Failed")
for uploaded_file in file_list:
@@ -158,8 +159,8 @@ with buttons[1]:
stringio.seek(0)
s3_client.put_object(Bucket=client_bucket, Body=stringio.getvalue(), Key=
landing_zone+batch_id+'/'+str(uploaded_file.name))
# s3_client.put_object_tagging(Bucket=client_bucket, Key=
# landing_zone+batch_id+'/'+str(uploaded_file.name), Tagging = {'TagSet': [ { 'Key': 'BatchId', 'Value': batch_id }]})
s3_client.put_object_tagging(Bucket=client_bucket, Key=
landing_zone+batch_id+'/'+str(uploaded_file.name), Tagging = {'TagSet': [ { 'Key': 'BatchId', 'Value': batch_id }]})
# TODO: Test this insert function with snowflake
upload_log = insert_upload_logs(batch_id, client, str(uploaded_file.name), datetime.now().strftime("%Y-%m-%d %H:%M:%S"), user_mail)
+13 -13
View File
@@ -17,18 +17,18 @@ from constants import USER_LIST
user_list = USER_LIST
st.set_page_config(layout = "wide")
# # Sidebar contents
# with st.sidebar:
# st.title("Doczy.AI ™")
# st.markdown(
# """
# ## About
# This app extracts data from contracts
# Sidebar contents
with st.sidebar:
st.title("Doczy.AI ™")
st.markdown(
"""
## About
This app extracts data from contracts
# """
# )
# add_vertical_space(15)
# # st.write("Doczy")
"""
)
add_vertical_space(15)
# st.write("Doczy")
# AARETE LOGO
x,y,z = st.columns([15,2,15])
@@ -86,7 +86,7 @@ client_bucket = client_s3_paths.get(client)
client_bucket = 'doczy-dev-infra-textract'
batch_objects = s3_client.list_objects_v2(Bucket=client_bucket
, Prefix="contracts-landing-zone/", Delimiter='/')
, Prefix="contracts-landing-zone/", Delimiter='/')
batch_list = []
for prefix in batch_objects['CommonPrefixes']:
@@ -156,7 +156,7 @@ df = pd.DataFrame(columns=['Contract Name', 'Unique Key','Pricing Before Carveou
, 'Contract Related', 'Provider', 'Timeline', 'Carveout Indicator', 'Carveout Methodology'])
file_list = []
file_objects = s3_client.list_objects_v2(Bucket=client_bucket
, Prefix="contracts_landing_zone/"+batch_id+"/", Delimiter='/')
, Prefix="contracts-landing-zone/"+batch_id+"/", Delimiter='/')
# Hardcoded file_list for testing purposes
# file_list = ['Boilerplate_TX Amendment Mission Health Network effective_040114 MU.pdf', 'Custom_TX - MP AMENDMENT - MISSION HEALTH NETWORK - MU.pdf',
+11 -11
View File
@@ -29,17 +29,17 @@ user_list = USER_LIST
st.set_page_config(layout = "wide")
# Sidebar contents
# with st.sidebar:
# st.title("Doczy.AI ™")
# st.markdown(
# """
# ## About
# This app extracts data from contracts
with st.sidebar:
st.title("Doczy.AI ™")
st.markdown(
"""
## About
This app extracts data from contracts
# """
# )
# add_vertical_space(15)
# # st.write("Doczy")
"""
)
add_vertical_space(15)
# st.write("Doczy")
# AARETE LOGO
x,y,z = st.columns([15,2,15])
@@ -130,7 +130,7 @@ with path_row[1]:
if batch_id:
objects = s3_client.list_objects_v2(Bucket=client_bucket, Prefix="contract-landing-zone/"+batch_id+"/")
objects = s3_client.list_objects_v2(Bucket=client_bucket, Prefix="contracts-landing-zone/"+batch_id+"/")
file_list = []
if 'Contents' in objects:
for obj in objects['Contents']:
+5 -5
View File
@@ -16,8 +16,7 @@ import time
from sf_conn import get_client_names, insert_upload_logs
from constants import USER_LIST
(REDIRECT_URI, create_batch_url, doczy_pipeline) = util.load_page_details(0)
REDIRECT_URI = 'https://doczydev.aarete.com:8505'
(REDIRECT_URI, create_batch_url, doczy_pipeline) = util.load_page_details(5)
user_list = USER_LIST
if 'uploading' not in st.session_state:
@@ -146,12 +145,13 @@ with buttons[1]:
try:
batch_id = json.loads(json.loads(response.text)['body'])['batch_id']
landing_zone = json.loads(json.loads(response.text)['body'])['landing_zone']
landing_zone = 'contracts-landing-zone/'
except:
# st.write(myobj)
# st.write(response.text)
st.write("Internal Error. Reach out to Doczy.AI Team.")
batch_id = 'failed_cases'
landing_zone = 'contracts-landing-zone'
landing_zone = 'contracts-landing-zone/'
else:
st.error("Failed")
for uploaded_file in file_list:
@@ -159,8 +159,8 @@ with buttons[1]:
stringio.seek(0)
s3_client.put_object(Bucket=client_bucket, Body=stringio.getvalue(), Key=
landing_zone+batch_id+'/'+str(uploaded_file.name))
# s3_client.put_object_tagging(Bucket=client_bucket, Key=
# landing_zone+batch_id+'/'+str(uploaded_file.name), Tagging = {'TagSet': [ { 'Key': 'BatchId', 'Value': batch_id }]})
s3_client.put_object_tagging(Bucket=client_bucket, Key=
landing_zone+batch_id+'/'+str(uploaded_file.name), Tagging = {'TagSet': [ { 'Key': 'BatchId', 'Value': batch_id }]})
# TODO: Test this insert function with snowflake
upload_log = insert_upload_logs(batch_id, client, str(uploaded_file.name), datetime.now().strftime("%Y-%m-%d %H:%M:%S"), user_mail)
+13 -15
View File
@@ -13,24 +13,22 @@ import time
from sf_conn import get_client_names, get_secret, save_to_sf
from constants import USER_LIST
(REDIRECT_URI, create_batch_url, doczy_pipeline) = util.load_page_details(1)
REDIRECT_URI = 'https://doczydev.aarete.com:8505/Interface_1'
(REDIRECT_URI, create_batch_url, doczy_pipeline) = util.load_page_details(5)
user_list = USER_LIST
st.set_page_config(layout = "wide")
# # Sidebar contents
# with st.sidebar:
# st.title("Doczy.AI ™")
# st.markdown(
# """
# ## About
# This app extracts data from contracts
# Sidebar contents
with st.sidebar:
st.title("Doczy.AI ™")
st.markdown(
"""
## About
This app extracts data from contracts
# """
# )
# add_vertical_space(15)
# # st.write("Doczy")
"""
)
add_vertical_space(15)
# st.write("Doczy")
# AARETE LOGO
x,y,z = st.columns([15,2,15])
@@ -158,7 +156,7 @@ df = pd.DataFrame(columns=['Contract Name', 'Unique Key','Pricing Before Carveou
, 'Contract Related', 'Provider', 'Timeline', 'Carveout Indicator', 'Carveout Methodology'])
file_list = []
file_objects = s3_client.list_objects_v2(Bucket=client_bucket
, Prefix="contracts_landing_zone/"+batch_id+"/", Delimiter='/')
, Prefix="contracts-landing-zone/"+batch_id+"/", Delimiter='/')
# Hardcoded file_list for testing purposes
# file_list = ['Boilerplate_TX Amendment Mission Health Network effective_040114 MU.pdf', 'Custom_TX - MP AMENDMENT - MISSION HEALTH NETWORK - MU.pdf',
+19 -17
View File
@@ -24,23 +24,22 @@ from sf_conn import get_snowflake_conn
from sf_conn import get_client_names, get_secret, save_to_sf
import io
(REDIRECT_URI, create_batch_url, doczy_pipeline) = util.load_page_details(2)
REDIRECT_URI = 'https://doczydev.aarete.com:8505/Interface_2'
(REDIRECT_URI, create_batch_url, doczy_pipeline) = util.load_page_details(5)
user_list = USER_LIST
st.set_page_config(layout = "wide")
# Sidebar contents
# with st.sidebar:
# st.title("Doczy.AI ™")
# st.markdown(
# """
# ## About
# This app extracts data from contracts
with st.sidebar:
st.title("Doczy.AI ™")
st.markdown(
"""
## About
This app extracts data from contracts
# """
# )
# add_vertical_space(15)
# # st.write("Doczy")
"""
)
add_vertical_space(15)
# st.write("Doczy")
# AARETE LOGO
x,y,z = st.columns([15,2,15])
@@ -131,11 +130,14 @@ with path_row[1]:
if batch_id:
objects = s3_client.list_objects_v2(Bucket=client_bucket, Prefix="contract-text-file/"+batch_id+"/")
objects = s3_client.list_objects_v2(Bucket=client_bucket, Prefix="contracts-landing-zone/"+batch_id+"/")
file_list = []
for obj in objects['Contents']:
if not obj['Key'].endswith('/'):
file_list.append(obj['Key'])
if 'Contents' in objects:
for obj in objects['Contents']:
if not obj['Key'].endswith('/'):
file_list.append(obj['Key'])
else:
st.error('This batch_id is empty.')
contract_list = sorted(file_list)
@@ -216,7 +218,7 @@ if batch_id:
""",
unsafe_allow_html=True,
)
s3_obj = s3_client.get_object(Bucket = bucket, Key = 'textract-receiver-processed-pdfs/batch_2/2000-01-01 UCSD Medical Center PPA 14007097.PDF')
s3_obj = s3_client.get_object(Bucket = client_bucket, Key = file_name)
data=s3_obj['Body'].read()
pdf_viewer(data, width=1500)
+1 -2
View File
@@ -24,8 +24,7 @@ from sf_conn import get_secret, save_to_sf
from io import StringIO
(REDIRECT_URI, create_batch_url, doczy_pipeline) = util.load_page_details(3)
REDIRECT_URI = 'https://doczydev.aarete.com:8505/Interface_3'
(REDIRECT_URI, create_batch_url, doczy_pipeline) = util.load_page_details(5)
user_list = USER_LIST
st.set_page_config(layout = "wide")