James McCool
commited on
Commit
·
5641711
1
Parent(s):
617118a
Update timestamp handling in Streamlit app to ensure accurate display for each tab by retrieving the latest data timestamp from the relevant data sources.
Browse files- src/streamlit_app.py +6 -2
src/streamlit_app.py
CHANGED
|
@@ -344,8 +344,6 @@ with app_view_site_column:
|
|
| 344 |
with app_site_column:
|
| 345 |
site_var = st.selectbox("What site do you want to view?", ('Draftkings', 'Fanduel'), key='site_selectbox')
|
| 346 |
|
| 347 |
-
t_stamp = f"Last Update: " + str(dk_roo_raw['timestamp'][0]) + f" CST"
|
| 348 |
-
|
| 349 |
selected_tab = st.segmented_control(
|
| 350 |
"Select Tab",
|
| 351 |
options=["Handbuilder", "Stacks ROO", "Player ROO", "Optimals"],
|
|
@@ -354,6 +352,7 @@ selected_tab = st.segmented_control(
|
|
| 354 |
|
| 355 |
if selected_tab == 'Handbuilder':
|
| 356 |
st.session_state['handbuilder_data'] = init_handbuilder_data(site_var)
|
|
|
|
| 357 |
|
| 358 |
# Use the lightweight handbuilder data
|
| 359 |
if site_var == 'Draftkings':
|
|
@@ -764,6 +763,7 @@ if selected_tab == 'Handbuilder':
|
|
| 764 |
|
| 765 |
if selected_tab == 'Stacks ROO':
|
| 766 |
player_stats, dk_stacks_raw, fd_stacks_raw, dk_roo_raw, fd_roo_raw, dk_sd_roo_raw, fd_sd_roo_raw, dk_id_map, fd_id_map, dk_sd_id_map, fd_sd_id_map = init_baselines()
|
|
|
|
| 767 |
with st.expander("Info and Filters"):
|
| 768 |
st.info(t_stamp)
|
| 769 |
with st.container():
|
|
@@ -799,6 +799,8 @@ if selected_tab == 'Stacks ROO':
|
|
| 799 |
)
|
| 800 |
|
| 801 |
if selected_tab == 'Player ROO':
|
|
|
|
|
|
|
| 802 |
with st.expander("Info and Filters"):
|
| 803 |
st.info(t_stamp)
|
| 804 |
slate_var2 = st.radio("Which data are you loading?", ('Main Slate', 'Secondary Slate', 'Late Slate', 'Thurs-Mon Slate'), key='slate_var2_radio')
|
|
@@ -862,6 +864,8 @@ if selected_tab == 'Player ROO':
|
|
| 862 |
)
|
| 863 |
|
| 864 |
if selected_tab == 'Optimals':
|
|
|
|
|
|
|
| 865 |
st.header("Optimals")
|
| 866 |
with st.expander("Info and Filters"):
|
| 867 |
st.info("These filters will display various optimals in the table below to pick from. If you want to export the entire set of 10,000 optimals, hit the 'Prepare full data export' button. If you would like to apply the filters here to the 10,000 optimals before you export, use the 'Prepare full data export (Filter)' button.")
|
|
|
|
| 344 |
with app_site_column:
|
| 345 |
site_var = st.selectbox("What site do you want to view?", ('Draftkings', 'Fanduel'), key='site_selectbox')
|
| 346 |
|
|
|
|
|
|
|
| 347 |
selected_tab = st.segmented_control(
|
| 348 |
"Select Tab",
|
| 349 |
options=["Handbuilder", "Stacks ROO", "Player ROO", "Optimals"],
|
|
|
|
| 352 |
|
| 353 |
if selected_tab == 'Handbuilder':
|
| 354 |
st.session_state['handbuilder_data'] = init_handbuilder_data(site_var)
|
| 355 |
+
t_stamp = f"Last Update: " + str(st.session_state['handbuilder_data']['timestamp'][0]) + f" CST"
|
| 356 |
|
| 357 |
# Use the lightweight handbuilder data
|
| 358 |
if site_var == 'Draftkings':
|
|
|
|
| 763 |
|
| 764 |
if selected_tab == 'Stacks ROO':
|
| 765 |
player_stats, dk_stacks_raw, fd_stacks_raw, dk_roo_raw, fd_roo_raw, dk_sd_roo_raw, fd_sd_roo_raw, dk_id_map, fd_id_map, dk_sd_id_map, fd_sd_id_map = init_baselines()
|
| 766 |
+
t_stamp = f"Last Update: " + str(dk_roo_raw['timestamp'][0]) + f" CST"
|
| 767 |
with st.expander("Info and Filters"):
|
| 768 |
st.info(t_stamp)
|
| 769 |
with st.container():
|
|
|
|
| 799 |
)
|
| 800 |
|
| 801 |
if selected_tab == 'Player ROO':
|
| 802 |
+
player_stats, dk_stacks_raw, fd_stacks_raw, dk_roo_raw, fd_roo_raw, dk_sd_roo_raw, fd_sd_roo_raw, dk_id_map, fd_id_map, dk_sd_id_map, fd_sd_id_map = init_baselines()
|
| 803 |
+
t_stamp = f"Last Update: " + str(dk_roo_raw['timestamp'][0]) + f" CST"
|
| 804 |
with st.expander("Info and Filters"):
|
| 805 |
st.info(t_stamp)
|
| 806 |
slate_var2 = st.radio("Which data are you loading?", ('Main Slate', 'Secondary Slate', 'Late Slate', 'Thurs-Mon Slate'), key='slate_var2_radio')
|
|
|
|
| 864 |
)
|
| 865 |
|
| 866 |
if selected_tab == 'Optimals':
|
| 867 |
+
player_stats, dk_stacks_raw, fd_stacks_raw, dk_roo_raw, fd_roo_raw, dk_sd_roo_raw, fd_sd_roo_raw, dk_id_map, fd_id_map, dk_sd_id_map, fd_sd_id_map = init_baselines()
|
| 868 |
+
t_stamp = f"Last Update: " + str(dk_roo_raw['timestamp'][0]) + f" CST"
|
| 869 |
st.header("Optimals")
|
| 870 |
with st.expander("Info and Filters"):
|
| 871 |
st.info("These filters will display various optimals in the table below to pick from. If you want to export the entire set of 10,000 optimals, hit the 'Prepare full data export' button. If you would like to apply the filters here to the 10,000 optimals before you export, use the 'Prepare full data export (Filter)' button.")
|