diff --git a/streamlit/interface_2.py b/streamlit/interface_2.py index 003f37b..dd17a7d 100644 --- a/streamlit/interface_2.py +++ b/streamlit/interface_2.py @@ -109,55 +109,13 @@ for obj in objects['Contents']: if not obj['Key'].endswith('/'): file_list.append(obj['Key']) -# # to be replaced with snowflake data -# client_list = ['doczy-ai-client-1', 'Delaware First Health, Inc.', 'Community Health Choice, Inc','CareSource Network Partners LLC', -# 'HealthNet of Cali', 'Oklahoma Complete Health, Inc', 'HealthFirst', 'Molina Healthcare of TX', 'AvMed', 'Arizona Care1st', -# 'WellCare New Jersey'] - -#Replace client_list with this to get client names from s3 buckets -client_list, s3_paths = get_client_names() -client_s3_paths = dict(zip(client_list, s3_paths)) - -client_row = st.columns([0.2, 0.7, 0.1]) -with client_row[0]: - st.write("**Client Name**") -with client_row[1]: - client = st.selectbox('Client Name',(client_list), label_visibility = "collapsed", index= None) - - -# batch_objects = s3_client.list_objects_v2(Bucket=client_bucket -# , Prefix="contracts_landing_zone/", Delimiter='/') - -batch_list = ['d_12132', 'd_13345','i_23423', 'i_72223', 'b_12345', 'b_33452'] - - -# for prefix in batch_objects['CommonPrefixes']: -# batch_list.append(prefix['Prefix'][:-1].split('/')[-1]) - -path_row = st.columns([0.2, 0.7, 0.1]) -with path_row[0]: - st.write("**Batch ID**") -with path_row[1]: - batch_id = st.selectbox('**Batch ID**', batch_list, label_visibility = "collapsed", index=None) - - -#Need to populate file_list with the list of files from the selected client from client_list -# client_bucket = client_s3_paths.get(client) -# bucket = client_bucket -# objects = s3_client.list_objects_v2(Bucket=bucket, Prefix="training-data/") -# file_list = [] -# for obj in objects['Contents']: -# if not obj['Key'].endswith('/'): -# file_list.append(obj['Key']) - - contract_list = sorted(file_list) file_row = st.columns([0.2, 0.7, 0.1]) with file_row[0]: st.write("**Contract Name**") with file_row[1]: - file_name = st.selectbox('Select a file', ['All'] + contract_list, label_visibility = "collapsed", index= None) # MODIFIED - Append 'All' in the front instead of at the end + file_name = st.selectbox('Select a file', ['All'] + contract_list, label_visibility = "collapsed", index= None) field_row = st.columns([0.2, 0.7, 0.1]) with field_row[0]: @@ -230,8 +188,8 @@ if st.button("Show PDF"): """, unsafe_allow_html=True, ) - s3_client.Object(bucket,file_name) - data=obj.get()['Body'].read() + s3_obj = s3_client.get_object(bucket,file_name) + data=s3_obj['Body'].read() pdf_viewer(io.BytesIO(data), width=1500) # if st.button("Show PDF"):