- LineupPitch: both XIs on a vertical pitch at FotMob's per-player
formation coordinates — shirt numbers, live ratings, goal badges,
formation + coach labels. Substitutes take over the outgoing player's
slot (paired through ESPN's 'X replaces Y' commentary with a unique
same-minute fallback — the sources romanize names differently), with
a subbed-off strip below; the page's live refetch keeps it current
through the match. Falls back to the list view (and hides predicted
pre-kickoff XIs) when no confirmed lineup is captured.
- /api/match-rich now serves the trimmed FotMob lineup (only complete,
fully-positioned XIs)
- Fix: vs-Market label box was too narrow — the probability bar covered
the end of 'DraftKings'
- Timeline spine no longer runs past the kick-off/full-time pills
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Design handoff steps 4-5:
- LivePage: headline live-match hero (gradient card, live ring, smallcaps
stage/venue + minute, big mono score, 3-segment in-play win-prob bar);
favorite team's live match takes the hero slot
- MatchCard: played matches as stacked team rows with the beaten side
dimmed; scheduled matches as a centered 'vs' pairing (model hint and
venue stay)
- GroupTable: Form column — tiny W/D/L bars (accent/gold/loss) computed
from finished group matches
- BracketPage: one round-selector layout on every screen size (cards in
a 2-col grid, losers dimmed), gold 'Projected champion' banner on the
Final view; what-if mode, advance bars, R32 and the third-place
play-off all unchanged
- Predict title race: leader bar, rank and percentage in gold
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Implements steps 1-3 of the Claude Design handoff:
- MatchTimeline: vertical center spine (home left, away right, minute
pills on the rail), goal cards with parsed scorer/assist/running
score, sub and booking chips, synthetic kick-off/half-time/full-time
dividers; single left rail under the sm breakpoint
- matchEvents: pure ESPN commentary parser (scorer, assist, penalty,
own goal, sub in/out, embedded score) with tests on real feed shapes
- Hero scoreboard: panel gradient + accent glow, smallcaps meta, mono
score, stat chips (xG / POTM / attendance / referee; possession and
shots while live); weather line stays for upcoming matches
- Sticky Summary/Timeline/Stats/Lineups sub-nav; all existing cards
re-bucketed with no feature loss (in-play win prob, swing chart,
xG race, shot map, momentum, odds movement, form, H2H, lineups)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The captured FotMob/FIFA/Open-Meteo data becomes visible. Match pages
now carry: a cumulative xG race with goal dots and team totals, a full-
pitch shot map (each side attacking its own end, dots sized by xG,
goals filled), the 90-minute attack-momentum chart, player-of-the-match
with rating, the official info line (stadium · attendance · referee),
and a kickoff-hour weather line for upcoming matches with an altitude
chip above 1,000m. All hand-rolled SVG on the existing token
conventions — design-ready for the upcoming visual overhaul. EN/DE
included, with an honest 'xG and ratings are FotMob estimates' note.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GET /api/match-rich/:num projects the captured provider data for the
match center: every shot with pitch coords and xG oriented to
home/away (FotMob payloads now carry team ids, v2 + settle-versioned
refetch), team xG sums, the momentum curve, player of the match with
rating, FIFA's official attendance/stadium/referee, and kickoff-hour
weather. Verified on real data: South Korea 2.31-0.83 Czechia on 22
oriented shots, POTM Hwang 8.9, referee Amin Mohamed Omar.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The first heal attempt missed both matches: a 02:00 UTC kickoff files
under the PREVIOUS day in ESPN's ?dates= param (ET-based), and the
backfill skipped today's UTC date entirely. Now any started-but-
forgotten fixture triggers fetches for its UTC date and the day
before, covering the ET offset in both directions.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The persistence table shipped empty just as ESPN's default scoreboard
window rolled past matchday 1 — prod forgot both results. Rather than
patching the DB by hand, boot now re-fetches the date-scoped
scoreboard for any past day whose fixtures still look scheduled and
merges + persists the results. Heals fresh databases and any future
data loss the same way.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Four new feeds, all verified against real tournament matches:
- FotMob (unofficial, works from the VPS again): per-shot xG/xGOT with
pitch coords, team xG, player ratings, POTM, momentum, attacking
zones — trimmed payloads (~87KB/match) on a gentle 90s-live/30m-idle
cadence. Capture-first: this source could lock again any day.
- FIFA official v3: confirmed lineups with player IDs, typed XY event
timelines (80 events for the opener), attendance + named referees,
tactics — id-mapped via the calendar, hot while live.
- Open-Meteo: kickoff-hour weather per venue from a build-time geocoded
venues.json (with elevation — Azteca 2,240m); fetched in the enrich
loop inside the 48h horizon.
- DraftKings scorer props (first/last/anytime goalscorer per athlete)
via ESPN's core propBets, insert-if-changed line history, athlete
names resolved through a 30-day cache.
Also fixes a real resilience gap found along the way: fixture results
now persist in SQLite and restore at boot — previously a restart after
ESPN's scoreboard window moved on would silently forget a match day
(standings, model and scoreboard would all regress).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Six-source reconnaissance from both vantage points found the v3-era
blockers gone: FotMob serves full xG/shotmaps/player-ratings from the
VPS with no signed header, and FIFA's official v3 API (lineups with
player IDs + headshots, XY timelines, attendance) is open too. The
plan: capture-first ingestion (FotMob/FIFA/ESPN-deep/weather), four
CV-gated model experiments (xG-informed Team-DC, lineup-aware refresh,
bias-corrected in-play, a scorer model benchmarked against DraftKings
props), and a feature tier built on it — with explicit design-handoff
slots for the visual overhaul arriving from Claude Design.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A restart during a live match sat behind the multi-minute odds sweep
before the first scoreboard poll. The live loop now starts immediately
after fixture mapping; odds/backfill/enrich follow on their own
rate-limit keys.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
All twelve third-placed teams ranked by points/GD/goals under the
group grid — top 8 highlighted (they reach the Round of 32), the rest
dimmed. Appears once group play has started.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The boot refit fires before live state is restored, so restarts lost
this tournament's matches from the fit until the nightly timer. A
one-shot follow-up at +5 minutes closes the gap.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fully progressive: without VAPID keys in the environment the API says
404, the bell never renders, and the service worker addition (a push
handler via workbox importScripts — no SW strategy change) is inert.
With keys: a bell on each team page requests permission, subscribes
(one team per device) and the server diffs fixture states on every
broadcast to push Kickoff / Goal / Full time to that team's followers.
Dead endpoints (404/410) self-clean. Round-trip verified locally with
dev VAPID keys; disabled mode verified too.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ESPN's keyEvents carry participants[].athlete for goals — no text
parsing needed. The normalizer now extracts scorer/scoring/shootout
(payload versioned, with a boot backfill that re-stores summaries
saved by the old normalizer), /api/goldenboot aggregates per-player
goals (own goals and shootout kicks excluded), and the Teams page
leads with the top-10 race. Verified against tonight's real goals.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Story, Methodology, Data and Compare load as their own chunks via
lazyRouteComponent (prefetched on intent) — the main bundle drops ~10%
and hot paths (Live, match, team) stay eager.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The model/market split stays readable when the numeric triple is
hidden on narrow screens (title + aria-label on the bar row).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Crawler-visible <title> + og:title/description are injected into the
SPA shell server-side: match links carry the score or the model's
probability split, team links the current title odds — honest framing
included. Plain shell for every other route.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The previous commit referenced a non-existent generatedAt and slipped
past a grep-based gate (grep exit 0 on finding the error). Build gate
checked by exit code from here on.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
When the live connection drops, a slim notice under the header shows
the timestamp of the last snapshot — the page keeps working from it.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Methodology page lists each recompute (the finished match that
triggered it) with the biggest title-odds move it caused — the model's
thinking made visible, feeding the openness story.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
/compare (also in the mobile More sheet): pick any two of the 48 —
defaults to the top title favourites — and get the model's
neutral-ground matchup plus the full head-to-head from the historical
archive (wins/draws/goals and the last six meetings).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A compact card up top: yesterday's scores at a glance and the teams
whose championship odds moved most over the last day (from the model's
recompute history), with up/down trends linking through to team pages.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A keyboard-first palette (plus a header button) that jumps to any team
page or match page — arrow keys, enter, esc; flags and kickoff days in
the results. Pure client, searches the snapshot already in memory.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
buildRatings samples each WC team's rating along the full walk (yearly
historically, monthly since 2022) into elohistory.json (~72KB, 48
teams). Team pages plot it as a clean SVG line with year and rating
gridlines — Germany's century, 1908 → today, in one glance.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The scoreboard gains a Biggest surprises card — finished matches whose
actual outcome the frozen model priced under 30%, sorted by shock
value, each linking to its match page. Pure client derivation from
data the scoreboard already had.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The CV harness gained a calibration experiment: per-outcome isotonic
maps (pool-adjacent-violators) fit walk-forward on the five folds and
judged leave-one-fold-out against a pre-registered bar. It cleared it:
LOFO ECE improves 16% (0.0146 → 0.0122) with RPS slightly better too
(0.1724 → 0.1722). The final maps (fit on all folds) are committed as
a research artifact, embedded into ratings.json by buildRatings when
the shipped config matches, and applied in matchMatrix by scaling the
score-matrix outcome regions — scorelines, Monte Carlo and displayed
probabilities all stay mutually consistent. Without the field, output
is bit-identical (golden tests).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Once a group reaches its closing stretch (≤3 open matches), every
remaining win/draw/loss combination is enumerated and ranked with the
real tiebreaker logic. Under each table: Top 2 secured / Top 2 with a
win / Still possible (n of N outcomes) / Can't reach the top 2 — with
an honest footnote that tight cases hinge on goal difference and third
place runs through the cross-group best-thirds race. Pure, tested
enumeration in src/lib/scenarios.ts.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A star on the team page (localStorage, no accounts) pins that team's
next or running match in a My team section at the top of the Live tab.
EN/DE strings + aria-pressed on the toggle.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A wand toggle turns the bracket interactive: tap a side to send that
team through; W/L placeholders resolve down the tree (pure, tested
logic in src/lib/whatif.ts). Real results always override picks; picks
that stop making sense after an upstream change are pruned. Each open
pairing shows the model's advance probability (ratings.json fetched
lazily), and once your final resolves, a summary banner names your
champion with the model's chance of exactly that run. EN/DE included.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The odds history we have been capturing every 3h finally gets a face:
de-vigged DraftKings probabilities drift as solid lines toward
kickoff, with the model's numbers as dashed references — the honest
benchmark framing, right on the match page. Renders only when at least
two pre-kickoff lines exist. EN/DE copy included.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
While a match runs, every poll records the in-play model probability
per game state (insert-if-new on minute+score) into inplay_history.
The match page draws it as a stacked area chart — home fills from the
bottom, away from the top, the gap is the draw — with minute ticks and
a 50% guide. Shows live (under the win-probability bar) and after full
time as its own card. EN/DE strings included.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Five two-year walk-forward folds (2014-2024), each with its own
pre-fold parameter fit; selection by mean fold RPS; staged greedy over
Team-DC decay/shrinkage/weight, fast-Elo blend, form multiplier, and
new Elo-walk axes (home advantage, K scale); untouched 2024-26 final
test. Result: the shipped v4 config holds — the staged champion gained
0.0003, under the 0.0005 ship bar, and the final test agrees. v4 is no
longer a one-window result.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The first prod snapshot landed as a 0-byte file with a stale journal:
SQLite needs byte-range locking on the VACUUM INTO destination, which
the CIFS storage box refuses. Now: vacuum into a local temp file, then
a plain sequential copy to the archive (always CIFS-safe), cleaning up
the temp and any leftover journal.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The 'external drive' turned out to be a CIFS-mounted Hetzner storage
box — SQLite cannot run on a network mount (WAL shared memory and
locking break), and the live DB is only ~7MB anyway. So: the hot
database stays on the local volume, and a nightly VACUUM INTO snapshot
(transactionally consistent, a plain sequential file write — perfect
for CIFS) lands in /data/archive, which compose binds to the storage
box via HOST_ARCHIVE_DIR. 14-day retention, plus a snapshot at boot.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
BACKTEST_QUICK=1 skips the hyperparameter grid and scores only the
shipped + previous configs — same test metrics, a fraction of the
build time on the 1-CPU VPS. The full grid search stays a local
activity. Verified byte-level: quick output matches the grid run.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Bracket on phones: a segmented round picker with full-width cards
replaces the 1040px sideways scroll; desktop keeps the columns.
- Odds table: sticky team column; the three lowest-value columns hide
on phones so Team/QF/SF/Final/Champion fit without scrolling.
- Bottom nav: 4 primary tabs + a More sheet (vs Markt, Modell, Story,
Teams, Daten, plus language & theme toggles) — 7 tabs were cramped.
- Emoji → icons: timeline events use a ball icon, card-shaped color
chips and substitution arrows; unknown-team fallbacks use a shield.
Country-flag emojis stay (intentional).
- Readability: bigger scores on match cards, minimum text sizes bumped,
probability-number triple hides on the narrowest screens (the bar
carries the information).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The hardcoded 8-match cap is gone: all upcoming fixtures with a
prediction render in day-grouped sections (every match the model can
predict — slots resolve as the bracket fills). Filter chips narrow to
the next 3 days (default) or everything, and group stage vs knockout.
Match count shown in the heading.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Upcoming fixtures now appear grouped under localized day headers
(Coming up · Mon 15 Jun) regardless of whether something is on today —
not just when the day was empty. Pure grouping logic lives in
src/lib/fixtures.ts with day-boundary tests; prediction chips on the
cards come for free from MatchCard.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A tiny typed i18n layer (no library): en.ts is the single source of UI
copy and the clarity rewrite lives there — shorter sentences, plain
words, the dense Methodology/Scoreboard copy untangled. de.ts mirrors
its shape exactly, enforced by the compiler, with placeholder parity
covered by tests. Every page now reads from the dictionary via useT();
dates flip locale through useFormat() (en-GB/de-DE); raw server values
(status, outcome, stage) map through total records.
The header gains an EN/DE toggle (persisted, defaults from the
browser language); <html lang> stays in sync.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
HOST_DATA_DIR in .env can now point /data at a host path (the 1TB
external drive) instead of the named volume, so odds history, caches
and snapshots stop eating the 128GB root disk. A daily prune drops
cache entries stale for over a week and ingest-log rows older than 14
days — faster polling no longer means unbounded DB growth.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Validated on the strict 2018-2022 window and confirmed on the untouched
2022-2026 test set (RPS 0.1703 vs 0.1721 over 4,448 matches):
- the Elo member now blends 30% of a 3x-faster Elo walk, so recent
results move ratings much harder
- ensemble weight shifts from 75/25 toward Elo to 45/55 toward the
time-decayed Team-DC member — the recent-form model now leads
- Team-DC refits nightly (and at boot) on the 15-year window plus every
finished 2026 match, via a new committed-at-build dcTrain.json
(server-only, excluded from the PWA precache)
- a recent-form goal multiplier was also tested and did NOT validate;
it ships disabled, and backtest.json records the whole decision
buildBacktest.ts grew the experiment harness: wider xi/k grids, the
fast-Elo and form variants, a pre-registered ship bar (>=0.0005
validation RPS), and a 7-day refit-cadence check. Older ratings.json
files still work — all new model fields are optional with golden
regression coverage.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The live staleness bug: liveTick refetched ESPN summaries every 20s but
the cache TTL was 5 minutes, so in-play stats/timeline barely moved.
Summaries now take a live flag (15s TTL in play), the scoreboard TTL
drops 20s->5s, and polling gets three tiers (8s in-play / 20s near
kickoff / 10m idle) via a pure, tested cadence module. The
football-data fallback is throttled to one attempt per 15s so the 8s
cadence can never breach its 10 req/min cap. Enrichment runs every 5m
(was 20m); client refetch intervals tighten to 10s (live match page)
and 30s (scoreboard).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- scripts/processStatsbomb.ts: one pass over the 17GB StatsBomb lake (4,235
matches) -> lakestats.json (12.82GB events / 14.9M events / 6,919 players),
scorestate.json (goal-rate multipliers by game state — shipped as an insight,
NOT wired into in-play: the raw effect is selection-biased toward stronger
teams and would distort a calibrated model), fingerprints.json (40/48 nations'
shots/xG/set-piece share from real event data). Artifacts committed; raw lake
stays local (gitignored).
- /data page + /api/data/stats: the gigabytes made visible — lake counters,
historical archive, live-collection counts (odds lines, frozen forecasts,
enrichment), per-source health with freshness. Footer links.
- Term component: plain-language glossary tooltips (RPS, Brier, ECE, Elo, xG,
de-vig, ensemble) attached where metrics appear.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- prediction_snapshots: model + de-vigged market frozen ≤15min pre-kickoff
(or at first sight of a live match, flagged 'late' and excluded from totals).
- src/lib/model/scoring.ts: ONE shared RPS/Brier/log-loss implementation for
the backtest and the live scoreboard.
- /api/scoreboard + /scoreboard page: per-match model-vs-bookmaker bars, RPS
for both after FT, 'closer' badges, running head-to-head with honest rules
printed (small-sample caveat included). Nav: 'vs Market'.
- Methodology page now shows the three-way split + ensemble bake-off variants.
- Verified end-to-end with a simulated match: snapshot froze model 80.7% and
DraftKings 67.0% (de-vig correct), both scored at FT, late-flag honored.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- src/lib/model/teamDc.ts: per-team attack/defence Dixon-Coles via weighted MLE
(Maher iterations), exponential time-decay, shrinkage for thin histories,
learned home multiplier; log-pool of score matrices. 7 vitest cases.
- buildBacktest.ts rewritten as a strict three-way-split bake-off: params
pre-2018, tune (xi, k, w) on 2018-2022 validation, final scores on untouched
2022-2026 test (4,448 matches). Result: ensemble RPS 0.1721 beats Elo-DC
0.1726 and Team-DC 0.1801; ECE stays 0.01. Tuned: xi=0.5 k=5 w=0.75.
- Runtime now IS the backtested model: ratings.json carries teamDc+ensembleW;
matchMatrix() pools both members for predictions, Monte Carlo and advance
probs; ModelEngine re-rating preserves ensemble params; lambdas reported as
matrix expectations (drives in-play).
- scripts/buildSquadValues.ts: Transfermarkt FIWC participants page -> all 48
squad market values (France 1.52bn ... Qatar 20m). Display/availability layer
only — June-2026 values are NOT in the backtested model (would leak).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- docs/V3-GIGA-PLAN.md: the v3 plan (data lake to 7+GB, GIGA ensemble, scoreboard,
UI clarity) with the honest reframe: perfect accuracy = perfect calibration;
'beat the betting sites' = a live public head-to-head, scored with proper rules.
- src/lib/odds.ts: American-ml → decimal, de-vig (normalize away the margin),
overround; 3 vitest cases incl. tonight's real opening lines.
- ESPN core odds adapter (server/src/ingest/espnOdds.ts): captures DraftKings
1X2 moneylines + O/U + spread per fixture; follows $ref pointer items.
- odds_history table (insert-if-changed → clean line-movement history);
scheduler odds sweep every 3h over a 14-day horizon, first sweep at boot;
/api/odds + /api/odds/:num. Odds are a benchmark ONLY — never a model input.
- Boot speed-up: fixture↔event mapping skips dates already fully mapped.
- Verified: 54 fixtures captured with real moneylines locally.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Match cards surface the model's pre-match expectation (favoured team + win%).
- Everything is now clickable: group-table + odds-table team rows → team
profiles; bracket matches → match pages; match ↔ team cross-links.
- New /teams hub: all 48 nations ranked by title odds, linking to profiles
(reachable from Groups + every team link; back-links point here).
- Predict → Methodology link ('How & how accurate'); cohesive hover/transition
polish across cards.
- 26 tests pass; build clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>