← Sinto Ling's projects View the repo on GitLab

⚾ MLB Medallion — How it works

← Back to the leaderboards

Public baseball data goes through three layers — Bronze, Silver and Gold — before it reaches the leaderboards. Each layer has one job, so a problem can be traced to the step that caused it.

Pipeline runner drives Bronze, Silver and Gold: one process per job, a time limit, retries, and a check that each table landed.

The layers

Bronze — keep what the source sent

Silver — make it clean and typed

Gold — shape it for questions

Site — a frozen snapshot

Where each board comes from

BoardGold tablesBuilt from
Expected vs actual fact_expected_performance Savant expected stats, joined to Stats API batting
Batter vs pitcher matchups fact_batter_pitcher_matchup, dim_player Statcast pitches; Stats API players for names
Fielding fact_fielding_performance, fact_outs_above_average, fact_catcher_framing, fact_arm_strength Stats API fielding stats; three Savant leaderboards
Batter contact fact_batter_contact, dim_player Statcast pitches
Hottest months fact_batter_monthly, dim_player; fact_game_score and dim_game for the team record Statcast pitches; Stats API schedules and linescores
Runs by inning fact_inning_scoring Stats API linescores, one row per inning

Team labels on the batting boards come from the pitches too: a batter's team is the away side in the top of an inning and the home side in the bottom. That covers players the Stats API leaderboard leaves out, and mid-season trades.

Three Gold tables are built but not on a board yet: fact_batting_performance, fact_pitcher_arsenal and fact_batter_pitch_type.

Running it

Built with

Python, PySpark, Delta Lake, DuckDB, plain JavaScript and GitLab Pages. Data: the MLB Stats API and Baseball Savant, seasons 2024 to 2026.