How yasher3413/aftershock works
Aftershock turns NHL play-by-play into live and replayed estimates of how goals change playoff odds, then presents those changes as a map, seismograph, player/team views, and shareable recaps. Its central workflow is NHL feed → normalized game data → live/replay engine and season simulation → persisted tremors and published state → API → web experience. The README documents the major capabilities and system boundaries; some implementation paths below are directory-level because their source was not sampled.
Main entry points: models.py Postgres · parse.py Game parser · engine.py Season engine · routes.tsx Web application
Components 25
Feed and storage
- Feed client
services/aftershock/nhl/client.py - Game parser
services/aftershock/nhl/parse.py - Historical ingest
services/aftershock/ingest/load.py - Postgres
services/aftershock/db/models.py
Models and simulation
- Expected goals
services/aftershock/ml/xg.py - Team strength
services/aftershock/ml/strength.py - Win probability
services/aftershock/ml/wp.py - Simulation inputs
services/aftershock/sim/inputs.py - Rust simulator adapter
services/aftershock/sim/backend.py - Season simulator
crates/aftershock-core/src/sim/mod.rs - Standings and playoffs
crates/aftershock-core/src/standings.rs - Browser simulator
crates/aftershock-wasm/src/lib.rs
Live runtime
- Season engine
services/aftershock/live/engine.py - Live and replay worker
services/aftershock/live/worker.py - Tremor scoring
services/aftershock/tremors/compute.py - Effect persistence
services/aftershock/live/persist.py - Live publishing
services/aftershock/live/publish.py - Nightly recap
services/aftershock/recap/generate.py
API and delivery
- REST and WebSocket API
services/aftershock/api/app.py - Redis pub/sub
Web experience
- Web application
web/src/routes.tsx - Live shockwave map
web/src/map/controller.ts - What-If Lab
web/src/whatif/useSimulator.ts
Other components
- NHL feed
- Hockey viewer
Connections 28
- NHL feed → Feed client: serves feed
README.md - Feed client → Game parser: provides JSON
services/aftershock/nhl/client.py - Game parser → Historical ingest: normalizes data
- Historical ingest → Postgres: loads games
- Game parser → Expected goals: provides plays
services/aftershock/ml/xg.py - Game parser → Win probability: provides plays
services/aftershock/ml/wp.py - Team strength → Win probability: supplies matchup
services/aftershock/ml/wp.py - Postgres → Simulation inputs: loads season
services/aftershock/sim/inputs.py - Team strength → Simulation inputs: fills probabilities
services/aftershock/sim/inputs.py - Simulation inputs → Rust simulator adapter: provides inputs
services/aftershock/sim/backend.py - Rust simulator adapter → Season simulator: invokes simulator
- Season simulator → Standings and playoffs: computes standings
crates/aftershock-core/src/sim/mod.rs - Live and replay worker → Season engine: drives snapshots
README.md - Season engine → Win probability: evaluates game state
services/aftershock/live/engine.py - Season engine → Rust simulator adapter: runs season simulations
services/aftershock/live/engine.py - Season engine → Tremor scoring: computes tremors
services/aftershock/live/engine.py - Live and replay worker → Effect persistence: persists effects
- Live and replay worker → Live publishing: publishes state
- Effect persistence → Postgres: writes results
- Live publishing → Redis pub/sub: publishes messages
README.md - Redis pub/sub → REST and WebSocket API: feeds updates
README.md - Postgres → REST and WebSocket API: serves queries
README.md - REST and WebSocket API → Web application: serves REST and socket
README.md - Hockey viewer → Web application: views results
README.md - Web application → Live shockwave map: renders live map
- Web application → What-If Lab: opens scenarios
- What-If Lab → Browser simulator: runs browser simulation
README.md - Postgres → Nightly recap: supplies nightly data