Herc commited on
Commit
d7215bf
·
1 Parent(s): e6e1696

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -23
app.py CHANGED
@@ -219,24 +219,23 @@ st.set_option('deprecation.showPyplotGlobalUse', False)
219
  # UI for CSV File Uploader
220
  uploaded_file = st.file_uploader("Choose a CSV file", type=['csv'])
221
 
 
 
 
 
222
  # Load the Uploaded CSV File
223
  if uploaded_file is not None:
224
- df = pd.read_csv(uploaded_file)
225
  st.write('Uploaded CSV file:')
226
- st.write(df)
227
-
228
- # Generate available dates here
229
- start_date = date(2022, 11, 6)
230
- available_dates = generate_available_dates(start_date)
231
 
232
- # Generate Schedule using Uploaded Data
233
- if st.button("Generate Schedule"):
234
- if uploaded_file is not None:
235
- st.session_state.schedule_df = generate_schedule_from_data(df, available_dates) # pass available_dates as argument
236
  st.write('Generated Schedule:')
237
  st.write(st.session_state.schedule_df)
238
- else:
239
- st.warning("Please upload a CSV file to proceed.")
240
 
241
 
242
  # Initialize session state for schedule_df and st.session_state.historical_data
@@ -300,30 +299,28 @@ else:
300
 
301
  if analytics_option == "Team Workload Analysis":
302
  st.subheader("Historical Data")
303
- st.pyplot(team_workload_analysis(st.session_state.historical_data, df))
304
  st.subheader("Current Data")
305
- st.pyplot(team_workload_analysis(st.session_state.schedule_df, df))
306
-
307
 
308
  elif analytics_option == "Match Distribution":
309
  st.subheader("Historical Data")
310
- st.pyplot(match_distribution(st.session_state.historical_data, df))
311
  st.subheader("Current Data")
312
- st.pyplot(match_distribution(st.session_state.schedule_df, df))
313
-
314
 
315
  elif analytics_option == "Inter-Conference Match Analysis":
316
  st.subheader("Historical Data")
317
- st.pyplot(inter_conference_analysis(st.session_state.historical_data, df))
318
  st.subheader("Current Data")
319
- st.pyplot(inter_conference_analysis(st.session_state.schedule_df, df))
320
-
321
 
322
  elif analytics_option == "Commissioner Analytics":
323
  st.subheader("Historical Data")
324
- st.pyplot(commissioner_analytics(st.session_state.historical_data, df, commissioners))
325
  st.subheader("Current Data")
326
- st.pyplot(commissioner_analytics(st.session_state.schedule_df, df, commissioners))
 
327
 
328
  else:
329
  st.warning("Please generate the schedule first before viewing analytics.")
 
219
  # UI for CSV File Uploader
220
  uploaded_file = st.file_uploader("Choose a CSV file", type=['csv'])
221
 
222
+ start_date = date(2022, 11, 6)
223
+ available_dates = generate_available_dates(start_date)
224
+
225
+
226
  # Load the Uploaded CSV File
227
  if uploaded_file is not None:
228
+ st.session_state.df = pd.read_csv(uploaded_file)
229
  st.write('Uploaded CSV file:')
230
+ st.write(st.session_state.df)
 
 
 
 
231
 
232
+ # Generate Schedule using Uploaded Data
233
+ if st.button("Generate Schedule"):
234
+ st.session_state.schedule_df = generate_schedule_from_data(st.session_state.df, available_dates)
 
235
  st.write('Generated Schedule:')
236
  st.write(st.session_state.schedule_df)
237
+ else:
238
+ st.warning("Please upload a CSV file to proceed.")
239
 
240
 
241
  # Initialize session state for schedule_df and st.session_state.historical_data
 
299
 
300
  if analytics_option == "Team Workload Analysis":
301
  st.subheader("Historical Data")
302
+ st.pyplot(team_workload_analysis(st.session_state.historical_data, st.session_state.df))
303
  st.subheader("Current Data")
304
+ st.pyplot(team_workload_analysis(st.session_state.schedule_df, st.session_state.df))
 
305
 
306
  elif analytics_option == "Match Distribution":
307
  st.subheader("Historical Data")
308
+ st.pyplot(match_distribution(st.session_state.historical_data, st.session_state.df))
309
  st.subheader("Current Data")
310
+ st.pyplot(match_distribution(st.session_state.schedule_df, st.session_state.df))
 
311
 
312
  elif analytics_option == "Inter-Conference Match Analysis":
313
  st.subheader("Historical Data")
314
+ st.pyplot(inter_conference_analysis(st.session_state.historical_data, st.session_state.df))
315
  st.subheader("Current Data")
316
+ st.pyplot(inter_conference_analysis(st.session_state.schedule_df, st.session_state.df))
 
317
 
318
  elif analytics_option == "Commissioner Analytics":
319
  st.subheader("Historical Data")
320
+ st.pyplot(commissioner_analytics(st.session_state.historical_data, st.session_state.df, commissioners))
321
  st.subheader("Current Data")
322
+ st.pyplot(commissioner_analytics(st.session_state.schedule_df, st.session_state.df, commissioners))
323
+
324
 
325
  else:
326
  st.warning("Please generate the schedule first before viewing analytics.")