James McCool commited on
Commit
d481fdb
·
1 Parent(s): 1be941a

Adding buttons for Lagheeza, Ronis, and Freedman (GL)

Browse files
Files changed (1) hide show
  1. app.py +56 -10
app.py CHANGED
@@ -44,10 +44,12 @@ headers = {
44
  'Authorization': 'Bearer 6984da1f-2c81-4140-8206-d018af38533f',
45
  }
46
 
47
- name_options = ['Dwain', 'Freedman', 'Ian', 'Waz', 'Charch', 'Kendall', 'Sam', 'Matthew Berry']
48
- api_replace_options = ['dwain', 'freedman', 'ian', 'waz', 'charch', 'kendall', 'sam', 'berry']
49
  proj_source_options = ['Dwain', 'Freedman', 'Kickers', 'Defenses']
50
  proj_replace_options = ['dwain', 'freedman', 'kickers', 'defenses']
 
 
51
 
52
 
53
  def grab_sr_fa(headers: dict) -> pd.DataFrame:
@@ -151,11 +153,11 @@ def grab_sr_ids(headers: dict) -> pd.DataFrame:
151
 
152
  return pd.DataFrame(row_data, columns=['FA_ID', 'SR_ID', 'First_Name', 'Prefer_First_Name', 'Last_Name', 'Name_Suffix', 'Position', 'Team'])
153
 
154
- tab1, tab2, tab3, tab4, tab5, tab6 = st.tabs(['Rankings Update', 'Projections Update', 'SR ID Update', 'Game Model Update', 'Rest of Season Update', 'NCAAF Script'])
155
 
156
  with tab1:
157
  with st.container():
158
- col1, col2, col3, col4 = st.columns([3, 3, 3, 3])
159
 
160
  with col1:
161
  st.info("Update Seasonal Rankings")
@@ -175,8 +177,27 @@ with tab1:
175
  st.cache_data.clear()
176
  for key in st.session_state.keys():
177
  del st.session_state[key]
178
-
179
  with col2:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  st.info("Update Weekly Rankings")
181
  choose_weekly_ranker = st.selectbox("Choose Ranker", name_options, key='weekly_ranker')
182
  choose_weekly_ranker = api_replace_options[name_options.index(choose_weekly_ranker)]
@@ -195,7 +216,7 @@ with tab1:
195
  for key in st.session_state.keys():
196
  del st.session_state[key]
197
 
198
- with col3:
199
  st.info("Update Seasonal Guillotine Rankings")
200
  choose_seasonal_guillotine_ranker = st.selectbox("Choose Ranker", name_options, key='seasonal_guillotine_ranker')
201
  choose_seasonal_guillotine_ranker = api_replace_options[name_options.index(choose_seasonal_guillotine_ranker)]
@@ -214,7 +235,7 @@ with tab1:
214
  for key in st.session_state.keys():
215
  del st.session_state[key]
216
 
217
- with col4:
218
  st.info("Update Weekly Guillotine Rankings")
219
  choose_weekly_guillotine_ranker = st.selectbox("Choose Ranker", name_options, key='weekly_guillotine_ranker')
220
  choose_weekly_guillotine_ranker = api_replace_options[name_options.index(choose_weekly_guillotine_ranker)]
@@ -293,6 +314,34 @@ with tab2:
293
  st.cache_data.clear()
294
  for key in st.session_state.keys():
295
  del st.session_state[key]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
 
297
  with tab3:
298
  with st.container():
@@ -353,9 +402,6 @@ with tab4:
353
  st.info("We will add this functionality as soon as we have the endpoints to make it work!")
354
 
355
  with tab5:
356
- st.info("We will add this functionality as soon as we have the endpoints to make it work!")
357
-
358
- with tab6:
359
  with st.container():
360
  col1, col2, col3 = st.columns([3, 3, 3])
361
 
 
44
  'Authorization': 'Bearer 6984da1f-2c81-4140-8206-d018af38533f',
45
  }
46
 
47
+ name_options = ['Dwain', 'Freedman', 'Ian', 'Waz', 'Charch', 'Kendall', 'Sam', 'Laghezza', 'Ronis', 'Matthew Berry']
48
+ api_replace_options = ['dwain', 'freedman', 'ian', 'waz', 'charch', 'kendall', 'sam', 'laghezza', 'ronis', 'berry']
49
  proj_source_options = ['Dwain', 'Freedman', 'Kickers', 'Defenses']
50
  proj_replace_options = ['dwain', 'freedman', 'kickers', 'defenses']
51
+ ros_source_options = ['Laghezza', 'Ronis', 'Dwain', 'Freedman']
52
+ ros_replace_options = ['laghezza', 'ronis', 'dwain', 'freedman']
53
 
54
 
55
  def grab_sr_fa(headers: dict) -> pd.DataFrame:
 
