114 lines
3.4 KiB
Python
114 lines
3.4 KiB
Python
import streamlit as st
|
|
from streamlit_extras.add_vertical_space import add_vertical_space
|
|
import os
|
|
import streamlit as st
|
|
import pandas as pd
|
|
from io import StringIO
|
|
from datetime import datetime
|
|
|
|
st.set_page_config(layout = "wide")
|
|
|
|
|
|
# # 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")
|
|
|
|
|
|
client_row = st.columns([0.1, 0.8])
|
|
with client_row[0]:
|
|
st.write("**Client Name**")
|
|
with client_row[1]:
|
|
client = st.selectbox('Client Name',('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'), label_visibility = "collapsed")
|
|
|
|
def file_selector(folder_path='.'):
|
|
filenames = os.listdir(folder_path)
|
|
selected_filename = st.selectbox('**Path to folder**', filenames, label_visibility = "collapsed")
|
|
return os.path.join(folder_path, selected_filename)
|
|
# return selected_filename
|
|
|
|
path_row = st.columns([0.1, 0.8])
|
|
with path_row[0]:
|
|
st.write("**Path to folder**")
|
|
with path_row[1]:
|
|
# Directory = st.text_input("**Path to folder**", label_visibility = "collapsed")
|
|
Directory = file_selector()
|
|
|
|
checks = st.columns([0.1, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12])
|
|
with checks[0]:
|
|
st.write("**Group No.**")
|
|
with checks[1]:
|
|
a = st.checkbox('Unique Key', key = str(1))
|
|
with checks[2]:
|
|
b = st.checkbox('Pricing Before Carveouts', key = str(2))
|
|
with checks[3]:
|
|
c = st.checkbox('Contract Related', key = str(3))
|
|
with checks[4]:
|
|
d = st.checkbox('Provider', key = str(4))
|
|
with checks[5]:
|
|
e = st.checkbox('Timeline', key = str(5))
|
|
with checks[6]:
|
|
f = st.checkbox('Carveout Indicator', key = str(6))
|
|
with checks[7]:
|
|
g = st.checkbox('Carveout Methodology', key = str(7))
|
|
|
|
add_vertical_space(1)
|
|
|
|
df = pd.DataFrame(columns=['Request ID','Contract ID','Contract Name','Unique Key','Pricing Before Carveouts'
|
|
, 'Contract Related', 'Provider', 'Timeline', 'Carveout Indicator', 'Carveout Methodology'])
|
|
file_list = []
|
|
|
|
if st.button("Read the contracts from Path"):
|
|
for filename in os.listdir(Directory):
|
|
# with open(os.path.join(Directory, filename), encoding="utf8") as f:
|
|
# context = f.read()
|
|
file_list.append(filename)
|
|
|
|
df['Contract Name'] = file_list
|
|
df['Request ID'] = range(len(file_list))
|
|
df['Contract ID'] = file_list
|
|
# df['Folder Name'] = Directory
|
|
# df['Updated Group Number'] = updated_group
|
|
df['Unique Key'] = a
|
|
df['Pricing Before Carveouts'] = b
|
|
df['Contract Related'] = c
|
|
df['Provider'] = d
|
|
df['Timeline'] = e
|
|
df['Carveout Indicator'] = f
|
|
df['Carveout Methodology'] = g
|
|
df.to_csv('temp1.csv', index=False)
|
|
|
|
add_vertical_space(1)
|
|
|
|
# df_copy = df.set_index(df.columns[0]).copy()
|
|
df2 = pd.read_csv('temp1.csv')
|
|
edited_df = st.data_editor(df2)
|
|
|
|
|
|
@st.cache_data
|
|
def convert_df(df):
|
|
return df.to_csv(index=False).encode('utf-8')
|
|
|
|
csv = convert_df(edited_df)
|
|
|
|
buttons = st.columns([0.45, 0.35, 0.2])
|
|
with buttons[0]:
|
|
st.button("Save All Edits")
|
|
with buttons[1]:
|
|
st.download_button("Download Table", csv, "file.csv", "text/csv", key='download-csv')
|
|
with buttons[2]:
|
|
st.button("Run Doczy.AI Pipeline")
|
|
|
|
|
|
|