Hello Blue Jays team, thank you for taking the time to review my project.
I chose to do Project 3 – Batted Ball Data Visualizations.
I utilized R and an R package, Shiny, to create a web application to explore batted ball data.
The application is hosted on an AWS EC2 server and is using RDS to run a MySQL database.
Application is accessible at: https://bluejays.daninglis.com/
Code is accessible at: https://github.com/DanInglis/BlueJaysProject
Note: Initial load may take ~30 seconds. Subsequent queries will be substantially quicker.
This is the main function of the application.
These menus enable batter & pitcher selection. Specific players/teams can be selected or selecting "All" will update the visualizations with all data available.
Note: these image URLs currently return a placeholder image due to ongoing MLB labor negotiations
This option only updates the plot, it will not filter the data.
These filters will restrict data to a timeframe or to specific launch conditions.
- As sample data is from 2017, many of the preset timeframe options will return no data
- Use the "Custom" option to edit the start and end dates
This dropdown menu contains 3 addition data visualizations
- Pitch Location
- Shows the exact location and pitch type
- Pitch Location Heat Map
- Renders a heat map of the pitch data
- Spray Chart Heat Map
- Renders a heat map of the batted ball location data
This tab provides access to the raw data stored in the database.
While the application is accessible via https://bluejays.daninglis.com/, if you wish to run the application locally there are a few requirements.
A database to store the batted ball data is needed. While I utilized a MySQL database hosted on AWS RDS this is not required.
Database table definitions are accessible in BuildDB.sql
Note: In this repository my RDS connection settings have been redacted in the code for privacy
uploadBattedBalls.py contians a script to read the batted ball data from ALWestBattedBalls2017.csv and uploads it to the database (assumes a database has already been created)
Usage: python uploadBattedBalls.py
Tested with Python version 3.8.7
Requirements:
- pandas
- mysql
Requirements:
- R
- R Studio
- Additional R Libraries:
cowplot, DT, ggplot2, grid, gtools, lubridate, magick, plotly, RMariaDB, rsvg, shiny, shinyBS, shinybusy, shinydashboard, shinyjs, shinyWidgets