Update app.py
Browse files
app.py
CHANGED
|
@@ -56,6 +56,11 @@ split_dict_hand = {'all':['L','R'],
|
|
| 56 |
'left':['L'],
|
| 57 |
'right':['R']}
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
from shiny import App, reactive, ui, render
|
| 60 |
from shiny.ui import h2, tags
|
| 61 |
|
|
@@ -65,8 +70,9 @@ app_ui = ui.page_fluid(
|
|
| 65 |
ui.panel_sidebar(
|
| 66 |
# Row for selecting season and level
|
| 67 |
ui.row(
|
| 68 |
-
ui.column(
|
| 69 |
-
ui.column(
|
|
|
|
| 70 |
),
|
| 71 |
# Row for the action button to get player list
|
| 72 |
ui.row(ui.input_action_button("player_button", "Get Player List", class_="btn-primary")),
|
|
@@ -119,7 +125,8 @@ def server(input, output, session):
|
|
| 119 |
season = year_input,
|
| 120 |
player_id = player_input,
|
| 121 |
start_date = start_date,
|
| 122 |
-
end_date = end_date
|
|
|
|
| 123 |
|
| 124 |
data_list = scrape.get_data(game_list_input = game_list[:])
|
| 125 |
df = (stuff_apply.stuff_apply(fe.feature_engineering(update.update(scrape.get_data_df(data_list = data_list).filter(
|
|
@@ -136,7 +143,7 @@ def server(input, output, session):
|
|
| 136 |
@reactive.event(input.player_button, ignore_none=False)
|
| 137 |
def player_select_ui():
|
| 138 |
# Get the list of pitchers for the selected level and season
|
| 139 |
-
df_pitcher_info = scrape.get_players(sport_id=int(input.level_input()), season=int(input.year_input())).filter(
|
| 140 |
pl.col("position").is_in(['P','TWP'])).sort("name")
|
| 141 |
|
| 142 |
# Create a dictionary of pitcher IDs and names
|
|
|
|
| 56 |
'left':['L'],
|
| 57 |
'right':['R']}
|
| 58 |
|
| 59 |
+
|
| 60 |
+
type_dict = {'R':'Regular Season',
|
| 61 |
+
'S':'Spring',
|
| 62 |
+
'P':'Playoffs' }
|
| 63 |
+
|
| 64 |
from shiny import App, reactive, ui, render
|
| 65 |
from shiny.ui import h2, tags
|
| 66 |
|
|
|
|
| 70 |
ui.panel_sidebar(
|
| 71 |
# Row for selecting season and level
|
| 72 |
ui.row(
|
| 73 |
+
ui.column(4, ui.input_select('year_input', 'Select Season', year_list, selected=2024)),
|
| 74 |
+
ui.column(4, ui.input_select('level_input', 'Select Level', level_dict)),
|
| 75 |
+
ui.column(4, ui.input_select('type_input', 'Select Type', type_dict,selected='R'))
|
| 76 |
),
|
| 77 |
# Row for the action button to get player list
|
| 78 |
ui.row(ui.input_action_button("player_button", "Get Player List", class_="btn-primary")),
|
|
|
|
| 125 |
season = year_input,
|
| 126 |
player_id = player_input,
|
| 127 |
start_date = start_date,
|
| 128 |
+
end_date = end_date,
|
| 129 |
+
game_type = [input.type_input()])
|
| 130 |
|
| 131 |
data_list = scrape.get_data(game_list_input = game_list[:])
|
| 132 |
df = (stuff_apply.stuff_apply(fe.feature_engineering(update.update(scrape.get_data_df(data_list = data_list).filter(
|
|
|
|
| 143 |
@reactive.event(input.player_button, ignore_none=False)
|
| 144 |
def player_select_ui():
|
| 145 |
# Get the list of pitchers for the selected level and season
|
| 146 |
+
df_pitcher_info = scrape.get_players(sport_id=int(input.level_input()), season=int(input.year_input()), game_type = [input.type_input()]).filter(
|
| 147 |
pl.col("position").is_in(['P','TWP'])).sort("name")
|
| 148 |
|
| 149 |
# Create a dictionary of pitcher IDs and names
|