Spaces:
Sleeping
Sleeping
import streamlit as st | |
from config import DEFAULT_ICON | |
from shared_page import common_page_config | |
from dbt_data_client import get_depth_charts, get_current_tables | |
from streamlit_filter import filter_dataframe | |
hide_columns: list[str] = [ | |
"last_name", | |
"first_name", | |
"football_name", | |
"gsis_id", | |
"elias_id", | |
] | |
def get_page(): | |
page_title = "Depth Charts" | |
st.set_page_config(page_title=page_title, page_icon=DEFAULT_ICON, layout="wide") | |
common_page_config() | |
st.title(page_title) | |
table_name = "depth_charts" | |
current_tables_list = get_current_tables() | |
if table_name not in current_tables_list: | |
st.write("Data not loaded.") | |
st.write("Check loaded data [here](./Load_Data)") | |
return | |
data = get_depth_charts() | |
week_selection = st.slider( | |
"Filter Week Range:", | |
min_value=data["week"].min(), | |
max_value=data["week"].max(), | |
value=(data["week"].min(), data["week"].max()), | |
step=1, | |
) | |
data = data[data["week"].between(*week_selection)] | |
data.drop(columns=hide_columns, inplace=True) | |
with st.container(): | |
filtered_data = filter_dataframe( | |
data, | |
force_on=True, | |
force_on_columns=[ | |
"club_code", | |
"position", | |
"depth_position", | |
"depth_team", | |
], | |
) | |
st.dataframe( | |
filtered_data, | |
hide_index=True, | |
# height=35 * (len(filtered_data) + 1) + 12, | |
use_container_width=False, | |
column_config={}, | |
) | |
if __name__ == "__main__": | |
get_page() | |