# iamtomshaw/f1-race-replay architecture

> Architecture diagram of the GitHub repository iamtomshaw/f1-race-replay, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iamtomshaw/f1-race-replay
- Repository: https://github.com/iamtomshaw/f1-race-replay

## Overview

F1 Race Replay loads a selected race or qualifying session, prepares telemetry, then runs an interactive replay; race replay also launches the Insights menu, whose windows provide parallel analysis. The code excerpts and SOURCE INDEX support the main data, replay, UI, and stream boundaries. Several documented analysis capabilities have unsampled implementations, so they are represented at their exact tree paths; uncertain runtime connections are omitted.

Main entry points: [`main.py`](https://github.com/iamtomshaw/f1-race-replay/blob/main/main.py) (Application entry), [`src/interfaces/race_replay.py`](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/interfaces/race_replay.py) (Race replay), [`src/gui/insights_menu.py`](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/gui/insights_menu.py) (Insights menu), [`src/f1_data.py`](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/f1_data.py) (Session telemetry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_selection["Session selection"]
  node_main["Application entry<br/>[main.py]"]
  node_gui_select["GUI selector<br/>[race_selection.py]"]
  node_cli_select["CLI selector<br/>[race_selection.py]"]
  node_season["Season defaults<br/>[season.py]"]
  node_settings["App settings<br/>[settings.py]"]
end

subgraph group_replay["Replay experience"]
  node_data["Session telemetry<br/>[f1_data.py]"]
  node_session_runner["Replay launcher<br/>[run_session.py]"]
  node_race_replay["Race replay<br/>[race_replay.py]"]
  node_quali_replay["Qualifying replay<br/>[qualifying.py]"]
  node_hud["Replay HUD<br/>[ui_components.py]"]
end

subgraph group_insights["Telemetry insights"]
  node_insights_menu["Insights menu<br/>[insights_menu.py]"]
  node_pitwall["Pit wall window<br/>[pit_wall_window.py]"]
  node_driver_telemetry["Driver telemetry"]
  node_lap_chart["Lap time charts"]
  node_track_positions["Track positions"]
  node_tyre_strategy["Tyre strategy"]
  node_race_control["Race control feed"]
  node_stream_viewer["Stream viewer"]
end

subgraph group_support["Analysis and services"]
  node_stream["Telemetry stream<br/>[stream.py]"]
  node_bayes_model["Bayesian tyre model"]
  node_tyre_integration["Tyre degradation"]
  node_time_utils["Time utilities<br/>[time.py]"]
  node_tyre_types["Tyre utilities<br/>[tyres.py]"]
end

node_user(("Race viewer"))

node_user -->|"chooses session"| node_gui_select
node_user -->|"chooses session"| node_cli_select
node_main -->|"opens by default"| node_gui_select
node_main -->|"dispatches CLI"| node_cli_select
node_main -->|"gets default year"| node_season
node_gui_select -->|"opens settings"| node_settings
node_main -->|"loads and processes"| node_data
node_main -->|"starts race replay"| node_session_runner
node_main -->|"starts qualifying replay"| node_quali_replay
node_session_runner -->|"creates window"| node_race_replay
node_session_runner -->|"launches menu"| node_insights_menu
node_race_replay -->|"uses telemetry"| node_data
node_race_replay -->|"uses components"| node_hud
node_quali_replay -->|"uses telemetry"| node_data
node_quali_replay -->|"uses components"| node_hud
node_insights_menu -->|"launches view"| node_driver_telemetry
node_insights_menu -->|"launches view"| node_lap_chart
node_insights_menu -->|"launches view"| node_track_positions
node_insights_menu -->|"launches view"| node_tyre_strategy
node_insights_menu -->|"launches view"| node_race_control
node_driver_telemetry -->|"extends window"| node_pitwall
node_lap_chart -->|"extends window"| node_pitwall
node_track_positions -->|"extends window"| node_pitwall
node_tyre_strategy -->|"extends window"| node_pitwall
node_race_control -->|"extends window"| node_pitwall
node_stream_viewer -->|"receives telemetry"| node_stream
node_race_replay -.->|"publishes telemetry"| node_stream
node_tyre_integration -->|"uses model"| node_bayes_model
node_hud -->|"uses degradation"| node_tyre_integration
node_hud -->|"formats times"| node_time_utils
node_race_replay -->|"uses time helpers"| node_time_utils
node_data -->|"uses time helpers"| node_time_utils
node_data -->|"uses tyre helpers"| node_tyre_types
node_race_replay -->|"uses tyre helpers"| node_tyre_types
node_lap_chart -->|"uses time helpers"| node_time_utils
node_lap_chart -->|"uses tyre helpers"| node_tyre_types

click node_main "https://github.com/iamtomshaw/f1-race-replay/blob/main/main.py"
click node_gui_select "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/gui/race_selection.py"
click node_cli_select "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/cli/race_selection.py"
click node_season "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/lib/season.py"
click node_settings "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/lib/settings.py"
click node_data "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/f1_data.py"
click node_session_runner "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/run_session.py"
click node_race_replay "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/interfaces/race_replay.py"
click node_quali_replay "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/interfaces/qualifying.py"
click node_hud "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/ui_components.py"
click node_insights_menu "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/gui/insights_menu.py"
click node_pitwall "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/gui/pit_wall_window.py"
click node_driver_telemetry "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/insights/driver_telemetry_window.py"
click node_lap_chart "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/insights/lap_time_chart_window.py"
click node_track_positions "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/insights/track_position_window.py"
click node_tyre_strategy "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/insights/tyre_strategy_window.py"
click node_race_control "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/insights/race_control_feed_window.py"
click node_stream_viewer "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/insights/telemetry_stream_viewer.py"
click node_stream "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/services/stream.py"
click node_bayes_model "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/bayesian_tyre_model.py"
click node_tyre_integration "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/tyre_degradation_integration.py"
click node_time_utils "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/lib/time.py"
click node_tyre_types "https://github.com/iamtomshaw/f1-race-replay/blob/main/src/lib/tyres.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_gui_select,node_cli_select,node_season,node_settings,node_user toneBlue
class node_data,node_session_runner,node_race_replay,node_quali_replay,node_hud toneAmber
class node_insights_menu,node_pitwall,node_driver_telemetry,node_lap_chart,node_track_positions,node_tyre_strategy,node_race_control,node_stream_viewer toneMint
class node_stream,node_bayes_model,node_tyre_integration,node_time_utils,node_tyre_types toneRose
```

## Components

### Session selection

- [Application entry](https://github.com/iamtomshaw/f1-race-replay/blob/main/main.py): `main.py`
- [GUI selector](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/gui/race_selection.py): `src/gui/race_selection.py`
- [CLI selector](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/cli/race_selection.py): `src/cli/race_selection.py`
- [Season defaults](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/lib/season.py): `src/lib/season.py`
- [App settings](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/lib/settings.py): `src/lib/settings.py`

### Replay experience

- [Session telemetry](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/f1_data.py): `src/f1_data.py`
- [Replay launcher](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/run_session.py): `src/run_session.py`
- [Race replay](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/interfaces/race_replay.py): `src/interfaces/race_replay.py`
- [Qualifying replay](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/interfaces/qualifying.py): `src/interfaces/qualifying.py`
- [Replay HUD](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/ui_components.py): `src/ui_components.py`

### Telemetry insights

- [Insights menu](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/gui/insights_menu.py): `src/gui/insights_menu.py`
- [Pit wall window](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/gui/pit_wall_window.py): `src/gui/pit_wall_window.py`
- [Driver telemetry](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/insights/driver_telemetry_window.py): `src/insights/driver_telemetry_window.py`
- [Lap time charts](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/insights/lap_time_chart_window.py): `src/insights/lap_time_chart_window.py`
- [Track positions](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/insights/track_position_window.py): `src/insights/track_position_window.py`
- [Tyre strategy](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/insights/tyre_strategy_window.py): `src/insights/tyre_strategy_window.py`
- [Race control feed](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/insights/race_control_feed_window.py): `src/insights/race_control_feed_window.py`
- [Stream viewer](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/insights/telemetry_stream_viewer.py): `src/insights/telemetry_stream_viewer.py`

### Analysis and services

- [Telemetry stream](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/services/stream.py): `src/services/stream.py`
- [Bayesian tyre model](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/bayesian_tyre_model.py): `src/bayesian_tyre_model.py`
- [Tyre degradation](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/tyre_degradation_integration.py): `src/tyre_degradation_integration.py`
- [Time utilities](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/lib/time.py): `src/lib/time.py`
- [Tyre utilities](https://github.com/iamtomshaw/f1-race-replay/blob/main/src/lib/tyres.py): `src/lib/tyres.py`

### Other components

- **Race viewer**

## Connections

- Race viewer → GUI selector: chooses session (evidence: `README.md`)
- Race viewer → CLI selector: chooses session (evidence: `README.md`)
- Application entry → GUI selector: opens by default (evidence: `main.py`)
- Application entry → CLI selector: dispatches CLI (evidence: `main.py`)
- Application entry → Season defaults: gets default year (evidence: `main.py`)
- GUI selector → App settings: opens settings (evidence: `src/gui/race_selection.py`)
- Application entry → Session telemetry: loads and processes (evidence: `main.py`)
- Application entry → Replay launcher: starts race replay (evidence: `main.py`)
- Application entry → Qualifying replay: starts qualifying replay (evidence: `main.py`)
- Replay launcher → Race replay: creates window (evidence: `src/run_session.py`)
- Replay launcher → Insights menu: launches menu (evidence: `src/run_session.py`)
- Race replay → Session telemetry: uses telemetry (evidence: `src/interfaces/race_replay.py`)
- Race replay → Replay HUD: uses components (evidence: `src/interfaces/race_replay.py`)
- Qualifying replay → Session telemetry: uses telemetry (evidence: `src/interfaces/qualifying.py`)
- Qualifying replay → Replay HUD: uses components (evidence: `src/interfaces/qualifying.py`)
- Insights menu → Driver telemetry: launches view (evidence: `src/gui/insights_menu.py`)
- Insights menu → Lap time charts: launches view (evidence: `src/gui/insights_menu.py`)
- Insights menu → Track positions: launches view (evidence: `src/gui/insights_menu.py`)
- Insights menu → Tyre strategy: launches view (evidence: `src/gui/insights_menu.py`)
- Insights menu → Race control feed: launches view (evidence: `src/gui/insights_menu.py`)
- Driver telemetry → Pit wall window: extends window (evidence: `src/insights/driver_telemetry_window.py`)
- Lap time charts → Pit wall window: extends window (evidence: `src/insights/lap_time_chart_window.py`)
- Track positions → Pit wall window: extends window (evidence: `src/insights/track_position_window.py`)
- Tyre strategy → Pit wall window: extends window (evidence: `src/insights/tyre_strategy_window.py`)
- Race control feed → Pit wall window: extends window (evidence: `src/insights/race_control_feed_window.py`)
- Stream viewer → Telemetry stream: receives telemetry (evidence: `src/insights/telemetry_stream_viewer.py`)
- Race replay → Telemetry stream: publishes telemetry (evidence: `src/interfaces/race_replay.py`)
- Tyre degradation → Bayesian tyre model: uses model (evidence: `src/tyre_degradation_integration.py`)
- Replay HUD → Tyre degradation: uses degradation (evidence: `src/ui_components.py`)
- Replay HUD → Time utilities: formats times (evidence: `src/ui_components.py`)
- Race replay → Time utilities: uses time helpers (evidence: `src/interfaces/race_replay.py`)
- Session telemetry → Time utilities: uses time helpers (evidence: `src/f1_data.py`)
- Session telemetry → Tyre utilities: uses tyre helpers (evidence: `src/f1_data.py`)
- Race replay → Tyre utilities: uses tyre helpers (evidence: `src/interfaces/race_replay.py`)
- Lap time charts → Time utilities: uses time helpers (evidence: `src/insights/lap_time_chart_window.py`)
- Lap time charts → Tyre utilities: uses tyre helpers (evidence: `src/insights/lap_time_chart_window.py`)
