Spaces:
Sleeping
Sleeping
James McCool
commited on
Commit
·
20f53c3
1
Parent(s):
3d97c49
Refactor tab1 display options layout and improve UI organization
Browse files
app.py
CHANGED
|
@@ -312,74 +312,74 @@ with st.sidebar:
|
|
| 312 |
st.write(f'Total LevX: {levx_sum:.2f}')
|
| 313 |
|
| 314 |
with tab1:
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
st.
|
| 322 |
-
with col2:
|
| 323 |
-
if st.button("Load/Reset Data", key='reset1'):
|
| 324 |
-
st.cache_data.clear()
|
| 325 |
-
dk_raw, fd_raw, dk_raw_sec, fd_raw_sec, roo_raw, timestamp, roo_backlog = load_overall_stats()
|
| 326 |
-
id_dict = dict(zip(roo_raw.Player, roo_raw.player_ID))
|
| 327 |
-
dk_lineups = init_DK_lineups()
|
| 328 |
-
fd_lineups = init_FD_lineups()
|
| 329 |
-
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
| 330 |
-
for key in st.session_state.keys():
|
| 331 |
-
del st.session_state[key]
|
| 332 |
-
|
| 333 |
-
with st.expander("Display Options"):
|
| 334 |
-
col1, col2, col3, col4 = st.columns(4)
|
| 335 |
with col1:
|
| 336 |
-
|
| 337 |
with col2:
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 374 |
else:
|
| 375 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
|
| 384 |
display_container_1 = st.empty()
|
| 385 |
display_dl_container_1 = st.empty()
|
|
|
|
| 312 |
st.write(f'Total LevX: {levx_sum:.2f}')
|
| 313 |
|
| 314 |
with tab1:
|
| 315 |
+
|
| 316 |
+
with st.expander("Display Options"):
|
| 317 |
+
with st.container():
|
| 318 |
+
st.info("Advanced view includes all stats and thresholds, simple includes just basic columns for ease of use on mobile")
|
| 319 |
+
with st.container():
|
| 320 |
+
# First row - timestamp and reset button
|
| 321 |
+
col1, col2 = st.columns([3, 1])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 322 |
with col1:
|
| 323 |
+
st.info(t_stamp)
|
| 324 |
with col2:
|
| 325 |
+
if st.button("Load/Reset Data", key='reset1'):
|
| 326 |
+
st.cache_data.clear()
|
| 327 |
+
dk_raw, fd_raw, dk_raw_sec, fd_raw_sec, roo_raw, timestamp, roo_backlog = load_overall_stats()
|
| 328 |
+
id_dict = dict(zip(roo_raw.Player, roo_raw.player_ID))
|
| 329 |
+
dk_lineups = init_DK_lineups()
|
| 330 |
+
fd_lineups = init_FD_lineups()
|
| 331 |
+
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
| 332 |
+
for key in st.session_state.keys():
|
| 333 |
+
del st.session_state[key]
|
| 334 |
+
col1, col2, col3, col4 = st.columns(4)
|
| 335 |
+
with col1:
|
| 336 |
+
view_var2 = st.radio("View Type", ('Simple', 'Advanced'), key='view_var2')
|
| 337 |
+
with col2:
|
| 338 |
+
site_var2 = st.radio("Site", ('Draftkings', 'Fanduel'), key='site_var2')
|
| 339 |
+
|
| 340 |
+
# Process site selection
|
| 341 |
+
if site_var2 == 'Draftkings':
|
| 342 |
+
site_baselines = roo_raw[roo_raw['site'] == 'Draftkings']
|
| 343 |
+
site_backlog = roo_backlog[roo_backlog['site'] == 'Draftkings']
|
| 344 |
+
elif site_var2 == 'Fanduel':
|
| 345 |
+
site_baselines = roo_raw[roo_raw['site'] == 'Fanduel']
|
| 346 |
+
site_backlog = roo_backlog[roo_backlog['site'] == 'Fanduel']
|
| 347 |
+
with col3:
|
| 348 |
+
slate_split = st.radio("Slate Type", ('Main Slate', 'Secondary', 'Backlog'), key='slate_split')
|
| 349 |
+
|
| 350 |
+
if slate_split == 'Main Slate':
|
| 351 |
+
raw_baselines = site_baselines[site_baselines['slate'] == 'Main Slate']
|
| 352 |
+
elif slate_split == 'Secondary':
|
| 353 |
+
raw_baselines = site_baselines[site_baselines['slate'] == 'Secondary Slate']
|
| 354 |
+
elif slate_split == 'Backlog':
|
| 355 |
+
raw_baselines = site_backlog
|
| 356 |
+
# Third row - backlog options
|
| 357 |
+
col1, col2 = st.columns(2)
|
| 358 |
+
with col1:
|
| 359 |
+
view_all = st.checkbox("View all dates?", key='view_all')
|
| 360 |
+
with col2:
|
| 361 |
+
if not view_all:
|
| 362 |
+
date_var2 = st.date_input("Select date", key='date_var2')
|
| 363 |
+
|
| 364 |
+
if view_all:
|
| 365 |
+
raw_baselines = raw_baselines.sort_values(by=['Median', 'Date'], ascending=[False, False])
|
| 366 |
else:
|
| 367 |
+
raw_baselines = raw_baselines[raw_baselines['Date'] == date_var2.strftime('%m-%d-%Y')]
|
| 368 |
+
raw_baselines = raw_baselines.sort_values(by='Median', ascending=False)
|
| 369 |
+
|
| 370 |
+
with col4:
|
| 371 |
+
split_var2 = st.radio("Slate Range", ('Full Slate Run', 'Specific Games'), key='split_var2')
|
| 372 |
+
if split_var2 == 'Specific Games':
|
| 373 |
+
team_var2 = st.multiselect('Select teams for ROO', options=raw_baselines['Team'].unique(), key='team_var2')
|
| 374 |
+
else:
|
| 375 |
+
team_var2 = raw_baselines.Team.values.tolist()
|
| 376 |
|
| 377 |
+
pos_var2 = st.selectbox('Position Filter', options=['All', 'PG', 'SG', 'SF', 'PF', 'C'], key='pos_var2')
|
| 378 |
+
col1, col2 = st.columns(2)
|
| 379 |
+
with col1:
|
| 380 |
+
low_salary = st.number_input('Enter Lowest Salary', min_value=3000, max_value=15000, value=3000, step=100, key='low_salary')
|
| 381 |
+
with col2:
|
| 382 |
+
high_salary = st.number_input('Enter Highest Salary', min_value=3000, max_value=15000, value=15000, step=100, key='high_salary')
|
| 383 |
|
| 384 |
display_container_1 = st.empty()
|
| 385 |
display_dl_container_1 = st.empty()
|