James McCool commited on
Commit
986c3ed
·
1 Parent(s): 4a42761

Refactor caching mechanism in app.py: replace @st .cache_data with @st .cache_resource for DK and FD lineups initialization. Update timestamp display for last update in the player statistics section.

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -110,7 +110,7 @@ def player_stat_table():
110
 
111
  return player_stats, dk_stacks_raw, fd_stacks_raw, dk_roo_raw, fd_roo_raw
112
 
113
- @st.cache_data(ttl = 60)
114
  def init_DK_lineups():
115
 
116
  collection = db["DK_NFL_seed_frame"]
@@ -122,7 +122,7 @@ def init_DK_lineups():
122
 
123
  return DK_seed
124
 
125
- @st.cache_data(ttl = 60)
126
  def init_FD_lineups():
127
 
128
  collection = db["FD_NFL_seed_frame"]
@@ -150,6 +150,7 @@ try:
150
  except:
151
  dk_lineups = pd.DataFrame(columns=dk_columns)
152
  fd_lineups = pd.DataFrame(columns=fd_columns)
 
153
  t_stamp = f"Last Update: " + str(dk_roo_raw['timestamp'][0]) + f" CST"
154
 
155
  tab1, tab2, tab3, tab4, tab5, tab6, tab7 = st.tabs(["Team Stacks Range of Outcomes", "Overall Range of Outcomes", "QB Range of Outcomes", "RB Range of Outcomes", "WR Range of Outcomes", "TE Range of Outcomes", "Optimals"])
 
110
 
111
  return player_stats, dk_stacks_raw, fd_stacks_raw, dk_roo_raw, fd_roo_raw
112
 
113
+ @st.cache_resource(ttl = 60)
114
  def init_DK_lineups():
115
 
116
  collection = db["DK_NFL_seed_frame"]
 
122
 
123
  return DK_seed
124
 
125
+ @st.cache_resource(ttl = 60)
126
  def init_FD_lineups():
127
 
128
  collection = db["FD_NFL_seed_frame"]
 
150
  except:
151
  dk_lineups = pd.DataFrame(columns=dk_columns)
152
  fd_lineups = pd.DataFrame(columns=fd_columns)
153
+
154
  t_stamp = f"Last Update: " + str(dk_roo_raw['timestamp'][0]) + f" CST"
155
 
156
  tab1, tab2, tab3, tab4, tab5, tab6, tab7 = st.tabs(["Team Stacks Range of Outcomes", "Overall Range of Outcomes", "QB Range of Outcomes", "RB Range of Outcomes", "WR Range of Outcomes", "TE Range of Outcomes", "Optimals"])