gap analysis view - VforVitorio/F1_Strat_Manager GitHub Wiki
Gap Analysis View
- 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
Gap Analysis View
- scripts/app/components/competitive_analysis_view.py
- scripts/app/components/gap_analysis_view.py
- scripts/app/components/overview_view.py
- scripts/app/components/report_export.py
- scripts/app/components/team_radio_view.py
- scripts/app/components/time_predictions_view.py
Purpose and Scope
The Gap Analysis View is a critical component of the F1 Strategy Manager dashboard that provides comprehensive visualization and analysis of the gaps between cars throughout a race. This view enables strategists to identify potential undercut and overcut opportunities, analyze gap consistency, and detect strategic windows for pit stops. For information about strategy recommendations derived from gap analysis, see Gap Analysis Rules.
System Architecture
The Gap Analysis View integrates with the overall F1 Strategy Manager system as a component of the Streamlit dashboard. It processes gap data collected through telemetry and vision-based gap calculation to provide strategic insights.
Integration with F1 Strategy Manager
Data Flow Process
Core Components
1. Gap Evolution Visualization
The Gap Evolution visualization shows how the gaps to cars ahead and behind changed throughout the race. This helps identify critical phases where relative performance shifted and potential passing opportunities arose.
2. Undercut Opportunities Detection
The Undercut Opportunities visualization identifies specific windows in the race where undercut or overcut strategies were possible based on gap profiles and tire performance.
3. Gap Consistency Analysis
The Gap Consistency Analysis measures how consistently gaps were maintained over multiple laps, which indicates driver performance and tire management capabilities.
4. Strategic Insights Dashboard
The Strategic Insights dashboard provides a summary of identified opportunities based on the gap analysis, including counts of undercut, overcut, and defensive windows.
User Interface Structure
The Gap Analysis View is organized into four tabs that provide different perspectives on the gap data:
- Gap Evolution: Visualizes how gaps to cars ahead and behind evolved throughout the race
- Undercut Opportunities: Shows windows where undercut or overcut strategies were possible
- Gap Consistency: Analyzes how consistently gaps were maintained over multiple laps
- Strategic Insights: Provides a summary of strategic opportunities identified from gap analysis
Tab Structure Implementation
Strategic Windows Calculation
The Gap Analysis View relies on the calculate_strategic_windows
function to identify potential strategic opportunities based on gap data. This function processes raw gap data and adds the following derived fields:
consistent_gap_ahead_laps
: Number of consecutive laps with a consistent gap to the car aheadconsistent_gap_behind_laps
: Number of consecutive laps with a consistent gap to the car behindundercut_opportunity
: Boolean flag indicating a potential undercut opportunityovercut_opportunity
: Boolean flag indicating a potential overcut opportunitydefensive_needed
: Boolean flag indicating a need for defensive strategy
Strategic Window Data Structure
Field | Type | Description |
---|---|---|
LapNumber | int | Lap number in the race |
GapToCarAhead | float | Gap to car ahead in seconds |
GapToCarBehind | float | Gap to car behind in seconds |
consistent_gap_ahead_laps | int | Consecutive laps with consistent gap ahead |
consistent_gap_behind_laps | int | Consecutive laps with consistent gap behind |
undercut_opportunity | bool | Potential undercut opportunity exists |
overcut_opportunity | bool | Potential overcut opportunity exists |
defensive_needed | bool | Defensive strategy needed |
Integration with Export Functionality
The Gap Analysis View integrates with the report export functionality, allowing users to include gap analysis visualizations in exported strategy reports.
Performance Considerations
The Gap Analysis View is designed to handle potentially large datasets efficiently by:
- Limiting displayed laps to a valid range (1-66)
- Using efficient Plotly visualizations for interactive charts
- Error handling to gracefully manage missing or incomplete data
- Conditional rendering of components based on data availability
Practical Application
The Gap Analysis View is particularly useful for:
- Race Strategists: To identify optimal pit stop windows and passing opportunities
- Performance Engineers: To analyze consistent gap maintenance as a driver performance metric
- Team Principals: To understand race dynamics and strategic decision points
- Post-Race Analysis: To evaluate if all strategic opportunities were correctly identified and executed
On this page
- Gap Analysis View
- Purpose and Scope
- System Architecture
- Integration with F1 Strategy Manager
- Data Flow Process
- Core Components
- 1. Gap Evolution Visualization
- 2. Undercut Opportunities Detection
- 3. Gap Consistency Analysis
- 4. Strategic Insights Dashboard
- User Interface Structure
- Tab Structure Implementation
- Strategic Windows Calculation
- Strategic Window Data Structure
- Integration with Export Functionality
- Performance Considerations
- Practical Application