Files
stand/stand.py

64 lines
970 B
Python

import streamlit as st
import hacks
from aggrid import aggrid
from download import download
from restapi import restapi
from utils.st_utils import get_session_id, rerun, hide_UI_elements
st.set_page_config(
page_title="stand",
page_icon="icon.png",
layout="wide"
)
hide_UI_elements()
restapi.sid = get_session_id() # rest api needs current session ID to trigger the next rerun
changed = restapi.changed
df = restapi.data
print(">>> start of streamlit run")
download(df)
response = aggrid(
df,
reload_data=changed
)
new_df = response["data"]
if not new_df.equals(df) and not changed:
restapi.data = new_df
# print("old:")
# print(df)
# print("new:")
# print(new_df)
# print(">>> force rerun")
# rerun()
#st.dataframe(df.astype(str))
#st.dataframe(new_df.astype(str))
if not new_df.empty:
# new_df.to_excel("output.xlsx")
new_df.to_hdf("output.h5", key="stand")
print(">>> end of streamlit run")