Skip to content
Back to projects
Data Engineering Three-person team project · EMSI Rabat · 2026

RaceFlow (F1)

Can the winner of a Formula 1 Grand Prix be predicted before the start? The project builds the full data pipeline needed to answer, from the API to the model.

Private code / team project
54,9 % of winners predicted (vs 52.0% for the “pole position” baseline)
173 races in walk-forward validation

Problem

Formula 1 publishes clean, historical data, and the question is easy to state: who wins on Sunday? RaceFlow collects results and qualifying data, runs them through a streaming then batch pipeline, and compares a model with the simplest baseline: “the pole-sitter wins”.

Data

  • Jolpica API (Ergast’s successor): results and qualifying for the 2015 to 2025 seasons
  • 4,698 driver-race rows after deduplication, 4,684 qualifying rows
  • Parquet data lake in three layers: Bronze, Silver, Gold

Approach

  • Python producers to Kafka, Spark processing, features computed only from previous races (no data leakage)
  • My part, step 7: shallow XGBoost tracked in MLflow, season-by-season walk-forward validation and a bootstrap confidence interval on the gap to pole
  • My part, step 7b: added qualifying times (Q1 and Q3 gaps, grid vs qualifying position)
  • My part, step 8: 5 Airflow DAGs chained with Datasets, MLflow in Docker and GitHub Actions CI
  • Rest of the team: ingestion and data lake (steps 1 to 6), Streamlit dashboard, next-GP prediction and Grafana monitoring (steps 9 to 11)

Results

  • Walk-forward validation 2018–2025: 54.9% of winners predicted over 173 races, vs 52.0% for the “pole position” baseline
  • The gap is not significant: the 95% confidence interval is [−2.9; +8.7] points and contains 0
  • Qualifying times bring most of the gain; starting position already explains most wins

What I would improve

  • Beating pole position significantly takes more data or better features: 173 races are not enough to separate the model from the baseline
  • Add weather and tyre data through the OpenF1 API: race strategy and pit stops are not in the data
Enlarged image