# luispv05/f1-analysis architecture

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

- Interactive diagram: https://gitdiagram.com/luispv05/f1-analysis
- Repository: https://github.com/luispv05/f1-analysis

## Overview

F1-Analysis is a Python package and set of command-line tools for race, season, constructor, teammate, and multi-season analysis. Users supply seasons, rounds, or drivers; the tools retrieve Jolpica-backed data, compute domain summaries, and generate charts or an interactive season report. The graph preserves the documented analysis branches and core modules. Edges are limited to calls visible in excerpts, indexed imports, or README-described workflows; unsampled implementation details are not inferred.

Main entry points: [`src/f1analysis/season.py`](https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/season.py) (Season analysis), [`src/main.py`](https://github.com/luispv05/f1-analysis/blob/main/src/main.py) (Race command), [`src/main_constructors.py`](https://github.com/luispv05/f1-analysis/blob/main/src/main_constructors.py) (Constructor command), [`src/f1analysis/history.py`](https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/history.py) (History analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_race["Race analysis"]
  node_race_cli["Race command<br/>[main.py]"]
  node_race_calc["Race calculations<br/>[analysis.py]"]
  node_race_charts["Race charts<br/>[plots.py]"]
end

subgraph group_season["Championship analysis"]
  node_season_cli["Season command<br/>[main_season.py]"]
  node_season_calc["Season analysis<br/>[season.py]"]
  node_season_charts["Season charts<br/>[season_plots.py]"]
  node_constructor_cli["Constructor command"]
  node_constructor_calc["Constructor analysis<br/>[constructors.py]"]
  node_constructor_charts["Constructor charts"]
end

subgraph group_comparisons["Driver comparisons"]
  node_history_cli["History command<br/>[main_history.py]"]
  node_history_calc["History analysis<br/>[history.py]"]
  node_history_charts["History charts<br/>[history_plots.py]"]
  node_teammates_cli["Teammate command<br/>[main_teammates.py]"]
  node_teammate_calc["Teammate analysis<br/>[teammates.py]"]
  node_teammate_charts["Teammate charts<br/>[teammates_plots.py]"]
  node_driver_cli["Driver command<br/>[main_drivers.py]"]
end

subgraph group_shared["Shared data and presentation"]
  node_race_data["Race data<br/>[data.py]"]
  node_styling["Chart styling<br/>[styling.py]"]
  node_cache[("Disk cache<br/>[cache.py]")]
end

node_user(("CLI user"))
node_jolpica{{"Jolpica API"}}

node_user -->|"runs"| node_race_cli
node_race_cli -->|"loads results"| node_race_data
node_race_cli -->|"calculates laps"| node_race_calc
node_race_cli -->|"creates charts"| node_race_charts
node_race_data -->|"fetches data"| node_jolpica
node_race_data -->|"reads and writes"| node_cache
node_race_charts -->|"uses lap helpers"| node_race_calc
node_race_charts -->|"uses styles"| node_styling
node_user -->|"runs"| node_season_cli
node_season_cli -->|"analyzes season"| node_season_calc
node_season_cli -->|"creates reports"| node_season_charts
node_season_calc -->|"fetches standings"| node_jolpica
node_season_calc -->|"reads and writes"| node_cache
node_user -->|"runs"| node_constructor_cli
node_constructor_cli -->|"analyzes teams"| node_constructor_calc
node_constructor_cli -->|"creates charts"| node_constructor_charts
node_constructor_cli -->|"creates heatmap"| node_season_charts
node_constructor_calc -->|"uses cached data"| node_cache
node_constructor_calc -->|"reuses season logic"| node_season_calc
node_constructor_charts -->|"uses heatmap"| node_season_charts
node_constructor_charts -->|"uses styles"| node_styling
node_user -->|"runs"| node_history_cli
node_history_cli -->|"compares seasons"| node_history_calc
node_history_cli -->|"creates charts"| node_history_charts
node_history_calc -->|"reads and writes"| node_cache
node_history_calc -->|"uses retry logic"| node_season_calc
node_history_charts -->|"uses team colors"| node_styling
node_user -->|"runs"| node_driver_cli
node_driver_cli -->|"compares drivers"| node_history_calc
node_driver_cli -->|"creates charts"| node_history_charts
node_user -->|"runs"| node_teammates_cli
node_teammates_cli -->|"analyzes duels"| node_teammate_calc
node_teammates_cli -->|"creates charts"| node_teammate_charts
node_teammate_calc -->|"loads race data"| node_race_data
node_teammate_calc -->|"uses retry logic"| node_season_calc
node_teammate_charts -->|"uses styles"| node_styling

click node_race_cli "https://github.com/luispv05/f1-analysis/blob/main/src/main.py"
click node_race_data "https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/data.py"
click node_race_calc "https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/analysis.py"
click node_race_charts "https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/plots.py"
click node_season_cli "https://github.com/luispv05/f1-analysis/blob/main/src/main_season.py"
click node_season_calc "https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/season.py"
click node_season_charts "https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/season_plots.py"
click node_constructor_cli "https://github.com/luispv05/f1-analysis/blob/main/src/main_constructors.py"
click node_constructor_calc "https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/constructors.py"
click node_constructor_charts "https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/constructors_plots.py"
click node_history_cli "https://github.com/luispv05/f1-analysis/blob/main/src/main_history.py"
click node_history_calc "https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/history.py"
click node_history_charts "https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/history_plots.py"
click node_teammates_cli "https://github.com/luispv05/f1-analysis/blob/main/src/main_teammates.py"
click node_teammate_calc "https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/teammates.py"
click node_teammate_charts "https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/teammates_plots.py"
click node_driver_cli "https://github.com/luispv05/f1-analysis/blob/main/src/main_drivers.py"
click node_styling "https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/styling.py"
click node_cache "https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/cache.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_race_cli,node_race_calc,node_race_charts,node_user toneBlue
class node_season_cli,node_season_calc,node_season_charts,node_constructor_cli,node_constructor_calc,node_constructor_charts toneAmber
class node_history_cli,node_history_calc,node_history_charts,node_teammates_cli,node_teammate_calc,node_teammate_charts,node_driver_cli,node_jolpica toneMint
class node_race_data,node_styling,node_cache toneRose
```

## Components

### Race analysis

- [Race command](https://github.com/luispv05/f1-analysis/blob/main/src/main.py): `src/main.py`
- [Race calculations](https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/analysis.py): `src/f1analysis/analysis.py`
- [Race charts](https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/plots.py): `src/f1analysis/plots.py`

### Championship analysis

- [Season command](https://github.com/luispv05/f1-analysis/blob/main/src/main_season.py): `src/main_season.py`
- [Season analysis](https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/season.py): `src/f1analysis/season.py`
- [Season charts](https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/season_plots.py): `src/f1analysis/season_plots.py`
- [Constructor command](https://github.com/luispv05/f1-analysis/blob/main/src/main_constructors.py): `src/main_constructors.py`
- [Constructor analysis](https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/constructors.py): `src/f1analysis/constructors.py`
- [Constructor charts](https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/constructors_plots.py): `src/f1analysis/constructors_plots.py`

### Driver comparisons

- [History command](https://github.com/luispv05/f1-analysis/blob/main/src/main_history.py): `src/main_history.py`
- [History analysis](https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/history.py): `src/f1analysis/history.py`
- [History charts](https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/history_plots.py): `src/f1analysis/history_plots.py`
- [Teammate command](https://github.com/luispv05/f1-analysis/blob/main/src/main_teammates.py): `src/main_teammates.py`
- [Teammate analysis](https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/teammates.py): `src/f1analysis/teammates.py`
- [Teammate charts](https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/teammates_plots.py): `src/f1analysis/teammates_plots.py`
- [Driver command](https://github.com/luispv05/f1-analysis/blob/main/src/main_drivers.py): `src/main_drivers.py`

### Shared data and presentation

- [Race data](https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/data.py): `src/f1analysis/data.py`
- [Chart styling](https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/styling.py): `src/f1analysis/styling.py`
- [Disk cache](https://github.com/luispv05/f1-analysis/blob/main/src/f1analysis/cache.py): `src/f1analysis/cache.py`

### Other components

- **CLI user**
- **Jolpica API**

## Connections

- CLI user → Race command: runs (evidence: `README.md`)
- Race command → Race data: loads results (evidence: `src/main.py`)
- Race command → Race calculations: calculates laps (evidence: `src/main.py`)
- Race command → Race charts: creates charts (evidence: `src/main.py`)
- Race data → Jolpica API: fetches data (evidence: `src/f1analysis/data.py`)
- Race data → Disk cache: reads and writes (evidence: `src/f1analysis/data.py`)
- Race charts → Race calculations: uses lap helpers (evidence: `src/f1analysis/plots.py`)
- Race charts → Chart styling: uses styles (evidence: `src/f1analysis/plots.py`)
- CLI user → Season command: runs (evidence: `README.md`)
- Season command → Season analysis: analyzes season (evidence: `src/main_season.py`)
- Season command → Season charts: creates reports (evidence: `src/main_season.py`)
- Season analysis → Jolpica API: fetches standings (evidence: `src/f1analysis/season.py`)
- Season analysis → Disk cache: reads and writes (evidence: `src/f1analysis/season.py`)
- CLI user → Constructor command: runs (evidence: `README.md`)
- Constructor command → Constructor analysis: analyzes teams (evidence: `src/main_constructors.py`)
- Constructor command → Constructor charts: creates charts (evidence: `src/main_constructors.py`)
- Constructor command → Season charts: creates heatmap (evidence: `src/main_constructors.py`)
- Constructor analysis → Disk cache: uses cached data (evidence: `src/f1analysis/constructors.py`)
- Constructor analysis → Season analysis: reuses season logic (evidence: `src/f1analysis/constructors.py`)
- Constructor charts → Season charts: uses heatmap (evidence: `src/f1analysis/constructors_plots.py`)
- Constructor charts → Chart styling: uses styles (evidence: `src/f1analysis/constructors_plots.py`)
- CLI user → History command: runs (evidence: `README.md`)
- History command → History analysis: compares seasons (evidence: `src/main_history.py`)
- History command → History charts: creates charts (evidence: `src/main_history.py`)
- History analysis → Disk cache: reads and writes (evidence: `src/f1analysis/history.py`)
- History analysis → Season analysis: uses retry logic (evidence: `src/f1analysis/history.py`)
- History charts → Chart styling: uses team colors (evidence: `src/f1analysis/history_plots.py`)
- CLI user → Driver command: runs (evidence: `README.md`)
- Driver command → History analysis: compares drivers (evidence: `src/main_drivers.py`)
- Driver command → History charts: creates charts (evidence: `src/main_drivers.py`)
- CLI user → Teammate command: runs (evidence: `README.md`)
- Teammate command → Teammate analysis: analyzes duels (evidence: `src/main_teammates.py`)
- Teammate command → Teammate charts: creates charts (evidence: `src/main_teammates.py`)
- Teammate analysis → Race data: loads race data (evidence: `src/f1analysis/teammates.py`)
- Teammate analysis → Season analysis: uses retry logic (evidence: `src/f1analysis/teammates.py`)
- Teammate charts → Chart styling: uses styles (evidence: `src/f1analysis/teammates_plots.py`)
