Skip to content

Calculations

The calculations layer turns the typed sources.* tables into the analytical primitives that the marts ultimately consume. It splits into two families:

ModelGrain
inplay_1_by_minuteone row per (event, minute), forward/backward filled
inplay_2_scoreone row per (event, minute) — derived score winner

Sequential pipeline; each step adds derived columns on top of the previous one.

#ModelAdds
1matches_1_odds_prematchfirst/last prematch odds
2–4matches_2_odds_inplay_home, matches_3_odds_inplay_draw, matches_4_odds_inplay_awayper-side in-play odds extremes + window stats
5matches_5_scoreparsed scores + winner side
6matches_6_team_stats_windowrolling 1-year team scoring/conceding averages
7matches_7_league_stats_windowrolling 1-year league averages
8matches_8_team_strengthattack/defence strength relative to league
9matches_9_expected_goalsexpected goals per side & total
10matches_10_overperformanceactual minus expected goals
11matches_11_probabilityimplied probabilities + bookmaker margin
12matches_12_prob_winPoisson-derived match-outcome probabilities
13matches_13_prob_goal_diffSkellam goal-difference distribution
14matches_14_prob_goals_totalPoisson total-goals distribution
15matches_15_strat_expected_valueEV per outcome
16matches_16_strat_kelly_criterionKelly fraction per outcome
17matches_17_strat_predictedpredicted winner + meta
18matches_18_strat_betbet sizing, P/L and edge

All models materialise as ClickHouse ReplacingMergeTree tables, partitioned by event_partition_key, built incrementally.