# akshit-saharia/urgency_aware_race_strategy_prediction architecture

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

- Interactive diagram: https://gitdiagram.com/akshit-saharia/urgency_aware_race_strategy_prediction
- Repository: https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction

## Overview

This repository predicts F1 pit-stop and tire decisions from race telemetry. Its principal workflow loads or generates readings, applies urgency scoring, schedules requests, routes them to a fast or smart model, and optionally persists telemetry and predictions. The graph also preserves the documented cloud-serving and scheduling-experiment branches. Some pipeline calls are only partially excerpted; workflow edges therefore rely on the README’s explicit description, and unsampled implementation details are not inferred.

Main entry points: [`integration/pipeline.py`](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/integration/pipeline.py) (Replay pipeline), [`data_pipeline/fastf1_loader.py`](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/data_pipeline/fastf1_loader.py) (FastF1 loader), [`os_layer/router.py`](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/os_layer/router.py) (Model router), [`ml/smart_model.py`](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/ml/smart_model.py) (Smart model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Telemetry and contracts"]
  node_fastf1["FastF1 loader<br/>[fastf1_loader.py]"]
  node_mock_data["Mock generator"]
  node_contracts["Telemetry contracts<br/>[schema.py]"]
  node_prediction["Prediction request<br/>[schema.py]"]
end

subgraph group_scheduling["Urgency and scheduling"]
  node_urgency["Urgency classifier"]
  node_scheduler["Priority scheduler<br/>[priority_queue.py]"]
  node_router["Model router<br/>[router.py]"]
end

subgraph group_inference["Prediction models"]
  node_features["Feature engineering<br/>[features.py]"]
  node_fast_model["Fast model<br/>[fast_model.py]"]
  node_smart_model["Smart model<br/>[smart_model.py]"]
end

subgraph group_storage["Persistence and cache"]
  node_redis[("Redis cache<br/>[redis_cache.py]")]
  node_cassandra[("Cassandra client")]
end

subgraph group_serving["Serving and experiments"]
  node_pipeline["Replay pipeline<br/>[pipeline.py]"]
  node_queue_experiment["Queueing experiment"]
  node_cloud_handler["Cloud handler<br/>[lambda_handler.py]"]
end

node_race_data(("Race data"))

node_race_data -->|"loads telemetry"| node_fastf1
node_mock_data -->|"creates readings"| node_contracts
node_fastf1 -->|"creates readings"| node_contracts
node_mock_data -->|"supplies replay data"| node_pipeline
node_fastf1 -->|"can replace mock input"| node_pipeline
node_pipeline -->|"classifies readings"| node_urgency
node_urgency -->|"creates request"| node_prediction
node_pipeline -->|"schedules requests"| node_scheduler
node_pipeline -->|"routes requests"| node_router
node_router -->|"selects urgent path"| node_fast_model
node_router -->|"selects smart path"| node_smart_model
node_fast_model -->|"builds feature matrix"| node_features
node_smart_model -->|"builds sequences"| node_features
node_pipeline -->|"optionally persists"| node_redis
node_pipeline -->|"optionally persists"| node_cassandra
node_redis -->|"caches lookups ahead of"| node_cassandra
node_cloud_handler -->|"runs inference with"| node_smart_model
node_pipeline -->|"returns results as"| node_prediction
node_queue_experiment -->|"compares scheduling"| node_scheduler

click node_fastf1 "https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/data_pipeline/fastf1_loader.py"
click node_mock_data "https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/data_pipeline/mock_data_generator.py"
click node_contracts "https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/data_pipeline/schema.py"
click node_urgency "https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/os_layer/urgency_classifier.py"
click node_scheduler "https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/os_layer/priority_queue.py"
click node_router "https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/os_layer/router.py"
click node_features "https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/ml/features.py"
click node_fast_model "https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/ml/fast_model.py"
click node_smart_model "https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/ml/smart_model.py"
click node_pipeline "https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/integration/pipeline.py"
click node_queue_experiment "https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/integration/experiment_queueing.py"
click node_cloud_handler "https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/cloud/lambda_handler.py"
click node_redis "https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/db/redis_cache.py"
click node_cassandra "https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/db/cassandra_client.py"
click node_prediction "https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/data_pipeline/schema.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_fastf1,node_mock_data,node_contracts,node_prediction toneBlue
class node_urgency,node_scheduler,node_router toneAmber
class node_features,node_fast_model,node_smart_model toneMint
class node_redis,node_cassandra toneRose
class node_pipeline,node_queue_experiment,node_cloud_handler,node_race_data toneIndigo
```

## Components

### Telemetry and contracts

- [FastF1 loader](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/data_pipeline/fastf1_loader.py): `data_pipeline/fastf1_loader.py`
- [Mock generator](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/data_pipeline/mock_data_generator.py): `data_pipeline/mock_data_generator.py`
- [Telemetry contracts](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/data_pipeline/schema.py): `data_pipeline/schema.py`
- [Prediction request](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/data_pipeline/schema.py): `data_pipeline/schema.py`

### Urgency and scheduling

- [Urgency classifier](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/os_layer/urgency_classifier.py): `os_layer/urgency_classifier.py`
- [Priority scheduler](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/os_layer/priority_queue.py): `os_layer/priority_queue.py`
- [Model router](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/os_layer/router.py): `os_layer/router.py`

### Prediction models

- [Feature engineering](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/ml/features.py): `ml/features.py`
- [Fast model](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/ml/fast_model.py): `ml/fast_model.py`
- [Smart model](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/ml/smart_model.py): `ml/smart_model.py`

### Persistence and cache

- [Redis cache](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/db/redis_cache.py): `db/redis_cache.py`
- [Cassandra client](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/db/cassandra_client.py): `db/cassandra_client.py`

### Serving and experiments

- [Replay pipeline](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/integration/pipeline.py): `integration/pipeline.py`
- [Queueing experiment](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/integration/experiment_queueing.py): `integration/experiment_queueing.py`
- [Cloud handler](https://github.com/akshit-saharia/urgency_aware_race_strategy_prediction/blob/main/cloud/lambda_handler.py): `cloud/lambda_handler.py`

### Other components

- **Race data**

## Connections

- Race data → FastF1 loader: loads telemetry (evidence: `README.md`)
- Mock generator → Telemetry contracts: creates readings (evidence: `data_pipeline/mock_data_generator.py`)
- FastF1 loader → Telemetry contracts: creates readings (evidence: `data_pipeline/fastf1_loader.py`)
- Mock generator → Replay pipeline: supplies replay data (evidence: `README.md`)
- FastF1 loader → Replay pipeline: can replace mock input (evidence: `README.md`)
- Replay pipeline → Urgency classifier: classifies readings (evidence: `README.md`)
- Urgency classifier → Prediction request: creates request (evidence: `os_layer/urgency_classifier.py`)
- Replay pipeline → Priority scheduler: schedules requests (evidence: `README.md`)
- Replay pipeline → Model router: routes requests (evidence: `README.md`)
- Model router → Fast model: selects urgent path (evidence: `os_layer/router.py`)
- Model router → Smart model: selects smart path (evidence: `os_layer/router.py`)
- Fast model → Feature engineering: builds feature matrix (evidence: `ml/fast_model.py`)
- Smart model → Feature engineering: builds sequences (evidence: `ml/smart_model.py`)
- Replay pipeline → Redis cache: optionally persists (evidence: `README.md`)
- Replay pipeline → Cassandra client: optionally persists (evidence: `README.md`)
- Redis cache → Cassandra client: caches lookups ahead of (evidence: `db/redis_cache.py`)
- Cloud handler → Smart model: runs inference with (evidence: `cloud/lambda_handler.py`)
- Replay pipeline → Prediction request: returns results as (evidence: `data_pipeline/schema.py`)
- Queueing experiment → Priority scheduler: compares scheduling (evidence: `README.md`)
