Team Performance Comparison
Loading...
Team Performance Comparison
MLB Rivalry Tracker provides a daily comparison of three Major League Baseball teams—the Chicago Cubs, New York Mets, and Los Angeles Dodgers—by automatically pulling and processing the latest team and player statistics. Behind the scenes, it applies robust logic to ensure fair, meaningful comparisons and generates both individual leaderboards and overall team rankings.
Every day, a backend job fetches both team and individual player stats from MLB's public stats API. By running after each day's games, the app guarantees that all leaderboards and rankings reflect the most up-to-date performances.
To avoid skewed leaderboards caused by small sample sizes, the app enforces minimum-play thresholds before including any player in a given category:
The 3.1 PA/game rate matches MLB's season-long qualification (502 PA over 162 games) and scales by each team's actual games played so far, using `plateAppearances` and `gamesPlayed` from DynamoDB.
Because Shohei Ohtani is a two-way player, we handle him specially: only his hitting stats appear in the batter leaderboards—even though he also pitches, we exclude his pitching data to avoid double-counting him. All other players follow the normal role assignment logic.
Each team's position (1st, 2nd, or 3rd) in every stat category is converted into ranking points (1 = best, 2 = middle, 3 = worst). Ties share the same point value, and the next rank is bumped accordingly (e.g., two teams tie for 1st → both score 1, remaining team scores 3). Summing these points across all categories yields an overall team score.
After 3 PM Tokyo time each day, AWS Step Functions orchestrates Lambda functions that fetch MLB API data, compute thresholds (including the Ohtani logic), group and rank players, and write results to DynamoDB. Notifications report success or failure, and the front‑end automatically refreshes to show the latest comparisons.