nesticot commited on
Commit
e867cee
·
verified ·
1 Parent(s): 1655d57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -2
app.py CHANGED
@@ -35,9 +35,11 @@ year_list = [2025]
35
 
36
 
37
  type_dict = {
38
- 'S':'Spring'}
 
39
 
40
- level_dict = {'1':'MLB' }
 
41
 
42
  function_dict={
43
  'velocity_kdes':'Velocity Distributions',
@@ -516,6 +518,24 @@ def server(input, output, session):
516
  @render.ui
517
  @reactive.event(input.player_button, input.year_input, input.level_input, input.type_input,ignore_none=False)
518
  def player_select_ui():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
519
  # Get the list of pitchers for the selected level and season
520
  df_pitcher_info = scrape.get_players(sport_id=int(input.level_input()), season=int(input.year_input()), game_type = [input.type_input()]).filter(
521
  (pl.col("position").is_in(['P','TWP']))|
 
35
 
36
 
37
  type_dict = {
38
+ 'S':'Spring',
39
+ 'E':'Exhibition'}}
40
 
41
+ level_dict = {'1':'MLB',
42
+ '21':'Prospects',}
43
 
44
  function_dict={
45
  'velocity_kdes':'Velocity Distributions',
 
518
  @render.ui
519
  @reactive.event(input.player_button, input.year_input, input.level_input, input.type_input,ignore_none=False)
520
  def player_select_ui():
521
+
522
+ # Get the list of pitchers for the selected level and season
523
+ if input.level_input() == '21':
524
+ year_input = int(input.year_input())
525
+ sport_id = int(input.level_input())
526
+ # player_input = int(input.pitcher_id())
527
+ start_date = str(input.date_id()[0])
528
+ end_date = str(input.date_id()[1])
529
+ game_type = [input.type_input()]
530
+ # Get game data
531
+
532
+
533
+ game_list = scrape.get_schedule(year_input=[year_input], sport_id=[sport_id], game_type=game_type).filter((pl.col('date').cast(pl.Utf8)>=start_date)&(pl.col('date').cast(pl.Utf8)<=end_date))['game_id']
534
+ data_list = scrape.get_data(game_list_input=game_list[:])
535
+ df_pitcher_info = scrape.get_data_df(data_list=data_list).filter((pl.col("start_speed") >= 50)).sort('pitcher_name')
536
+ pitcher_dict = dict(zip(df_pitcher_info['pitcher_id'], df_pitcher_info['pitcher_name']))
537
+ return ui.input_select("pitcher_id", "Select Pitcher",pitcher_dict, selectize=True)
538
+
539
  # Get the list of pitchers for the selected level and season
540
  df_pitcher_info = scrape.get_players(sport_id=int(input.level_input()), season=int(input.year_input()), game_type = [input.type_input()]).filter(
541
  (pl.col("position").is_in(['P','TWP']))|