Spaces:
Runtime error
Runtime error
import streamlit as st | |
import importlib | |
from uix import lit_packages | |
from uix.pages import lit_home, lit_about | |
from uix.pages import lit_anom_superv, lit_anom_unsuperv | |
#--- alt define sidebar pages | |
m_aryPages = { | |
"Home": lit_home, #--- TODO: update | |
#"Provider Analysis": lit_providerAnalysis, | |
#"Claims Analysis": lit_claimAnalysis, | |
"Provider Anoms - Supervised": lit_anom_superv, | |
"Claim Anoms - UnSupervised": lit_anom_unsuperv, | |
#"MLE Model Performance": lit_about, #--- TODO: update | |
"About": lit_about | |
} | |
#--- define module-level vars | |
m_aryModNames = lit_packages.packages() | |
m_aryDescr = [] | |
m_aryMods = [] | |
def init(): | |
#--- upper panel | |
with st.sidebar: | |
kstrUrl_image = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAf4AAABjCAMAAABNPpI+AAAAxlBMVEX////rAIvrAIrqAIfqAITqAIP/9/zsAI/1iMfqAIHwZqrtDZfyb7Pzbbf+8vr3p9L4rtf6zeX95vLtI5X0dr7wX6vyWrH/+/72mcv1jsXvNaH61ub5uNz4q9n6x+X1pcruSp794vPwT6v96/X92/D4tNntMJn81ez6weLzebrwVKj7zef95fPvQaLzi7z82e/3otDwRKjuKZv2lcryYbP1mMb0gMPzg7zuPZzuTqL5wt70nMbygrfvWqXsJ5L2r9DxdrH3ttMtxwOlAAAZMklEQVR4nO1de2OaPheGJIj+VNRSi1rninhFWa06q93mtu//pd6cJNyDYl/b2c3nj80KQsKTnJxbDooih9N60tFy2rAyjoc4fsYVHw31EUGqijB6dg6eN259/fX1k/FOrbrifVDDlHwAws0D3DpTFVMgc/F+TbvizTFWKfuYaDAItOfM0+Ye4aMEkWLhHZt3xZuiUMUqQuvG/YoOA6QPMk4zmhjEA2b/tt61hVe8IW50pOI6fLJHlP/i3DEoUipeHXg3m9+bMEjIYR3hio+DsabiPv84pMyao12TovKdor2iWAy7w+Fk8IRVvBwXFKNG+SftP9vmK86GGlHJC/9owcxGIOGjQAC2MMz5D6im8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7Y4Yw3H9jrSFPossaLmlnQJS04ydDZy08i9JdYH6WpnqwX+TeUJTFM1HSD8lDlG0uxBmV0wjZFRWlVAat85Q3tors1TV01zdGumr0danzrn7Z1NyLNzFnT29wGT91mt10frjvWqO7EZXZFf6kbsh/eyp6p6Er4xW01hdaqlayrx9Hj182qgzfY7KComw5dCl62s4GfBKcU+O3CET1bsz7KZhbvxetL5Rseiu1xBv0Em9PPUx2cfm9Yg93ozbrD3uxYucB5bzahp/2/r9uzxj24zEW8lHrQ6w27vcZl1D+tkVh6lwOpa/yVUPjQjs4r/hIso68AgaQEJCJFyd1BV/yNqOOIw80G1a+2pmZp9eUypNMVb4s5Xf19A89qYmmWxRV/L1ZU2YcMLNuBiLz/KuAr/hEUKOfeJ3e033tU7ZfkIl7xV6NFVFFlGmoDXtablq94c/DKgohtB4/s77/i3wCUclSR+V/lgQ4AWV7cFX8zGiD0+2NLuXnGYXG9K/4RMD8/X/KfcbQ4+RX/Ajoo2HtjY1le3BV/M5Yo3HmHMorjXvHX4gkH1v4jRodf1XvFXwcI84iEkRUV/lev378FVvYZXtlpLKj1fxFvo77i/cDSanHny1eXBKleV/w7gGI//GXuWL8qfv8erIrKygGT0VXv+xdhjasdVX9aXNW+D4n/AeKsA1opSbg6AAAAAElFTkSuQmCC" | |
st.sidebar.image(kstrUrl_image, width=200) | |
st.sidebar.markdown('Visualize Provider and Claims anomalies.') | |
#--- init checkboxes | |
strKey = st.sidebar.radio("Go to", list(m_aryPages.keys())) | |
pagSel = m_aryPages[strKey] | |
writePage(pagSel) | |
def init_selectBox(): | |
#--- init module array of page names, and descr | |
init_modDescrAry() | |
# Display the sidebar with a menu of apps | |
kstrMsg = """ | |
__Claims Anomaly Views__ | |
""" | |
with st.sidebar: | |
st.markdown('---') | |
st.markdown(kstrMsg) | |
page = st.selectbox('Select:', m_aryModNames, format_func=fmt_modName) | |
#--- display sidebar footer | |
with st.sidebar: | |
st.markdown('---') | |
st.write('Developed by Chavarria, McKone, Sharma') | |
st.write('Contact at iain.mckone@gmail.com') | |
# Run the chosen app | |
m_aryMods[m_aryModNames.index(page)].run() | |
def init_modDescrAry(): | |
#--- init global array of page names, and descr | |
#--- note: you need to specify global scope for fxns to access module-level variables | |
global m_aryMods | |
global m_aryDescr | |
m_aryMods = [] | |
m_aryDescr = [] | |
for modName in m_aryModNames: | |
modTemp = importlib.import_module('.'+modName,'uix') | |
m_aryMods.append(modTemp) | |
#--- If the module has a description attribute use that in the | |
#--- select box otherwise use the module name | |
try: | |
m_aryDescr.append(modTemp.description) | |
except: | |
m_aryDescr.append(modName) | |
#--- display the app descriptions instead of the module names in the selctbox | |
def fmt_modName(strName): | |
global m_aryModNames | |
global m_aryDescr | |
return m_aryDescr[m_aryModNames.index(strName)] | |
def writePage(uixFile): | |
#--- writes out the page for the selected combo | |
# _reload_module(page) | |
uixFile.run() | |