overview - VforVitorio/F1_Strat_Manager GitHub Wiki
Overview
- Overview
- System Architecture
- Installation and Setup
- Streamlit Dashboard
- Strategy Recommendations View
- Gap Analysis View
- Radio Analysis View
- Time Predictions View
- Strategy Chat Interface
- Machine Learning Models
- Lap Time Prediction
- Tire Degradation Modeling
- Vision-based Gap Calculation
- NLP Pipeline
- Radio Transcription
- Sentiment and Intent Analysis
- Named Entity Recognition
- Expert System
- Degradation Rules
- Gap Analysis Rules
- Radio Message Rules
- Integrated Rule Engine
- Developer Guide
- API Reference
- Integration Guide
Overview
- .gitignore
- README.md
- requirements.txt
- scripts/app/app.py
- scripts/app/components/degradation_view.py
- scripts/app/utils/processing.py
- scripts/app/utils/visualization.py
The F1 Strategy Manager is an integrated AI-powered system for Formula 1 race strategy analysis and decision support. This document provides a technical overview of the system architecture, key components, and data flow, serving as the entry point to understand how the system works.
For detailed setup instructions, see Installation and Setup. For information on the Streamlit interface, see Streamlit Dashboard.
Purpose and Scope
The F1 Strategy Manager combines telemetry data analysis, computer vision, natural language processing, and rule-based expert systems to:
- Analyze real-time race data from multiple sources
- Predict lap times and tire degradation using machine learning models
- Interpret team radio communications
- Calculate optimal race strategies based on complex variables
- Provide actionable recommendations via an interactive dashboard
It targets technical race strategists who need data-driven decision support for critical race situations.
System Architecture
The F1 Strategy Manager is structured as a multi-layered system with specialized components for data acquisition, processing, analysis, and visualization:
Key Components
Data Sources and Processing
The system ingests and processes data from three primary sources:
- Race Telemetry (FastF1): Lap times, sector data, tire information
- Team Radio (OpenF1): Audio transcripts from driver-team communications
- Video Footage: Raw race footage for gap calculation and position tracking
Data processing is managed through the utils/processing.py
module, which contains functions for transforming raw data into analysis-ready formats:
Function | Purpose | Source File |
---|---|---|
get_processed_race_data() |
Transforms race telemetry with fuel adjustments and degradation metrics | processing.py |
get_processed_gap_data() |
Calculates gap consistency between cars | processing.py |
get_processed_recommendations() |
Loads and filters strategic recommendations | processing.py |
calculate_gap_consistency() |
Determines consecutive laps with similar gap windows | processing.py |
Machine Learning Models
The system employs several machine learning models for predictive analytics:
- XGBoost Model: Predicts lap times with MAE of 0.09s
- TCN (Temporal Convolutional Network): Models tire degradation over time
- YOLOv8: Computer vision model for team identification and gap calculation
- NLP Pipeline: Uses Whisper, RoBERTa, and BERT models for radio analysis
These models process telemetry data to generate predictions that feed into the expert system for strategic decision-making.
Expert System
At the core of the strategy recommendation engine is a rule-based expert system built on the Experta framework. It consists of several specialized rule sets that analyze different aspects of race data:
The F1CompleteStrategyEngine
integrates multiple rule sets and resolves conflicts to generate coherent strategy recommendations. For more details on the expert system, see Expert System.
Streamlit Interface
The user interface is built with Streamlit and provides multiple specialized views:
- Strategy Recommendations View: Displays AI-powered recommendations
- Gap Analysis View: Visualizes gaps between cars and identifies strategic opportunities
- Radio Analysis View: Shows insights from team radio communications
- Time Predictions View: Displays lap time predictions
- Tire Degradation View: Analyzes tire wear patterns and performance impacts
The UI components are organized in the components
directory, with each view implemented as a separate module.
Data Flow
The following diagram illustrates how data flows through the system from input sources to the user interface:
Key steps in the data flow:
- Data Acquisition: Raw data is collected from multiple sources
- Processing: The
processing.py
module transforms raw data into standardized formats - Analysis: Machine learning models generate predictions and insights
- Rule Evaluation: The expert system applies rules to generate recommendations
- Visualization: The UI components render the processed data and recommendations
Dependencies and Requirements
The system has several key dependencies:
- Python 3.10+: Base programming language
- Data Analysis: pandas, numpy, matplotlib
- Machine Learning: torch, xgboost, transformers, ultralytics
- API Clients: fastf1, openf1
- UI Framework: streamlit, plotly
- Expert System: experta
For a complete list of dependencies, see the requirements.txt file.
Getting Started
To run the F1 Strategy Manager:
- Clone the repository
- Install the required dependencies
- Run the Streamlit application using
streamlit run scripts/app/app.py
For detailed setup instructions, see Installation and Setup.