import datetime import streamlit as st from config import DEFAULT_ICON from shared_page import common_page_config from queries.footballguys.constants import YEAR from queries.nflverse.github_data import get_ftn_charting @st.cache_data(ttl=60 * 60 * 24) def load_data(): data = get_ftn_charting(YEAR) data_load_time_str = datetime.datetime.utcnow().strftime("%m/%d/%Y %I:%M %p") return data, data_load_time_str def get_page(): page_title = f"FTN Charting - {YEAR}" st.set_page_config(page_title=page_title, page_icon=DEFAULT_ICON, layout="wide") common_page_config() st.title(page_title) if st.button("Refresh Data"): st.cache_data.clear() data, data_load_time_str = load_data() st.write(f"Data loaded as of: {data_load_time_str} UTC") with st.container(): filtered_data = data st.dataframe( filtered_data, hide_index=True, # height=35 * (len(filtered_data) + 1) + 12, use_container_width=False, ) if __name__ == "__main__": get_page()