PitWall Intel is an F1 race result predictor that thinks like a race engineer. It pulls 4 seasons of real Formula 1 data from the OpenF1 API, enriches it with deep lap-by-lap telemetry from FastF1 (lap consistency, tyre degradation, sector deltas, throttle telemetry, qualifying gaps), engineers 37+ predictive features from qualifying pace, tyre strategy, championship pressure, pit efficiency, and weather then runs an XGBoost model to predict the full 20-car race finishing order before lights out.
Built for data science enthusiasts who want a real, end-to-end ML project with real Formula 1 data and results worth showing off.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 01 RACE PREDICTOR Select a GP Β· customise grid Β· run model β
β 02 MODEL PERFORMANCE MAE Β· podium accuracy Β· feature importanceβ
β 03 DATA EXPLORER Browse 4 seasons of race + telemetry data β
β 04 WHAT-IF SIMULATOR Adjust any variable live Β· watch it shift β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Race Predictor β Choose any 2026 Grand Prix, set starting grid positions, adjust weather conditions, and fire a full prediction. The app fetches live championship standings, tyre stint data, and pit stop efficiency from the OpenF1 API in real time before inference.
Model Performance β Inspect MAE, podium accuracy, and a full feature importance chart colour-coded by feature type (standard vs. FastF1 telemetry). Includes a feature coverage table showing every input's live vs. prior vs. default source.
Data Explorer β Browse and filter all training data across seasons and circuits. A dedicated telemetry tab shows FastF1-enriched columns with summary statistics. Includes a grid-position vs. finish-position scatter plot coloured by team.
What-If Simulator β Drag any slider (grid position, championship points, SC probability, tyre compound, qualifying gap, tyre degradation rate, and more) and the model re-runs inference instantly. Grid sensitivity and SC probability sweep charts update live.
git clone https://github.com/mukuldhattarwal/pitwall-intel.git
cd pitwall-intelWindows (PowerShell)
python -m venv .venv
.venv\Scripts\Activate.ps1Windows (cmd)
python -m venv .venv
.venv\Scripts\activate.batmacOS / Linux
python3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txtstreamlit run app.pyOpens at http://localhost:8501
Windows shortcut: double-click
run_windows.bat
Mac/Linux shortcut:./run_mac_linux.sh
1 Open the app in your browser
β
2 Click "Fetch + Train Model" in the sidebar
β
3 The OpenF1 pipeline runs automatically (~3 β 8 min)
ββ Downloads sessions, results & grids (2023β2025)
ββ Fetches tyre stints, pit stops & weather
ββ Loads championship standings
ββ Engineers all 37 predictive features
ββ Trains XGBoost + Random Forest
ββ Saves models to /models/
β
4 (Optional) Click "Fetch Telemetry (FastF1)"
ββ Adds 9 deep telemetry features: quali_gap_ms Β· sector deltas Β·
lap_consistency Β· race_pace_delta Β· tyre_deg_rate Β· throttle_pct Β· sc_laps_actual
β
5 (If telemetry fetched) Click "Fetch + Train Model" again
ββ Retrains the model with the enriched 37-feature set
β
6 Go to Race Predictor β select a GP β Run Prediction
Note: 404 and 429 warnings in the terminal are expected β some sessions have no data in OpenF1, and the API rate-limits heavy requests. The pipeline handles both automatically with built-in fallbacks.
pitwall_intel/
β
βββ app.py Main Streamlit application (all 4 pages)
βββ requirements.txt Python dependencies
β
βββ assets/
β βββ f1_logo.png F1 logo rendered in the app header
β
βββ utils/
β βββ data_pipeline.py OpenF1 fetcher + feature engineering
β βββ model_trainer.py XGBoost + Random Forest training + evaluation
β βββ fastf1_pipeline.py FastF1 telemetry fetcher + feature merger
β
βββ data/
β βββ raw/ Raw API responses saved as CSV
β βββ processed/
β βββ features_final.csv Master feature dataset (~1,500 rows)
β
βββ models/
βββ xgboost_model.pkl Primary prediction model
βββ rf_model.pkl Comparison model
βββ best_model.pkl Best performer (auto-selected at training time)
βββ model_meta.pkl Feature list + evaluation metrics
Primary source: OpenF1 API β free, no API key required, REST-based
Telemetry source: FastF1 β lap-level and car-level telemetry
Seasons covered: 2023 Β· 2024 Β· 2025 Β· 2026 Β |Β ~1,500+ race-driver rows
| Feature | Source | Description |
|---|---|---|
grid_position |
Starting Grid | Where the driver starts on race day |
quali_delta_to_pole |
Derived | Estimated gap to pole in seconds |
driver_form_3 / driver_form_5 |
Session Results | Rolling avg finish over last 3 and 5 races |
circuit_specialist_score |
Session Results | Driver's historical avg finish at this circuit |
total_stints |
OpenF1 Stints | Number of tyre stints (strategy indicator) |
starting_compound_enc |
OpenF1 Stints | Encoded tyre compound at race start |
avg_tyre_age / tyre_age_at_start |
OpenF1 Stints | Tyre age profile across the race |
num_pit_stops / avg_stop_duration |
OpenF1 Pit API | Stop count and stationary time efficiency |
champ_points_before |
OpenF1 Championship | Points entering the race weekend |
champ_position_before |
OpenF1 Championship | Championship standing entering the weekend |
points_gap_to_leader |
Derived | Point deficit to current championship leader |
constructor_avg_finish |
Derived | Team's rolling average finishing position |
team_dnf_rate / dnf_rate_driver |
Derived | Constructor and driver reliability scores |
pit_stop_efficiency |
OpenF1 Pit API | Team's average stationary time |
seasons_experience |
Derived | Number of seasons the driver has competed |
sc_probability |
Race Control + Historical | Safety car likelihood for this circuit |
circuit_type_enc / is_street_circuit |
OpenF1 Meetings | Permanent / street / road circuit encoding |
air_temperature / track_temperature |
User Input + Weather | Race-day thermal conditions |
rainfall / humidity / wind_speed |
User Input | Weather modifiers |
track_temp_delta |
Derived | Track minus air temperature gap |
| Feature | Source | Description |
|---|---|---|
quali_gap_ms |
FastF1 Qualifying | Gap to pole position in milliseconds |
s1_delta / s2_delta / s3_delta |
FastF1 Qualifying | Per-sector time delta to pole |
lap_consistency |
FastF1 Race Laps | Standard deviation of lap times (lower = more consistent) |
race_pace_delta |
FastF1 Race Laps | Median race pace gap to the fastest driver |
tyre_deg_rate |
FastF1 Race Laps | Lap time increase per lap on a stint (ms/lap) |
throttle_pct |
FastF1 Car Telemetry | Percentage of lap on full throttle |
sc_laps_actual |
FastF1 Track Status | Actual safety car laps in the race |
On every prediction, the app makes five live API calls before running inference:
OpenF1 /v1/championship_drivers β champ_points_before Β· position Β· gap_to_leader
OpenF1 /v1/stints β starting_compound Β· total_stints Β· avg_tyre_age
OpenF1 /v1/pit β num_pit_stops Β· avg_stop_duration
OpenF1 /v1/race_control β sc_probability (live circuit history)
OpenF1 /v1/drivers β current driver lineup + team assignments
Where live data is unavailable, the app falls back to the most recent value from the training dataset, then to a sensible default β in that priority order.
Training split β Time-based: 2023β2024 train, 2025 test (no data leakage)
DNF encoding β Did Not Finish treated as finishing position 21
Target variable β Predicted race finishing position (regression)
Evaluation β MAE (positions off) Β· Podium Accuracy % (P1βP3 hit rate)
Model selection β Auto-selects best between XGBoost and Random Forest at training time
Telemetry impact β 9 FastF1 features added when telemetry pipeline is run
What-If mode β Runs full model inference on every slider change, no caching
Pole logic β Post-prediction dominance adjustment for pole sitter when form is strong
| Layer | Technology | Version |
|---|---|---|
| Language | Python | 3.10+ |
| UI Framework | Streamlit | 1.35.0 |
| Primary Model | XGBoost | 2.0.3 |
| Comparison Model | scikit-learn Random Forest | 1.4.2 |
| Data Processing | pandas Β· numpy | 2.2.2 Β· 1.26.4 |
| Visualisation | Plotly | 5.22.0 |
| Telemetry | FastF1 | 3.3+ |
| Data Source | OpenF1 REST API | β |
| Model Serialisation | joblib | β |
| Styling | Custom CSS (carbon-dark theme) | β |
- Predictions are based on historical patterns and statistical priors β they are not a simulation of race physics or strategy.
- FastF1 data is only available for completed sessions; 2026 race telemetry accumulates throughout the season.
- OpenF1 may return 404 for sessions with missing data or 429 when rate-limited. Both are handled gracefully.
- The 2026 driver lineup (Cadillac, Audi entries) uses fallback data until OpenF1 populates live records.
- This project is for educational purposes only and is not affiliated with Formula 1, the FIA, or any constructor.
