Skip to content

Latest commit

ย 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽ๏ธ Formula 1 Predictive Analytics & Race Intelligence Platform


๐Ÿš€ Building an End-to-End Formula 1 Analytics and Prediction Platform

This project is a complete Formula 1 analytics and race outcome prediction platform designed to simulate a modern sports intelligence workflow using data engineering, machine learning, and business intelligence.

The platform ingests historical Formula 1 race data from the Ergast API, transforms it into analytical feature marts using dbt, trains machine learning models using XGBoost, and delivers insights through Power BI and Tableau dashboards.

The project demonstrates how predictive analytics pipelines can be built end-to-end using modern data engineering and machine learning workflows.


๐ŸŽฏ Why This Project Matters

Modern sports analytics organizations rely heavily on data-driven insights for:

  • Driver performance analysis
  • Race outcome prediction
  • Team strategy optimization
  • Performance benchmarking
  • Historical trend analysis
  • Fan engagement analytics

Traditional static reporting systems cannot efficiently support large-scale predictive workflows or advanced feature engineering pipelines.

This project demonstrates how modern analytics systems can:

  • Automate data ingestion workflows
  • Build reusable analytical data marts
  • Train predictive machine learning models
  • Generate race outcome predictions
  • Support interactive BI dashboards
  • Create scalable analytics pipelines

๐Ÿ“Š Project Snapshot

  • Domain: Formula 1 Racing Analytics
  • Data Source: Ergast API
  • Database: PostgreSQL
  • Transformation Framework: dbt
  • Machine Learning: XGBoost
  • Workflow Orchestration: Airflow (Optional)
  • Visualization: Power BI and Tableau
  • Core Objective: Race Outcome Prediction and Analytics
  • Prediction Target: Top-10 Finishing Prediction

๐Ÿ—๏ธ System Architecture

Ergast ingestion
        โ†“
Postgres warehouse
        โ†“
dbt feature marts
        โ†“
Feature engineering
        โ†“
XGBoost models
        โ†“
Prediction scoring
        โ†“
Power BI / Tableau dashboards

โš™๏ธ Core Features

1. Automated Formula 1 Data Ingestion

  • Pulls historical Formula 1 race data from the Ergast API
  • Loads structured race data into PostgreSQL
  • Supports multi-season ingestion workflows

2. PostgreSQL Analytical Warehouse

  • Stores raw and transformed racing datasets
  • Supports scalable analytics queries
  • Centralized warehouse for modeling and reporting

3. dbt Feature Engineering Pipeline

  • Builds reusable analytical feature marts
  • Creates race-level and driver-level analytical features
  • Supports modular transformation workflows

4. Machine Learning Prediction Pipeline

  • Uses XGBoost models for race outcome prediction
  • Predicts Top-10 driver finishes
  • Supports training and scoring workflows

5. Predictive Analytics Workflow

  • Generates race predictions by season and round
  • Evaluates model performance using calibration metrics
  • Supports repeatable prediction workflows

6. Business Intelligence Dashboards

  • Power BI and Tableau dashboards for race analytics
  • Visualizes driver trends and prediction outputs
  • Supports interactive business reporting

7. Workflow Orchestration

  • Optional Airflow orchestration support
  • Automates ingestion and transformation workflows
  • Simulates production-style analytics pipelines

โœจ Key Highlights

  • End-to-end Formula 1 analytics and prediction pipeline
  • Ergast ingestion โ†’ Postgres โ†’ dbt โ†’ XGBoost โ†’ BI workflow
  • Dimensional marts and reusable analytical datasets
  • Realistic KPIs and calibration metrics
  • Interactive Power BI and Tableau dashboards
  • Easy extensibility for safety car and pit strategy simulations
  • Modular data engineering and ML architecture

๐Ÿ”ฅ What Makes This Project Different

Dimension Traditional Sports Dashboard This Project
Data Source Static exports Automated Ergast ingestion
Data Pipeline Manual preparation End-to-end automated workflow
Modeling Basic statistics XGBoost predictive modeling
Transformation Flat tables dbt feature marts
Analytics Historical reporting Predictive analytics
Visualization Static dashboards Interactive BI dashboards
Workflow Standalone analysis Integrated data engineering pipeline

๐Ÿง  Tech Stack

  • Python
  • PostgreSQL
  • dbt
  • XGBoost
  • Apache Airflow
  • Power BI
  • Tableau
  • Docker
  • SQL

๐Ÿ“‚ Repository Structure

