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.
-.--) become nulls before any
number is cast.dim_game,
dim_player) hold the descriptions; thirteen fact tables
hold the measures.site/build_site.py reads the Gold tables with DuckDB,
with no Spark needed, and writes one data.json.public/ folder whenever
the main branch changes.| Board | Gold tables | Built 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.
run_pipeline.py runs the 36 jobs in order, each in
its own process, so one stuck job cannot take the next one down.Python, PySpark, Delta Lake, DuckDB, plain JavaScript and GitLab Pages. Data: the MLB Stats API and Baseball Savant, seasons 2024 to 2026.