gap analysis view - VforVitorio/F1_Strat_Manager GitHub Wiki

Gap Analysis View

VforVitorio/F1_Strat_Manager

powered by

Devin

Gap Analysis View

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:

  1. Gap Evolution: Visualizes how gaps to cars ahead and behind evolved throughout the race
  2. Undercut Opportunities: Shows windows where undercut or overcut strategies were possible
  3. Gap Consistency: Analyzes how consistently gaps were maintained over multiple laps
  4. 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 ahead
  • consistent_gap_behind_laps: Number of consecutive laps with a consistent gap to the car behind
  • undercut_opportunity: Boolean flag indicating a potential undercut opportunity
  • overcut_opportunity: Boolean flag indicating a potential overcut opportunity
  • defensive_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:

  1. Limiting displayed laps to a valid range (1-66)
  2. Using efficient Plotly visualizations for interactive charts
  3. Error handling to gracefully manage missing or incomplete data
  4. Conditional rendering of components based on data availability

Practical Application

The Gap Analysis View is particularly useful for:

  1. Race Strategists: To identify optimal pit stop windows and passing opportunities
  2. Performance Engineers: To analyze consistent gap maintenance as a driver performance metric
  3. Team Principals: To understand race dynamics and strategic decision points
  4. Post-Race Analysis: To evaluate if all strategic opportunities were correctly identified and executed

On this page