File size: 1,652 Bytes
1d914b6
 
 
 
 
b9bcaf8
64f6425
1d914b6
 
 
 
 
 
 
 
 
 
 
 
b9bcaf8
1d914b6
 
 
 
b9bcaf8
1d914b6
 
 
 
 
 
b9bcaf8
1d914b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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()