# vibhavpan/adas-sotif-validation-copilot architecture

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

- Interactive diagram: https://gitdiagram.com/vibhavpan/adas-sotif-validation-copilot
- Repository: https://github.com/vibhavpan/adas-sotif-validation-copilot

## Overview

ADAS Validation Copilot accepts an OpenSCENARIO file and telemetry log, runs a LangGraph triage-and-repair workflow, simulates the proposed scenario, and returns diagnosis, patch, and simulation results for display. The graph preserves the distinct preflight, diagnosis, patch generation, patch validation, and simulation stages, plus the frontend/API boundary and indexed database modules. Workflow call relationships are supported by its excerpt; unsampled database usage and the separate graph nodes module are shown without inferred connections.

Main entry points: [`backend/app/graph/workflow.py`](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/workflow.py) (Workflow Engine), [`backend/app/core/llm.py`](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/core/llm.py) (LLM Client), [`frontend/src/App.tsx`](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/frontend/src/App.tsx) (Validation Dashboard), [`frontend/src/services/api.ts`](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/frontend/src/services/api.ts) (API Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_frontend["Validation Dashboard<br/>[App.tsx]"]
  node_api_client["API Client<br/>[api.ts]"]
end

subgraph group_workflow["Triage Workflow"]
  node_backend_api["Validation API<br/>[main.py]"]
  node_agent_state["Agent State<br/>[state.py]"]
  node_workflow_engine["Workflow Engine<br/>[workflow.py]"]
  node_graph_nodes["Graph Nodes<br/>[nodes.py]"]
  node_graph_state["Graph State<br/>[state.py]"]
end

subgraph group_analysis["Analysis and Simulation"]
  node_preflight["Preflight Checks<br/>[workflow.py]"]
  node_xml_parser["XML Validation<br/>[xml_parser.py]"]
  node_telemetry_window["Telemetry Window<br/>[log_windower.py]"]
  node_diagnosis["Failure Diagnosis<br/>[workflow.py]"]
  node_patch_generation["Patch Generation<br/>[workflow.py]"]
  node_patch_validation["Patch Validation<br/>[workflow.py]"]
  node_simulation["Scenario Simulation<br/>[workflow.py]"]
  node_sim_runner["esmini Runner<br/>[esmini_runner.py]"]
end

subgraph group_platform["Platform Services"]
  node_llm_client["LLM Client<br/>[llm.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_database[("SQL Database Access<br/>[database.py]")]
  node_vector_store[("Vector Store<br/>[vector_store.py]")]
  node_db_module["DB Module<br/>[db.py]"]
end

node_user(("User"))
node_esmini["esmini Container"]
node_llm["Gemini Service"]

node_user -->|"uploads files"| node_frontend
node_frontend -->|"submits validation"| node_api_client
node_api_client -->|"posts files"| node_backend_api
node_backend_api -->|"invokes workflow"| node_workflow_engine
node_workflow_engine -->|"starts at"| node_preflight
node_preflight -->|"validates XML"| node_xml_parser
node_preflight -->|"extracts window"| node_telemetry_window
node_workflow_engine -->|"dispatches stage"| node_diagnosis
node_diagnosis -->|"requests diagnosis"| node_llm
node_workflow_engine -->|"dispatches stage"| node_patch_generation
node_patch_generation -->|"requests patch"| node_llm
node_workflow_engine -->|"validates patch"| node_patch_validation
node_patch_validation -->|"retries patch"| node_patch_generation
node_workflow_engine -->|"dispatches stage"| node_simulation
node_simulation -->|"runs scenario"| node_sim_runner
node_sim_runner -->|"launches container"| node_esmini
node_workflow_engine -.-> node_graph_nodes
node_workflow_engine -.-> node_agent_state
node_workflow_engine -.-> node_graph_state
node_llm_client -->|"reads settings"| node_config
node_llm_client -->|"invokes model"| node_llm
node_database -->|"reads settings"| node_config
node_vector_store -.-> node_database

click node_frontend "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/frontend/src/services/api.ts"
click node_backend_api "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/main.py"
click node_agent_state "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/agent/state.py"
click node_workflow_engine "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/workflow.py"
click node_graph_nodes "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/nodes.py"
click node_graph_state "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/state.py"
click node_preflight "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/workflow.py"
click node_xml_parser "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/mcp/xml_parser.py"
click node_telemetry_window "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/mcp/log_windower.py"
click node_diagnosis "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/workflow.py"
click node_patch_generation "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/workflow.py"
click node_patch_validation "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/workflow.py"
click node_simulation "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/workflow.py"
click node_sim_runner "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/sim/esmini_runner.py"
click node_llm_client "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/core/llm.py"
click node_config "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/core/config.py"
click node_database "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/db/database.py"
click node_vector_store "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/db/vector_store.py"
click node_db_module "https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/db/db.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_frontend,node_api_client,node_user toneBlue
class node_backend_api,node_agent_state,node_workflow_engine,node_graph_nodes,node_graph_state toneAmber
class node_preflight,node_xml_parser,node_telemetry_window,node_diagnosis,node_patch_generation,node_patch_validation,node_simulation,node_sim_runner toneMint
class node_llm_client,node_config,node_database,node_vector_store,node_db_module toneRose
class node_esmini,node_llm toneIndigo
```

## Components

### User Interface

- [Validation Dashboard](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API Client](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Triage Workflow

- [Validation API](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/main.py): `backend/main.py`
- [Agent State](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/agent/state.py): `backend/app/agent/state.py`
- [Workflow Engine](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/workflow.py): `backend/app/graph/workflow.py`
- [Graph Nodes](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/nodes.py): `backend/app/graph/nodes.py`
- [Graph State](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/state.py): `backend/app/graph/state.py`

### Analysis and Simulation

- [Preflight Checks](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/workflow.py): `backend/app/graph/workflow.py`
- [XML Validation](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/mcp/xml_parser.py): `backend/app/mcp/xml_parser.py`
- [Telemetry Window](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/mcp/log_windower.py): `backend/app/mcp/log_windower.py`
- [Failure Diagnosis](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/workflow.py): `backend/app/graph/workflow.py`
- [Patch Generation](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/workflow.py): `backend/app/graph/workflow.py`
- [Patch Validation](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/workflow.py): `backend/app/graph/workflow.py`
- [Scenario Simulation](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/graph/workflow.py): `backend/app/graph/workflow.py`
- [esmini Runner](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/sim/esmini_runner.py): `backend/app/sim/esmini_runner.py`

### Platform Services

- [LLM Client](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/core/llm.py): `backend/app/core/llm.py`
- [Configuration](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/core/config.py): `backend/app/core/config.py`
- [SQL Database Access](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/db/database.py): `backend/app/db/database.py`
- [Vector Store](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/db/vector_store.py): `backend/app/db/vector_store.py`
- [DB Module](https://github.com/vibhavpan/adas-sotif-validation-copilot/blob/main/backend/app/db/db.py): `backend/app/db/db.py`

### Other components

- **User**
- **esmini Container**
- **Gemini Service**

## Connections

- User → Validation Dashboard: uploads files (evidence: `frontend/src/App.tsx`)
- Validation Dashboard → API Client: submits validation (evidence: `frontend/src/App.tsx`)
- API Client → Validation API: posts files (evidence: `frontend/src/services/api.ts`)
- Validation API → Workflow Engine: invokes workflow (evidence: `backend/main.py`)
- Workflow Engine → Preflight Checks: starts at (evidence: `backend/app/graph/workflow.py`)
- Preflight Checks → XML Validation: validates XML (evidence: `backend/app/graph/workflow.py`)
- Preflight Checks → Telemetry Window: extracts window (evidence: `backend/app/graph/workflow.py`)
- Workflow Engine → Failure Diagnosis: dispatches stage (evidence: `backend/app/graph/workflow.py`)
- Failure Diagnosis → Gemini Service: requests diagnosis (evidence: `backend/app/graph/workflow.py`)
- Workflow Engine → Patch Generation: dispatches stage (evidence: `backend/app/graph/workflow.py`)
- Patch Generation → Gemini Service: requests patch (evidence: `backend/app/graph/workflow.py`)
- Workflow Engine → Patch Validation: validates patch (evidence: `backend/app/graph/workflow.py`)
- Patch Validation → Patch Generation: retries patch (evidence: `backend/app/graph/workflow.py`)
- Workflow Engine → Scenario Simulation: dispatches stage (evidence: `backend/app/graph/workflow.py`)
- Scenario Simulation → esmini Runner: runs scenario (evidence: `backend/app/graph/workflow.py`)
- esmini Runner → esmini Container: launches container (evidence: `backend/app/sim/esmini_runner.py`)
- Workflow Engine → Graph Nodes
- Workflow Engine → Agent State
- Workflow Engine → Graph State
- LLM Client → Configuration: reads settings (evidence: `backend/app/core/llm.py`)
- LLM Client → Gemini Service: invokes model (evidence: `backend/app/core/llm.py`)
- SQL Database Access → Configuration: reads settings (evidence: `backend/app/db/database.py`)
- Vector Store → SQL Database Access (evidence: `backend/app/db/vector_store.py`)
