# teomewhy/f1-lake architecture

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

- Interactive diagram: https://gitdiagram.com/teomewhy/f1-lake
- Repository: https://github.com/teomewhy/f1-lake

## Overview

F1 Lake collects Formula 1 session results, uploads raw files, develops lakehouse feature data, trains a championship model, and presents prediction histories to users. The README describes Bronze, Silver, and Gold as lakehouse stages; sampled code shows collection, S3 upload, Silver feature-store processing, ABT export, training, model serving, and a Streamlit application. The UI’s prediction request targets a configured service, while the sampled Flask service exposes a different route; their connection is therefore not asserted.

Main entry points: [`etl/download_abt.py`](https://github.com/teomewhy/f1-lake/blob/main/etl/download_abt.py) (Champion ABT export), [`collect.py`](https://github.com/teomewhy/f1-lake/blob/main/collect.py) (Session collector), [`sender.py`](https://github.com/teomewhy/f1-lake/blob/main/sender.py) (S3 uploader), [`app/main.py`](https://github.com/teomewhy/f1-lake/blob/main/app/main.py) (Prediction dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Collection and delivery"]
  node_collector["Session collector<br/>[collect.py]"]
  node_local["Parquet files"]
  node_orchestrator["Collection runner<br/>[main.py]"]
  node_sender["S3 uploader<br/>[sender.py]"]
end

subgraph group_lakehouse["Lakehouse processing"]
  node_bronze[("Bronze tables")]
  node_silver[("Silver tables")]
  node_gold[("Gold reports")]
  node_feature["Driver feature store<br/>[main.py]"]
  node_champions["Champion labels<br/>[abt_champions.sql]"]
  node_abt["Champion ABT export<br/>[download_abt.py]"]
end

subgraph group_model["Model lifecycle"]
  node_abtfile["ABT dataset"]
  node_trainer["Model training<br/>[train.py]"]
  node_api["Prediction API<br/>[app.py]"]
end

subgraph group_experience["Prediction experience"]
  node_dashboard["Prediction dashboard<br/>[main.py]"]
end

node_fan(("F1 data source"))
node_s3[("Raw S3 bucket")]
node_registry[("MLflow registry")]
node_user(("F1 enthusiast"))
node_featuredb[("Feature database")]
node_prediction_service["Prediction service"]

node_orchestrator -->|"runs collection"| node_collector
node_collector -->|"fetches sessions"| node_fan
node_collector -->|"writes Parquet"| node_local
node_orchestrator -->|"runs upload"| node_sender
node_sender -->|"reads files"| node_local
node_sender -->|"uploads files"| node_s3
node_s3 -.->|"raw ingestion"| node_bronze
node_bronze -.->|"models data"| node_silver
node_silver -.->|"summarizes data"| node_gold
node_feature -->|"loads and saves"| node_silver
node_champions -.->|"labels source"| node_silver
node_abt -->|"loads features"| node_silver
node_abt -->|"joins labels"| node_champions
node_abt -->|"exports CSV"| node_abtfile
node_trainer -->|"reads dataset"| node_abtfile
node_trainer -->|"logs model"| node_registry
node_api -->|"loads model"| node_registry
node_user -->|"views predictions"| node_dashboard
node_dashboard -->|"queries drivers"| node_featuredb
node_dashboard -->|"requests predictions"| node_prediction_service
node_api -.->|"serves predictions"| node_prediction_service

click node_collector "https://github.com/teomewhy/f1-lake/blob/main/collect.py"
click node_local "https://github.com/teomewhy/f1-lake/tree/main/data"
click node_orchestrator "https://github.com/teomewhy/f1-lake/blob/main/main.py"
click node_sender "https://github.com/teomewhy/f1-lake/blob/main/sender.py"
click node_feature "https://github.com/teomewhy/f1-lake/blob/main/etl/main.py"
click node_champions "https://github.com/teomewhy/f1-lake/blob/main/etl/abt_champions.sql"
click node_abt "https://github.com/teomewhy/f1-lake/blob/main/etl/download_abt.py"
click node_abtfile "https://github.com/teomewhy/f1-lake/tree/main/data"
click node_trainer "https://github.com/teomewhy/f1-lake/blob/main/ml_champion/train.py"
click node_api "https://github.com/teomewhy/f1-lake/blob/main/ml_champion/app.py"
click node_dashboard "https://github.com/teomewhy/f1-lake/blob/main/app/main.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_collector,node_local,node_orchestrator,node_sender toneBlue
class node_bronze,node_silver,node_gold,node_feature,node_champions,node_abt,node_s3,node_registry,node_featuredb toneAmber
class node_abtfile,node_trainer,node_api toneMint
class node_dashboard toneRose
class node_fan,node_user,node_prediction_service toneIndigo
```

## Components

### Collection and delivery

- [Session collector](https://github.com/teomewhy/f1-lake/blob/main/collect.py): `collect.py`
- [Parquet files](https://github.com/teomewhy/f1-lake/tree/main/data): `data`
- [Collection runner](https://github.com/teomewhy/f1-lake/blob/main/main.py): `main.py`
- [S3 uploader](https://github.com/teomewhy/f1-lake/blob/main/sender.py): `sender.py`

### Lakehouse processing

- **Bronze tables**
- **Silver tables**
- **Gold reports**
- [Driver feature store](https://github.com/teomewhy/f1-lake/blob/main/etl/main.py): `etl/main.py`
- [Champion labels](https://github.com/teomewhy/f1-lake/blob/main/etl/abt_champions.sql): `etl/abt_champions.sql`
- [Champion ABT export](https://github.com/teomewhy/f1-lake/blob/main/etl/download_abt.py): `etl/download_abt.py`

### Model lifecycle

- [ABT dataset](https://github.com/teomewhy/f1-lake/tree/main/data): `data`
- [Model training](https://github.com/teomewhy/f1-lake/blob/main/ml_champion/train.py): `ml_champion/train.py`
- [Prediction API](https://github.com/teomewhy/f1-lake/blob/main/ml_champion/app.py): `ml_champion/app.py`

### Prediction experience

- [Prediction dashboard](https://github.com/teomewhy/f1-lake/blob/main/app/main.py): `app/main.py`

### Other components

- **F1 data source**
- **Raw S3 bucket**
- **MLflow registry**
- **F1 enthusiast**
- **Feature database**
- **Prediction service**

## Connections

- Collection runner → Session collector: runs collection (evidence: `main.py`)
- Session collector → F1 data source: fetches sessions (evidence: `collect.py`)
- Session collector → Parquet files: writes Parquet (evidence: `collect.py`)
- Collection runner → S3 uploader: runs upload (evidence: `main.py`)
- S3 uploader → Parquet files: reads files (evidence: `sender.py`)
- S3 uploader → Raw S3 bucket: uploads files (evidence: `sender.py`)
- Raw S3 bucket → Bronze tables: raw ingestion (evidence: `README.md`)
- Bronze tables → Silver tables: models data (evidence: `README.md`)
- Silver tables → Gold reports: summarizes data (evidence: `README.md`)
- Driver feature store → Silver tables: loads and saves (evidence: `etl/main.py`)
- Champion labels → Silver tables: labels source
- Champion ABT export → Silver tables: loads features (evidence: `etl/download_abt.py`)
- Champion ABT export → Champion labels: joins labels (evidence: `etl/download_abt.py`)
- Champion ABT export → ABT dataset: exports CSV (evidence: `etl/download_abt.py`)
- Model training → ABT dataset: reads dataset (evidence: `ml_champion/train.py`)
- Model training → MLflow registry: logs model (evidence: `ml_champion/train.py`)
- Prediction API → MLflow registry: loads model (evidence: `ml_champion/app.py`)
- F1 enthusiast → Prediction dashboard: views predictions (evidence: `README.md`)
- Prediction dashboard → Feature database: queries drivers (evidence: `app/main.py`)
- Prediction dashboard → Prediction service: requests predictions (evidence: `app/main.py`)
- Prediction API → Prediction service: serves predictions
