A Python tool for generating detailed MLB game recaps with comprehensive pitch-by-pitch analysis.
This project fetches MLB game data and generates detailed game recaps that include:
- Inning-by-inning scoring summaries
- Comprehensive pitching analysis
- Strikeout details with pitch types, velocities, and counts
- Win/loss/save statistics
- Key game moments and player performances
This project began as an experiment in AI-assisted sports reporting. The journey started when I asked Claude to write a report on an MLB game. After the initial report, I added a specific requirement: I wanted to see the pitch type and velocity for all strikeout pitches thrown by each pitcher in the game.
Initially, Claude tried searching for this information but couldn't find these detailed pitch-level statistics. That's when I introduced Claude to the MLB API, which provides comprehensive play-by-play data including pitch types, velocities, and outcomes.
Claude then wrote code to dynamically call the MLB API and generate a detailed game report that included all the requested pitch information. The result was a comprehensive markdown report with pitch-by-pitch details for every strikeout.
To make this capability reproducible and useful beyond a single conversation, I asked Claude to transform the code into a standalone Python script. This script could reliably generate these detailed game reports by programmatically accessing the MLB API, parsing the data, and formatting it into readable markdown reports.
That's how this project was born - from a simple request for a game report to a tool that can generate detailed pitch-level analysis for any MLB game.
- Detailed Game Recaps: Generate comprehensive game summaries in markdown format
- Pitch Analysis: Track pitch types, velocities, and locations for key at-bats
- Strikeout Tracking: Document every strikeout with complete pitch sequence details
- Pitcher Statistics: Include win/loss records, saves, and performance metrics
See game_recap.md for an example of the detailed game recap format this tool generates.
- Python 3.12 or higher
requestslibrary for API calls
# Clone the repository
git clone https://github.com/jflam/pitch-analysis.git
cd pitch-analysis
# Install dependencies using uv
uv sync# Run the main script
uv run python main.pyThis project is currently in early development. The core functionality for fetching MLB data and generating game recaps is being implemented.
[License information to be added]
[Contributing guidelines to be added]