This repository contains the data ingestion, model training, prediction API, and dashboard for the F1 2026 prediction system.
./setup.shOr install directly:
pip install -r requirements.txt- Copy the environment template:
cp .env.example .env
- Start the services:
docker-compose up --build
- Open the API:
- Open the dashboard:
Base URL: http://localhost:8000
| Endpoint | Method | Description | Auth |
|---|---|---|---|
/ |
GET | Service info | No |
/health |
GET | Health check | No |
/metrics |
GET | Prometheus metrics | No |
/predict |
POST | Generate predictions | X-API-Key |
/races/upcoming |
GET | Upcoming races | X-API-Key |
/model/performance |
GET | Model performance | X-API-Key |
/drivers |
GET | Driver list | X-API-Key |
/teams |
GET | Team list | X-API-Key |
/scenarios/simulate |
POST | Scenario comparison | X-API-Key |
/update/qualifying |
POST | Update grid | X-API-Key |
curl -X POST http://localhost:8000/predict \
-H "Content-Type: application/json" \
-H "X-API-Key: ${API_KEY}" \
-d '{"race_id": 202601}'Environment variables (see .env.example):
DATABASE_URL- PostgreSQL connection stringDB_PASSWORD- database passwordMODEL_DIR- directory containing model artifactsFASTF1_CACHE- FastF1 cache directoryOPENWEATHER_API_KEY- weather API keyWEATHER_BASE_URL- weather API base URLAPI_KEY- API authentication keyALLOWED_ORIGINS- CORS configurationREDIS_URL- Redis connection string
- Missing models: ensure model files are in
MODEL_DIR(e.g.xgb_position.joblib). - Database connection errors: verify
DATABASE_URLand that PostgreSQL is running. - API unauthorized: set
API_KEYand includeX-API-Keyin requests.
- Create a feature branch.
- Run tests (
pytest). - Submit a pull request with a clear description of changes.