153
 
154
  return pd.DataFrame(row_data, columns=['FA_ID', 'SR_ID', 'First_Name', 'Prefer_First_Name', 'Last_Name', 'Name_Suffix', 'Position', 'Team'])
155
 
156
+ tab1, tab2, tab3, tab4, tab5 = st.tabs(['Rankings Update', 'Projections Update', 'SR ID Update', 'Game Model Update', 'NCAAF Script'])
157
 
158
  with tab1:
159
  with st.container():
160
+ col1, col2, col3, col4, col5 = st.columns([3, 3, 3, 3, 3])
161
 
162
  with col1:
163
  st.info("Update Seasonal Rankings")
 
177
  st.cache_data.clear()
178
  for key in st.session_state.keys():
179
  del st.session_state[key]
180
+
181
  with col2:
182
+ st.info("Update Rest of Season Rankings")
183
+ choose_ros_ranker = st.selectbox("Choose Ranker", name_options, key='rest_of_season_ranker')
184
+ choose_ros_ranker = api_replace_options[name_options.index(choose_ros_ranker)]
185
+ if st.button("Update Rest of Season Rankings", key='rest_of_season_rankings'):
186
+ response = requests.post(f"https://api.fantasylife.com/api/expert-rankings/v1/{choose_ros_ranker}/restofseason/update", headers=headers)
187
+ if response.status_code == 200:
188
+ st.write("Uploading!")
189
+ st.write(response.json())
190
+ st.cache_data.clear()
191
+ for key in st.session_state.keys():
192
+ del st.session_state[key]
193
+ else:
194
+ st.write("Error uploading rest of season rankings")
195
+ st.write(response.json())
196
+ st.cache_data.clear()
197
+ for key in st.session_state.keys():
198
+ del st.session_state[key]
199
+
200
+ with col3:
201
  st.info("Update Weekly Rankings")
202
  choose_weekly_ranker = st.selectbox("Choose Ranker", name_options, key='weekly_ranker')
203
  choose_weekly_ranker = api_replace_options[name_options.index(choose_weekly_ranker)]
 
216
  for key in st.session_state.keys():
217
  del st.session_state[key]
218
 
219
+ with col4:
220
  st.info("Update Seasonal Guillotine Rankings")
221
  choose_seasonal_guillotine_ranker = st.selectbox("Choose Ranker", name_options, key='seasonal_guillotine_ranker')
222
  choose_seasonal_guillotine_ranker = api_replace_options[name_options.index(choose_seasonal_guillotine_ranker)]
 
235
  for key in st.session_state.keys():
236
  del st.session_state[key]
237
 
238
+ with col5:
239
  st.info("Update Weekly Guillotine Rankings")
240
  choose_weekly_guillotine_ranker = st.selectbox("Choose Ranker", name_options, key='weekly_guillotine_ranker')
241
  choose_weekly_guillotine_ranker = api_replace_options[name_options.index(choose_weekly_guillotine_ranker)]
 
314
  st.cache_data.clear()
315
  for key in st.session_state.keys():
316
  del st.session_state[key]
317
+
318
+ with col3:
319
+ st.info("Update Rest of Season Projections")
320
+ choose_ros_type = st.selectbox("Choose Type", ros_source_options, key='rest_of_season_type')
321
+ choose_ros_type = ros_replace_options[ros_source_options.index(choose_ros_type)]
322
+ if st.button("Update Rest of Season Projections", key='rest_of_season_projections'):
323
+ response = requests.post(f"https://api.fantasylife.com/api/projections/v1/{choose_ros_type}/restofseason/update", headers=headers)
324
+ if response.status_code == 200:
325
+ st.write("Uploading!")
326
+ st.write(response.json())
327
+ st.cache_data.clear()
328
+ for key in st.session_state.keys():
329
+ del st.session_state[key]
330
+ else:
331
+ st.write("Error uploading rest of season projections")
332
+ st.write(response.json())
333
+ st.cache_data.clear()
334
+ for key in st.session_state.keys():
335
+ del st.session_state[key]
336
+ response = requests.post(f"https://api.fantasylife.com/api/projections/v1/aggregate/restofseason/update", headers=headers)
337
+ if response.status_code == 200:
338
+ st.write("Uploading Aggregate as well.")
339
+ else:
340
+ st.write("Error uploading rest of season aggregate projections")
341
+ st.write(response.json())
342
+ st.cache_data.clear()
343
+ for key in st.session_state.keys():
344
+ del st.session_state[key]
345
 
346
  with tab3:
347
  with st.container():
 
402
  st.info("We will add this functionality as soon as we have the endpoints to make it work!")
403
 
404
  with tab5:
 
 
 
405
  with st.container():
406
  col1, col2, col3 = st.columns([3, 3, 3])
407