formula1-predictive-analytics-platform/
โ”‚
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ schema.sql
โ”œโ”€โ”€ docker-compose.yml
โ”œโ”€โ”€ .env.example
โ”‚
โ”œโ”€โ”€ airflow_dags/
โ”‚   โ”œโ”€โ”€ f1_daily_ingest.py
โ”‚   โ””โ”€โ”€ f1_weekend_train_predict.py
โ”‚
โ”œโ”€โ”€ bi/
โ”‚   โ”œโ”€โ”€ dashboard_wireframes.md
โ”‚   โ””โ”€โ”€ powerbi_measures.md
โ”‚
โ”œโ”€โ”€ dbt/
โ”‚   โ”œโ”€โ”€ dbt_project.yml
โ”‚   โ”œโ”€โ”€ profiles.yml.example
โ”‚   โ””โ”€โ”€ models/
โ”‚       โ”œโ”€โ”€ staging/
โ”‚       โ””โ”€โ”€ marts/
โ”‚
โ”œโ”€โ”€ notebooks/
โ”‚   โ”œโ”€โ”€ 01_eda.ipynb
โ”‚   โ””โ”€โ”€ 02_feature_checks.ipynb
โ”‚
โ””โ”€โ”€ src/
    โ”œโ”€โ”€ ingest/
    โ”‚   โ””โ”€โ”€ ergast_pull.py
    โ”œโ”€โ”€ features/
    โ”‚   โ””โ”€โ”€ build_pre_race_features.py
    โ”œโ”€โ”€ models/
    โ”‚   โ”œโ”€โ”€ train.py
    โ”‚   โ””โ”€โ”€ predict.py
    โ””โ”€โ”€ utils/
        โ””โ”€โ”€ io.py

โ–ถ๏ธ How to Run

1. Configure Environment

Update the .env file with your database credentials and environment settings.

2. Start PostgreSQL

docker compose up -d

3. Create Database Schema

psql -f schema.sql

4. Install Dependencies

pip install -r requirements.txt

5. Run Ergast Data Ingestion

python src/ingest/ergast_pull.py --from-season 2014 --to-season 2024

6. Build dbt Models

cd dbt && dbt build

7. Train Prediction Model

python src/models/train.py --target top10

8. Generate Predictions

python src/models/predict.py --target top10 --season 2024 --round all

9. Explore BI Dashboards

Connect Power BI or Tableau to PostgreSQL and explore:

marts.f_predictions

๐Ÿ“Š Machine Learning Workflow

Data Pipeline

  • Historical race ingestion
  • Feature engineering using dbt
  • Structured training datasets

Model Training

  • XGBoost classification models
  • Driver finish prediction
  • Top-10 race outcome prediction

Prediction Workflow

  • Season-based predictions
  • Round-level scoring
  • Model evaluation and calibration

๐Ÿ“ˆ Key Analytics Capabilities

  • Driver performance tracking
  • Team comparison analysis
  • Historical race trend analysis
  • Prediction confidence analysis
  • Season-level benchmarking
  • Top-10 finish prediction
  • Operational analytics dashboards

๐Ÿ’ผ Business Impact

  • Demonstrates production-style analytics engineering workflows
  • Reduces manual data preparation effort
  • Supports scalable sports analytics pipelines
  • Enables data-driven race analysis
  • Combines BI, ML, and data engineering into one platform
  • Simulates real-world predictive analytics systems

๐Ÿ› ๏ธ Skills Demonstrated

  • Data Engineering
  • ETL Pipelines
  • PostgreSQL
  • dbt
  • Machine Learning
  • XGBoost
  • Predictive Analytics
  • Business Intelligence
  • Airflow
  • Docker
  • SQL
  • Sports Analytics

โš ๏ธ Limitations

  • Prediction quality depends on historical race data
  • External race conditions are not fully modeled
  • Real-time telemetry data is not included
  • Airflow orchestration is optional and may require additional setup

๐Ÿ”ฎ Future Improvements

  • Add real-time telemetry ingestion
  • Deploy dashboards to cloud infrastructure
  • Add deep learning race simulations
  • Integrate weather and pit strategy data
  • Add driver similarity and ranking models
  • Build live race prediction APIs
  • Add automated model retraining workflows

โœ… Conclusion

This project demonstrates how modern data engineering, machine learning, and business intelligence workflows can be integrated into a complete Formula 1 analytics platform.

By combining Ergast ingestion, PostgreSQL warehousing, dbt transformations, XGBoost prediction pipelines, and BI dashboards, the project provides a practical example of end-to-end predictive analytics system design.

The implementation highlights strong capabilities in ETL engineering, feature engineering, ML modeling, SQL analytics, and production-style analytics architecture.

About

End-to-end Formula 1 analytics and race prediction platform using PostgreSQL, dbt, XGBoost, Airflow, and BI dashboards for predictive sports intelligence.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages