Merged in feature/ui2_updates (pull request #159)

PROD links added and more error handling done

Approved-by: Umang Mistry
This commit is contained in:
Aryan Gupta
2024-06-27 22:05:21 +00:00
committed by Umang Mistry
7 changed files with 60 additions and 27 deletions
+11 -2
View File
@@ -212,7 +212,10 @@ DOCZY_PIPELINE_URL_UAT = 'https://29gm8cek03.execute-api.us-east-2.amazonaws.com
DOCZY_REDIRECT_URL_UAT = 'https://doczyuat.aarete.com:850'
DOCZY_CREATE_BATCH_URL_UAT = 'https://29gm8cek03.execute-api.us-east-2.amazonaws.com/dev/create-batch'
# DOCZY UAT
# DOCZY PROD
DOCZY_PIPELINE_URL_PROD = 'https://d612isd3ja.execute-api.us-east-2.amazonaws.com/dev/trigger-pipeline'
DOCZY_REDIRECT_URL_PROD = 'https://doczy.aarete.com:850'
DOCZY_CREATE_BATCH_URL_PROD = 'https://d612isd3ja.execute-api.us-east-2.amazonaws.com/dev/create-batch'
# SNOWFLAKE DEV DATABASE
SNOWFLAKE_ACCOUNT_LOCATOR="aarete-doczyai",
@@ -223,6 +226,12 @@ DEV_STAGING_SCHEMA="STG"
# SNOWFLAKE UAT DATABASE
UAT_DB_ROLE = "UATADMIN",
UAT_WH="UAT_XS",
UAT_WH="DEV_XS",
UAT_DB="DOCZY_UAT",
UAT_STAGING_SCHEMA="STG"
# SNOWFLAKE PROD DATABASE
PROD_DB_ROLE = "PRODADMIN",
PROD_WH="DEV_XS",
PROD_DB="DOCZY_PROD",
PROD_STAGING_SCHEMA="STG"
+13 -11
View File
@@ -189,18 +189,8 @@ if client:
elif field_group == 'Timeline':
fields = fields[fields['PRIORITY'] == 'E']
button_cols = st.columns([0.2, 0.2, 0.6])
button_cols = st.columns([1,1,8])
with button_cols[0]:
if st.button("Show Results"):
query = f'select * from "DOCZY_PIPELINE_RAW_OUTPUT_AC" where batch_id = \'{batch_id}\''
cur.execute(query)
df2 = pd.DataFrame.from_records(iter(cur), columns=[x[0] for x in cur.description])
# get this dataframe from snowflake table
# df2 = pd.DataFrame(columns=['Contract Name','Field Name', 'SF_DB_COL_NAME', 'Snippet','Page Number'
# , 'Field Extracted Value', 'Actual Value','Imputed Value'])
df2.to_csv('temp2.csv', index=False)
with button_cols[1]:
if st.button("Show PDF"):
if file_name == None or file_name == "All":
st.error("Choose one specific file.")
@@ -219,6 +209,18 @@ if client:
s3_obj = s3_client.get_object(Bucket = client_bucket, Key = file_name)
data=s3_obj['Body'].read()
pdf_viewer(data, width=1500)
with button_cols[1]:
if st.button("Show Results"):
try:
query = f'select * from "DOCZY_PIPELINE_RAW_OUTPUT_AC" where batch_id = \'{batch_id}\''
cur.execute(query)
df2 = pd.DataFrame.from_records(iter(cur), columns=[x[0] for x in cur.description])
except:
df2 = pd.DataFrame(columns=['Contract Name','Field Name', 'SF_DB_COL_NAME', 'Snippet','Page Number'
, 'Field Extracted Value', 'Actual Value','Imputed Value'])
st.error('There was an error in fetching the output.')
df2.to_csv('temp2.csv', index=False)
# if st.button("Show PDF"):
# if file_name == None or file_name == "All":
+11 -2
View File
@@ -212,7 +212,10 @@ DOCZY_PIPELINE_URL_UAT = 'https://29gm8cek03.execute-api.us-east-2.amazonaws.com
DOCZY_REDIRECT_URL_UAT = 'https://doczyuat.aarete.com:850'
DOCZY_CREATE_BATCH_URL_UAT = 'https://29gm8cek03.execute-api.us-east-2.amazonaws.com/dev/create-batch'
# DOCZY UAT
# DOCZY PROD
DOCZY_PIPELINE_URL_PROD = 'https://d612isd3ja.execute-api.us-east-2.amazonaws.com/dev/trigger-pipeline'
DOCZY_REDIRECT_URL_PROD = 'https://doczy.aarete.com:850'
DOCZY_CREATE_BATCH_URL_PROD = 'https://d612isd3ja.execute-api.us-east-2.amazonaws.com/dev/create-batch'
# SNOWFLAKE DEV DATABASE
SNOWFLAKE_ACCOUNT_LOCATOR="aarete-doczyai",
@@ -223,6 +226,12 @@ DEV_STAGING_SCHEMA="STG"
# SNOWFLAKE UAT DATABASE
UAT_DB_ROLE = "UATADMIN",
UAT_WH="UAT_XS",
UAT_WH="DEV_XS",
UAT_DB="DOCZY_UAT",
UAT_STAGING_SCHEMA="STG"
# SNOWFLAKE PROD DATABASE
PROD_DB_ROLE = "PRODADMIN",
PROD_WH="DEV_XS",
PROD_DB="DOCZY_PROD",
PROD_STAGING_SCHEMA="STG"
+4 -1
View File
@@ -92,7 +92,10 @@ if client:
batch_list = []
for prefix in batch_objects['CommonPrefixes']:
batch_list.append(prefix['Prefix'][:-1].split('/')[-1])
batch_name = prefix['Prefix'][:-1].split('/')[-1]
batch_objects2 = s3_client.list_objects_v2(Bucket=client_bucket, Prefix="contracts-landing-zone/"+batch_name+"/", Delimiter='/')
if 'Contents' in batch_objects2 and len(batch_objects2['Contents'] > 0):
batch_list.append(prefix['Prefix'][:-1].split('/')[-1])
# Hardcoded batch_list for testing purposes
# batch_list = ['batch_020524103737', 'batch_090524131433', 'batch_090524131607', 'batch_100524123000', 'batch_130524064322',
+13 -11
View File
@@ -189,18 +189,8 @@ if client:
elif field_group == 'Timeline':
fields = fields[fields['PRIORITY'] == 'E']
button_cols = st.columns([0.2, 0.2, 0.6])
button_cols = st.columns([1,1,8])
with button_cols[0]:
if st.button("Show Results"):
query = f'select * from "DOCZY_PIPELINE_RAW_OUTPUT_AC" where batch_id = \'{batch_id}\''
cur.execute(query)
df2 = pd.DataFrame.from_records(iter(cur), columns=[x[0] for x in cur.description])
# get this dataframe from snowflake table
# df2 = pd.DataFrame(columns=['Contract Name','Field Name', 'SF_DB_COL_NAME', 'Snippet','Page Number'
# , 'Field Extracted Value', 'Actual Value','Imputed Value'])
df2.to_csv('temp2.csv', index=False)
with button_cols[1]:
if st.button("Show PDF"):
if file_name == None or file_name == "All":
st.error("Choose one specific file.")
@@ -219,6 +209,18 @@ if client:
s3_obj = s3_client.get_object(Bucket = client_bucket, Key = file_name)
data=s3_obj['Body'].read()
pdf_viewer(data, width=1500)
with button_cols[1]:
if st.button("Show Results"):
try:
query = f'select * from "DOCZY_PIPELINE_RAW_OUTPUT_AC" where batch_id = \'{batch_id}\''
cur.execute(query)
df2 = pd.DataFrame.from_records(iter(cur), columns=[x[0] for x in cur.description])
except:
df2 = pd.DataFrame(columns=['Contract Name','Field Name', 'SF_DB_COL_NAME', 'Snippet','Page Number'
, 'Field Extracted Value', 'Actual Value','Imputed Value'])
st.error('There was an error in fetching the output.')
df2.to_csv('temp2.csv', index=False)
# if st.button("Show PDF"):
# if file_name == None or file_name == "All":
+4
View File
@@ -59,6 +59,10 @@ def load_page_details(interface):
logger.info(constants.DOCZY_REDIRECT_URL_DEV + str(interface))
return (constants.DOCZY_REDIRECT_URL_DEV + str(interface), constants.DOCZY_CREATE_BATCH_URL_DEV,
constants.DOCZY_PIPELINE_URL_DEV)
elif env_var == 'PROD':
logger.info(constants.DOCZY_REDIRECT_URL_PROD + str(interface))
return (constants.DOCZY_REDIRECT_URL_PROD + str(interface), constants.DOCZY_CREATE_BATCH_URL_PROD,
constants.DOCZY_PIPELINE_URL_PROD)
else:
logger.info(constants.DOCZY_REDIRECT_URL_DEV + str(interface))
return (constants.DOCZY_REDIRECT_URL_DEV + str(interface), constants.DOCZY_CREATE_BATCH_URL_DEV,
+4
View File
@@ -59,6 +59,10 @@ def load_page_details(interface):
logger.info(constants.DOCZY_REDIRECT_URL_DEV + str(interface))
return (constants.DOCZY_REDIRECT_URL_DEV + str(interface), constants.DOCZY_CREATE_BATCH_URL_DEV,
constants.DOCZY_PIPELINE_URL_DEV)
elif env_var == 'PROD':
logger.info(constants.DOCZY_REDIRECT_URL_PROD + str(interface))
return (constants.DOCZY_REDIRECT_URL_PROD + str(interface), constants.DOCZY_CREATE_BATCH_URL_PROD,
constants.DOCZY_PIPELINE_URL_PROD)
else:
logger.info(constants.DOCZY_REDIRECT_URL_DEV + str(interface))
return (constants.DOCZY_REDIRECT_URL_DEV + str(interface), constants.DOCZY_CREATE_BATCH_URL_DEV,