Update app.py
Browse files
app.py
CHANGED
|
@@ -18,7 +18,8 @@ df_year_old_group = pl.read_parquet('pitch_data_agg_2024.parquet')
|
|
| 18 |
pitcher_old_dict = dict(zip(df_year_old_group['pitcher_id'],df_year_old_group['pitcher_name']))
|
| 19 |
|
| 20 |
|
| 21 |
-
|
|
|
|
| 22 |
|
| 23 |
app_ui = ui.page_fluid(
|
| 24 |
ui.card(
|
|
@@ -30,8 +31,7 @@ app_ui = ui.page_fluid(
|
|
| 30 |
* Differences are calculated based on 2024 regular season data
|
| 31 |
* If 2024 data does not exist for pitcher, 2023 Data is used
|
| 32 |
* If no difference exists, the pitch is labelled as a new pitch"""),
|
| 33 |
-
|
| 34 |
-
|
| 35 |
ui.input_action_button(
|
| 36 |
"refresh",
|
| 37 |
"Refresh Data",
|
|
@@ -60,81 +60,82 @@ app_ui = ui.page_fluid(
|
|
| 60 |
),
|
| 61 |
ui.navset_tab(
|
| 62 |
ui.nav("All Pitches",
|
| 63 |
-
ui.row(
|
| 64 |
-
|
|
|
|
|
|
|
| 65 |
ui.column(2,
|
| 66 |
ui.div(
|
| 67 |
{"class": "input-group"},
|
| 68 |
ui.span("Pitches >=", class_="input-label"),
|
| 69 |
ui.input_numeric(id='pitches_all_min', label='', value=1, min=1, width="100px")
|
| 70 |
)
|
| 71 |
-
)
|
| 72 |
-
|
| 73 |
output_tabulator("table_all")
|
| 74 |
),
|
| 75 |
ui.nav("Compare Pitches",
|
| 76 |
-
|
| 77 |
ui.column(2,
|
| 78 |
ui.div(
|
| 79 |
{"class": "input-group"},
|
| 80 |
ui.span("Pitches >=", class_="input-label"),
|
| 81 |
ui.input_numeric(id='pitches_all_compare_min', label='', value=1, min=1, width="100px")
|
| 82 |
)
|
| 83 |
-
)
|
| 84 |
-
|
| 85 |
output_tabulator("table_all_compare")
|
| 86 |
),
|
| 87 |
ui.nav("Daily Pitches",
|
| 88 |
-
|
| 89 |
ui.column(2,
|
| 90 |
ui.div(
|
| 91 |
{"class": "input-group"},
|
| 92 |
ui.span("Pitches >=", class_="input-label"),
|
| 93 |
ui.input_numeric(id='pitches_daily_min', label='', value=1, min=1, width="100px")
|
| 94 |
)
|
| 95 |
-
)
|
| 96 |
-
|
| 97 |
-
|
| 98 |
output_tabulator("table_daily")
|
| 99 |
),
|
| 100 |
ui.nav("tjStuff+",
|
| 101 |
-
|
| 102 |
-
ui.row(
|
| 103 |
ui.column(2,
|
| 104 |
ui.div(
|
| 105 |
{"class": "input-group"},
|
| 106 |
ui.span("Pitches >=", class_="input-label"),
|
| 107 |
ui.input_numeric(id='pitches_tjstuff_min', label='', value=1, min=1, width="100px")
|
| 108 |
)
|
| 109 |
-
)
|
|
|
|
| 110 |
output_tabulator("table_tjstuff")
|
| 111 |
),
|
| 112 |
ui.nav("tjStuff+ Summary",
|
| 113 |
-
ui.row(
|
| 114 |
-
|
|
|
|
|
|
|
| 115 |
ui.column(2,
|
| 116 |
ui.div(
|
| 117 |
{"class": "input-group"},
|
| 118 |
ui.span("Pitches >=", class_="input-label"),
|
| 119 |
ui.input_numeric(id='pitches_tjsumm_min', label='', value=1, min=1, width="100px")
|
| 120 |
)
|
| 121 |
-
)
|
| 122 |
-
|
| 123 |
-
output_tabulator("table_stuff_all")
|
| 124 |
-
|
| 125 |
),
|
|
|
|
|
|
|
| 126 |
ui.nav("tjStuff+ Team",
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
)),
|
| 131 |
output_tabulator("table_tjstuff_team")
|
| 132 |
-
)
|
| 133 |
-
|
| 134 |
)
|
| 135 |
)
|
| 136 |
)
|
| 137 |
|
|
|
|
| 138 |
def server(input, output, session):
|
| 139 |
|
| 140 |
|
|
|
|
| 18 |
pitcher_old_dict = dict(zip(df_year_old_group['pitcher_id'],df_year_old_group['pitcher_name']))
|
| 19 |
|
| 20 |
|
| 21 |
+
from shiny import ui
|
| 22 |
+
from shinywidgets import output_tabulator
|
| 23 |
|
| 24 |
app_ui = ui.page_fluid(
|
| 25 |
ui.card(
|
|
|
|
| 31 |
* Differences are calculated based on 2024 regular season data
|
| 32 |
* If 2024 data does not exist for pitcher, 2023 Data is used
|
| 33 |
* If no difference exists, the pitch is labelled as a new pitch"""),
|
| 34 |
+
|
|
|
|
| 35 |
ui.input_action_button(
|
| 36 |
"refresh",
|
| 37 |
"Refresh Data",
|
|
|
|
| 60 |
),
|
| 61 |
ui.navset_tab(
|
| 62 |
ui.nav("All Pitches",
|
| 63 |
+
ui.row(
|
| 64 |
+
ui.column(1,
|
| 65 |
+
ui.download_button("download_all", "Download Data", class_="btn-sm mb-3")
|
| 66 |
+
),
|
| 67 |
ui.column(2,
|
| 68 |
ui.div(
|
| 69 |
{"class": "input-group"},
|
| 70 |
ui.span("Pitches >=", class_="input-label"),
|
| 71 |
ui.input_numeric(id='pitches_all_min', label='', value=1, min=1, width="100px")
|
| 72 |
)
|
| 73 |
+
)
|
| 74 |
+
),
|
| 75 |
output_tabulator("table_all")
|
| 76 |
),
|
| 77 |
ui.nav("Compare Pitches",
|
| 78 |
+
ui.row(
|
| 79 |
ui.column(2,
|
| 80 |
ui.div(
|
| 81 |
{"class": "input-group"},
|
| 82 |
ui.span("Pitches >=", class_="input-label"),
|
| 83 |
ui.input_numeric(id='pitches_all_compare_min', label='', value=1, min=1, width="100px")
|
| 84 |
)
|
| 85 |
+
)
|
| 86 |
+
),
|
| 87 |
output_tabulator("table_all_compare")
|
| 88 |
),
|
| 89 |
ui.nav("Daily Pitches",
|
| 90 |
+
ui.row(
|
| 91 |
ui.column(2,
|
| 92 |
ui.div(
|
| 93 |
{"class": "input-group"},
|
| 94 |
ui.span("Pitches >=", class_="input-label"),
|
| 95 |
ui.input_numeric(id='pitches_daily_min', label='', value=1, min=1, width="100px")
|
| 96 |
)
|
| 97 |
+
)
|
| 98 |
+
),
|
|
|
|
| 99 |
output_tabulator("table_daily")
|
| 100 |
),
|
| 101 |
ui.nav("tjStuff+",
|
| 102 |
+
ui.row(
|
|
|
|
| 103 |
ui.column(2,
|
| 104 |
ui.div(
|
| 105 |
{"class": "input-group"},
|
| 106 |
ui.span("Pitches >=", class_="input-label"),
|
| 107 |
ui.input_numeric(id='pitches_tjstuff_min', label='', value=1, min=1, width="100px")
|
| 108 |
)
|
| 109 |
+
)
|
| 110 |
+
),
|
| 111 |
output_tabulator("table_tjstuff")
|
| 112 |
),
|
| 113 |
ui.nav("tjStuff+ Summary",
|
| 114 |
+
ui.row(
|
| 115 |
+
ui.column(1,
|
| 116 |
+
ui.download_button("download_tjsumm", "Download Data", class_="btn-sm mb-3")
|
| 117 |
+
),
|
| 118 |
ui.column(2,
|
| 119 |
ui.div(
|
| 120 |
{"class": "input-group"},
|
| 121 |
ui.span("Pitches >=", class_="input-label"),
|
| 122 |
ui.input_numeric(id='pitches_tjsumm_min', label='', value=1, min=1, width="100px")
|
| 123 |
)
|
| 124 |
+
)
|
|
|
|
|
|
|
|
|
|
| 125 |
),
|
| 126 |
+
output_tabulator("table_stuff_all")
|
| 127 |
+
),
|
| 128 |
ui.nav("tjStuff+ Team",
|
| 129 |
+
ui.row(
|
| 130 |
+
ui.column(2) # No input here, just space for future use
|
| 131 |
+
),
|
|
|
|
| 132 |
output_tabulator("table_tjstuff_team")
|
| 133 |
+
)
|
|
|
|
| 134 |
)
|
| 135 |
)
|
| 136 |
)
|
| 137 |
|
| 138 |
+
|
| 139 |
def server(input, output, session):
|
| 140 |
|
| 141 |
|