Engineering

How PuckAI is built

PuckAI is a solo-developed hockey analytics platform: NHL player profiles, prospect projections, cross-era comparisons and an AI scouting chat. The design splits cleanly in two — a batch pipeline that computes everything into reproducible, versioned artifacts, and a stateless read API that serves them. The full write-up, with the decision records and the measurements behind every number here, is public.

Read the full write-up
System architecture

Compute offline, serve online

Offlinebatch · reproducible · versioned
  1. Sources

    NHL API · EliteProspects · Central Scouting

  2. 14-stage ETL

    clean → filter → features → tiers → export

  3. XGBoost heads

    entry · longevity · tier

  4. Reports + validation

    generated, then checked against the pipeline

  5. Embeddings

    1024-d vectors over every report

  6. Import scripts

    versioned artifacts loaded into Postgres

Onlinestateless · read-only
  1. PostgreSQL 16 + pgvector

    HNSW cosine index, hosted on Supabase

  2. FastAPI

    read-only services, serverless

  3. Next.js 16

    App Router, React 19

Hockey data is read-only online: nothing in the request path recomputes a tier, a projection or an embedding. The only online writes are user-owned — chat conversations, feedback and saves.

Core features

What the pipeline produces

Production metrics

Measured, not asserted

Retrieval quality

77 labeled queries, NDCG at depth 10.

  • Keyword only0.488
  • Vector only0.508
  • Hybrid + rerank0.582
  • Hybrid + scope routing0.682

Prospect prediction

P(NHL)
0.977 ± 0.001 ROC-AUC · 0.849 ± 0.005 PR-AUC
P(GP ≥ 200 | NHL)
0.699 ± 0.014 ROC-AUC
Tier — Forward
0.375 exact · 0.767 within-1 · 0.379 macro-F1
Tier — Defenseman
0.314 exact · 0.729 within-1 · 0.291 macro-F1

Report generation

953 batches, July–August 2026.

Generated
7,670 attempts
Passed validation
7,643 (99.65%)
Rejected & regenerated
27 (0.35%)
Scale

What is in the database

ComponentCount
Pre-NHL seasons859,556
Prospect profiles55,455
Served predictions54,933
NHL season trajectories38,899
Scouting reports (1024-d)7,643
NHL tier assignments6,078
League adjustment factors1,484
NHL skaters (full profiles)2,700
Technology

The stack

Offline

  • Python 3.12
  • pandas
  • XGBoost
  • scikit-learn
  • Staged ETL with a CLI runner
  • pytest validation

Online

  • FastAPI 0.136
  • SQLAlchemy 2.0 · Pydantic 2.13
  • PostgreSQL 16 + pgvector (HNSW)
  • Supabase
  • Next.js 16 · React 19
  • TypeScript · Tailwind 4

AI

  • Voyage embeddings (1024-d)
  • rerank-2.5-lite
  • Pluggable answer model

Development

  • Docker Compose for the local stack

Read the engineering write-up

The public repository holds documentation only — no product code. It covers:

  • Architecture patterns and request flow
  • 14-stage ETL guarantees and idempotency
  • Hybrid search implementation and result tables
  • The report validation checker — six checks, no LLM
  • Measurement methodology and its limitations
  • Debugging notes: label leakage in Stage 1, age-band calibration
  • Design decision records, with the tradeoffs
shigenogoro/PuckAI-Engineering