# sailaja2016/f1-tyre-optimizer architecture

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

- Interactive diagram: https://gitdiagram.com/sailaja2016/f1-tyre-optimizer
- Repository: https://github.com/sailaja2016/f1-tyre-optimizer

## Overview

This is an interactive F1 tyre-degradation and race-strategy simulator. Users configure a race, inspect simulated tyre wear and ranked pit strategies, then request an AI-generated briefing. The README describes the browser-side simulation and dashboard, while the sampled backend shows Flask serving the page and forwarding briefing prompts to Groq. The README calls the AI Claude, but the sampled code uses Groq; the frontend implementation was not sampled, so its internal wiring is represented only where documented.

Main entry points: [`templates/index.html`](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html) (Interactive dashboard), [`app.py`](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/app.py) (Briefing endpoint), [`api/strategy.py`](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/api/strategy.py) (Serverless briefing handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Race dashboard"]
  node_dashboard["Interactive dashboard<br/>[index.html]"]
  node_race_inputs["Race parameters<br/>[index.html]"]
  node_wear_simulator["Wear simulator<br/>[index.html]"]
  node_results_views["Charts and strategy table<br/>[index.html]"]
  node_briefing_view["Briefing display<br/>[index.html]"]
end

subgraph group_simulation["Race simulation"]
  node_degradation["Tyre degradation model<br/>[index.html]"]
  node_compound_curves["Compound curves<br/>[index.html]"]
  node_pace_analysis["Lap pace analysis<br/>[index.html]"]
  node_strategy_search["Pit strategy search<br/>[index.html]"]
  node_strategy_ranking["Strategy ranking<br/>[index.html]"]
end

subgraph group_briefing["AI briefing"]
end

subgraph group_backend["Web backend"]
  node_flask_app["Flask application<br/>[app.py]"]
  node_briefing_endpoint["Briefing endpoint<br/>[app.py]"]
  node_serverless_endpoint["Serverless briefing handler<br/>[strategy.py]"]
end

node_racing_user(("Race user"))
node_groq["Groq chat API"]

node_racing_user -->|"configures and views"| node_dashboard
node_dashboard -->|"collects"| node_race_inputs
node_race_inputs -->|"sets simulation inputs"| node_degradation
node_degradation -->|"calculates tyre life"| node_compound_curves
node_degradation -->|"calculates lap deltas"| node_pace_analysis
node_strategy_search -->|"ranks by race time"| node_strategy_ranking
node_race_inputs -->|"defines race scenario"| node_strategy_search
node_compound_curves -->|"informs strategy evaluation"| node_strategy_search
node_compound_curves -->|"shows wear state"| node_wear_simulator
node_compound_curves -->|"plots degradation"| node_results_views
node_pace_analysis -->|"plots lap deltas"| node_results_views
node_strategy_ranking -->|"populates strategy table"| node_results_views
node_racing_user -->|"requests briefing"| node_briefing_view
node_dashboard -->|"requests page"| node_flask_app
node_flask_app -->|"serves page"| node_dashboard
node_dashboard -->|"posts simulation results"| node_briefing_endpoint
node_briefing_endpoint -->|"sends prompt"| node_groq
node_groq -->|"returns briefing text"| node_briefing_endpoint
node_briefing_endpoint -->|"returns briefing"| node_briefing_view
node_serverless_endpoint -->|"sends prompt"| node_groq

click node_dashboard "https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html"
click node_race_inputs "https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html"
click node_degradation "https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html"
click node_compound_curves "https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html"
click node_pace_analysis "https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html"
click node_strategy_search "https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html"
click node_strategy_ranking "https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html"
click node_wear_simulator "https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html"
click node_results_views "https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html"
click node_briefing_view "https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html"
click node_flask_app "https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/app.py"
click node_briefing_endpoint "https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/app.py"
click node_serverless_endpoint "https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/api/strategy.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_dashboard,node_race_inputs,node_wear_simulator,node_results_views,node_briefing_view,node_racing_user toneBlue
class node_degradation,node_compound_curves,node_pace_analysis,node_strategy_search,node_strategy_ranking toneAmber
class node_flask_app,node_briefing_endpoint,node_serverless_endpoint toneRose
class node_groq toneMint
```

## Components

### Race dashboard

- [Interactive dashboard](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html): `templates/index.html`
- [Race parameters](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html): `templates/index.html`
- [Wear simulator](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html): `templates/index.html`
- [Charts and strategy table](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html): `templates/index.html`
- [Briefing display](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html): `templates/index.html`

### Race simulation

- [Tyre degradation model](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html): `templates/index.html`
- [Compound curves](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html): `templates/index.html`
- [Lap pace analysis](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html): `templates/index.html`
- [Pit strategy search](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html): `templates/index.html`
- [Strategy ranking](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/templates/index.html): `templates/index.html`

### Web backend

- [Flask application](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/app.py): `app.py`
- [Briefing endpoint](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/app.py): `app.py`
- [Serverless briefing handler](https://github.com/sailaja2016/f1-tyre-optimizer/blob/main/api/strategy.py): `api/strategy.py`

### Other components

- **Race user**
- **Groq chat API**

## Connections

- Race user → Interactive dashboard: configures and views (evidence: `README.md`)
- Interactive dashboard → Race parameters: collects (evidence: `README.md`)
- Race parameters → Tyre degradation model: sets simulation inputs (evidence: `README.md`)
- Tyre degradation model → Compound curves: calculates tyre life (evidence: `README.md`)
- Tyre degradation model → Lap pace analysis: calculates lap deltas (evidence: `README.md`)
- Pit strategy search → Strategy ranking: ranks by race time (evidence: `README.md`)
- Race parameters → Pit strategy search: defines race scenario (evidence: `README.md`)
- Compound curves → Pit strategy search: informs strategy evaluation (evidence: `README.md`)
- Compound curves → Wear simulator: shows wear state (evidence: `README.md`)
- Compound curves → Charts and strategy table: plots degradation (evidence: `README.md`)
- Lap pace analysis → Charts and strategy table: plots lap deltas (evidence: `README.md`)
- Strategy ranking → Charts and strategy table: populates strategy table (evidence: `README.md`)
- Race user → Briefing display: requests briefing (evidence: `README.md`)
- Interactive dashboard → Flask application: requests page (evidence: `app.py`)
- Flask application → Interactive dashboard: serves page (evidence: `app.py`)
- Interactive dashboard → Briefing endpoint: posts simulation results (evidence: `README.md`)
- Briefing endpoint → Groq chat API: sends prompt (evidence: `app.py`)
- Groq chat API → Briefing endpoint: returns briefing text (evidence: `app.py`)
- Briefing endpoint → Briefing display: returns briefing (evidence: `README.md`)
- Serverless briefing handler → Groq chat API: sends prompt (evidence: `api/strategy.py`)
