Real-time backend platform to ingest Formula 1 race data, compute performance signals, and serve low-latency APIs for live and historical analysis.
Build a production-style telemetry and analytics system that demonstrates:
- Real-time event ingestion
- Reliable data modeling in PostgreSQL
- Fast API serving for dashboard consumption
- Observability-first engineering (latency, freshness, correctness)
This aligns with backend and infrastructure strengths:
- FastAPI + PostgreSQL + SQLAlchemy
- Real-time ingestion and monitoring patterns
- Measurable system performance outcomes
- Ingestion Service
- Consume F1 event stream (laps, sectors, pits, flags, weather).
- Normalize events into canonical schema.
- Use idempotency keys to prevent duplicate writes.
- Core Data Model
race_sessionsdriverslapssectorsstintspit_eventsweather_snapshotsingestion_events(audit trail)
- Metrics Pipeline
- Rolling lap pace deltas
- Tire degradation proxy by stint
- Pit stop impact and rank changes
- Anomaly flags (sudden pace drop, outlier sector)
- API Layer
GET /healthGET /sessions/{session_id}/leaderboard/liveGET /drivers/{driver_id}/timelineGET /sessions/{session_id}/metricsGET /sessions/{session_id}/anomalies
- Frontend (later stage)
- Live leaderboard
- Event timeline
- Driver detail panel
- Race trend overlays
- Ingestion P95 latency:
< 200ms - API P95 latency:
< 150ms - Freshness lag:
< 2s - Duplicate write rate:
0 - Availability during race windows:
99%+
Current repository has starter files only. Use this target layout:
api/
app.py
routes/
database/
connection.py
models.py
migrations/
services/
ingest/
metrics/
jobs/
tests/
api/
services/
- Secure env setup (
.envignored,.env.examplecommitted) - Package-safe imports
- SQLAlchemy models and initial schema migration
- Health endpoint and basic app wiring
- Stream adapter and event normalizer
- Idempotent writes and retry handling
- Ingestion audit logging
- Aggregation jobs (rolling pace, stint metrics)
- Leaderboard and driver timeline endpoints
- Basic caching for frequently-read endpoints
- Metrics dashboards (ingestion lag, API latency)
- Backfill tooling for historical sessions
- Demo workflow for one full race replay
- Rename and clean module files (e.g.,
api/fastAPI-test.py->api/app.py). - Fix import safety (
database/manage.pypackage imports). - Add root
.gitignoreand remove sensitive env tracking. - Add first smoke tests for API startup and DB model import.