Calculations
The calculations layer turns the typed sources.* tables into the analytical primitives that the marts ultimately consume. It splits into two families:
inplay_* — per match-minute
Section titled “inplay_* — per match-minute”| Model | Grain |
|---|---|
| inplay_1_by_minute | one row per (event, minute), forward/backward filled |
| inplay_2_score | one row per (event, minute) — derived score winner |
matches_* — per event
Section titled “matches_* — per event”Sequential pipeline; each step adds derived columns on top of the previous one.
| # | Model | Adds |
|---|---|---|
| 1 | matches_1_odds_prematch | first/last prematch odds |
| 2–4 | matches_2_odds_inplay_home, matches_3_odds_inplay_draw, matches_4_odds_inplay_away | per-side in-play odds extremes + window stats |
| 5 | matches_5_score | parsed scores + winner side |
| 6 | matches_6_team_stats_window | rolling 1-year team scoring/conceding averages |
| 7 | matches_7_league_stats_window | rolling 1-year league averages |
| 8 | matches_8_team_strength | attack/defence strength relative to league |
| 9 | matches_9_expected_goals | expected goals per side & total |
| 10 | matches_10_overperformance | actual minus expected goals |
| 11 | matches_11_probability | implied probabilities + bookmaker margin |
| 12 | matches_12_prob_win | Poisson-derived match-outcome probabilities |
| 13 | matches_13_prob_goal_diff | Skellam goal-difference distribution |
| 14 | matches_14_prob_goals_total | Poisson total-goals distribution |
| 15 | matches_15_strat_expected_value | EV per outcome |
| 16 | matches_16_strat_kelly_criterion | Kelly fraction per outcome |
| 17 | matches_17_strat_predicted | predicted winner + meta |
| 18 | matches_18_strat_bet | bet sizing, P/L and edge |
All models materialise as ClickHouse ReplacingMergeTree tables, partitioned by event_partition_key, built incrementally.