Added dynamic client names + s3 path to UI0 and added upload logs function. NEEDS TESTING

This commit is contained in:
Umang Mistry
2024-04-04 17:03:00 -05:00
parent f88f4a41ad
commit d71c9d6b46
2 changed files with 72 additions and 1 deletions
+10
View File
@@ -11,6 +11,7 @@ import util
import requests
from sf_conn import get_secret, save_to_sf
from io import StringIO, BytesIO
from sf_conn import get_client_names, insert_upload_logs
create_batch_url = 'https://lfksus2t62.execute-api.us-east-2.amazonaws.com/dev/create-batch'
@@ -49,6 +50,11 @@ if user_mail in user_list:
bucket_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']
# This is the list of client fetched from Snowflake
# TODO: Need to update the streamlit code to use the client names from this list
# And use the s3 paths to save the objects for the respective client
client_names, s3_paths = get_client_names()
client_row = st.columns([0.1, 0.8])
with client_row[0]:
@@ -91,6 +97,10 @@ if user_mail in user_list:
# 'config_interface/'+str(uploaded_file.name))
s3_client.put_object(Bucket=client, Body=stringio.getvalue(), Key=
batch_id+'/'+landing_zone+'/'+str(uploaded_file.name))
# TODO: Test this insert function with snowflake
# insert_upload_logs(client, batch_id, str(uploaded_file.name), user_mail)
file_names.append(str(uploaded_file.name))
st.write(f"{batch_id} created")
st.write(f"Files uploaded to s3://{client}/{batch_id}/{landing_zone}")