# anhkhoi130605/project-ros-doctor architecture

> Architecture diagram of the GitHub repository anhkhoi130605/project-ros-doctor, 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/anhkhoi130605/project-ros-doctor
- Repository: https://github.com/anhkhoi130605/project-ros-doctor

## Overview

The repository combines an AI diagnostic-agent backend, a React/ASP.NET engineering application, and a reusable NeMo Guardrails runtime. The main Python workflow accepts authenticated chat requests, invokes the LangGraph agent, and can use retrieval and safety services; the wider application also supports rosbag analysis, review, dashboards, and administration. Sampled evidence confirms only some connections, so unsampled integrations are omitted or marked unverified.

Main entry points: [`src/api/routes.py`](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/api/routes.py) (Agent API routes), [`src/agents/retrieval/pipeline.py`](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/agents/retrieval/pipeline.py) (Diagnostic retrieval), [`src/main.py`](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/main.py) (FastAPI startup), [`src/Guardrails/nemoguardrails/guardrails/engine_registry.py`](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/Guardrails/nemoguardrails/guardrails/engine_registry.py) (Engine registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent["Diagnostic Agent"]
  node_py_entry["FastAPI startup<br/>[main.py]"]
  node_routes["Agent API routes<br/>[routes.py]"]
  node_agent_graph["LangGraph agent<br/>[graph.py]"]
  node_rag["Diagnostic retrieval<br/>[pipeline.py]"]
  node_config["Runtime settings<br/>[config.py]"]
end

subgraph group_safety["Safety and Guardrails"]
  node_safety_service["Output safety service<br/>[service.py]"]
  node_guardrails_engine["Guardrails model engine<br/>[model_engine.py]"]
  node_guardrails_registry["Engine registry<br/>[engine_registry.py]"]
  node_guardrails_config["Rails configuration<br/>[config.py]"]
end

subgraph group_web["Engineering Application"]
  node_web_bags["Rosbag workflows"]
  node_web_dashboard["Engineering dashboard"]
  node_web_state["Frontend application state<br/>[appStore.jsx]"]
  node_web_services["Frontend API services<br/>[index.js]"]
end

subgraph group_backend["ASP.NET Backend"]
  node_backend_reviews["Review endpoints"]
  node_review_commands["Review commands"]
  node_backend_unit["Unit of work<br/>[IUnitOfWork.cs]"]
  node_identity_user["User identity<br/>[User.cs]"]
end

subgraph group_storage["Data Services"]
  node_trace_service["Agent trace service"]
  node_mongo_store[("MongoDB")]
  node_vector_store[("Chroma vector store")]
  node_asp_database[("Application database<br/>[AppDbContext.cs]")]
end

node_user(("Engineer or admin"))

node_user -->|"submits chat"| node_routes
node_py_entry -->|"registers routes"| node_routes
node_py_entry -->|"initializes retrieval"| node_rag
node_routes -->|"invokes agent"| node_agent_graph
node_routes -->|"sanitizes output"| node_safety_service
node_routes -->|"loads traces"| node_trace_service
node_rag -->|"reads documents"| node_mongo_store
node_rag -->|"searches vectors"| node_vector_store
node_rag -->|"reads settings"| node_config
node_safety_service -->|"uses runtime"| node_guardrails_engine
node_guardrails_registry -->|"registers engine"| node_guardrails_engine
node_guardrails_registry -->|"loads model config"| node_guardrails_config
node_web_bags -.->|"uses shared state"| node_web_state
node_web_bags -->|"requests bag data"| node_web_services
node_web_dashboard -->|"requests dashboard data"| node_web_services
node_user -->|"submits decision"| node_backend_reviews
node_backend_reviews -->|"dispatches command"| node_review_commands
node_backend_unit -->|"exposes repository"| node_identity_user

click node_py_entry "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/main.py"
click node_routes "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/api/routes.py"
click node_agent_graph "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/agents/graph.py"
click node_rag "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/agents/retrieval/pipeline.py"
click node_config "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/config.py"
click node_safety_service "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/safety/service.py"
click node_guardrails_engine "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/Guardrails/nemoguardrails/guardrails/model_engine.py"
click node_guardrails_registry "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/Guardrails/nemoguardrails/guardrails/engine_registry.py"
click node_guardrails_config "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/Guardrails/nemoguardrails/rails/llm/config.py"
click node_web_bags "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/FrontEnd(ReactJS)/src/feature/bags/pages/Engineering/EngineeringBagDetailPage.jsx"
click node_web_dashboard "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/FrontEnd(ReactJS)/src/feature/dashboard/pages/Engineering/EngineeringDashboardPage.jsx"
click node_web_state "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/FrontEnd(ReactJS)/src/stored/appStore.jsx"
click node_web_services "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/FrontEnd(ReactJS)/src/service/index.js"
click node_backend_reviews "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/BackEnd(ASP.Net)/API/Controller/Reviews/ReviewsController.cs"
click node_review_commands "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/BackEnd(ASP.Net)/Application/Features/Reviews/Commands/SubmitReviewCommand.cs"
click node_backend_unit "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/BackEnd(ASP.Net)/Application/Interfaces/ManageTransaction/IUnitOfWork.cs"
click node_identity_user "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/BackEnd(ASP.Net)/Domain/Entities/Identity/User.cs"
click node_trace_service "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/services/agent_trace_service.py"
click node_asp_database "https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/BackEnd(ASP.Net)/Infrastructure/Persistence/AppDbContext.cs"

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_py_entry,node_routes,node_agent_graph,node_rag,node_config toneBlue
class node_safety_service,node_guardrails_engine,node_guardrails_registry,node_guardrails_config toneAmber
class node_web_bags,node_web_dashboard,node_web_state,node_web_services toneMint
class node_backend_reviews,node_review_commands,node_backend_unit,node_identity_user toneRose
class node_trace_service,node_mongo_store,node_vector_store,node_asp_database,node_user toneIndigo
```

## Components

### Diagnostic Agent

- [FastAPI startup](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/main.py): `src/main.py`
- [Agent API routes](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/api/routes.py): `src/api/routes.py`
- [LangGraph agent](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/agents/graph.py): `src/agents/graph.py`
- [Diagnostic retrieval](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/agents/retrieval/pipeline.py): `src/agents/retrieval/pipeline.py`
- [Runtime settings](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/config.py): `src/config.py`

### Safety and Guardrails

- [Output safety service](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/safety/service.py): `src/safety/service.py`
- [Guardrails model engine](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/Guardrails/nemoguardrails/guardrails/model_engine.py): `src/Guardrails/nemoguardrails/guardrails/model_engine.py`
- [Engine registry](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/Guardrails/nemoguardrails/guardrails/engine_registry.py): `src/Guardrails/nemoguardrails/guardrails/engine_registry.py`
- [Rails configuration](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/Guardrails/nemoguardrails/rails/llm/config.py): `src/Guardrails/nemoguardrails/rails/llm/config.py`

### Engineering Application

- [Rosbag workflows](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/FrontEnd(ReactJS)/src/feature/bags/pages/Engineering/EngineeringBagDetailPage.jsx): `WebAPI/FrontEnd(ReactJS)/src/feature/bags/pages/Engineering/EngineeringBagDetailPage.jsx`
- [Engineering dashboard](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/FrontEnd(ReactJS)/src/feature/dashboard/pages/Engineering/EngineeringDashboardPage.jsx): `WebAPI/FrontEnd(ReactJS)/src/feature/dashboard/pages/Engineering/EngineeringDashboardPage.jsx`
- [Frontend application state](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/FrontEnd(ReactJS)/src/stored/appStore.jsx): `WebAPI/FrontEnd(ReactJS)/src/stored/appStore.jsx`
- [Frontend API services](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/FrontEnd(ReactJS)/src/service/index.js): `WebAPI/FrontEnd(ReactJS)/src/service/index.js`

### ASP.NET Backend

- [Review endpoints](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/BackEnd(ASP.Net)/API/Controller/Reviews/ReviewsController.cs): `WebAPI/BackEnd(ASP.Net)/API/Controller/Reviews/ReviewsController.cs`
- [Review commands](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/BackEnd(ASP.Net)/Application/Features/Reviews/Commands/SubmitReviewCommand.cs): `WebAPI/BackEnd(ASP.Net)/Application/Features/Reviews/Commands/SubmitReviewCommand.cs`
- [Unit of work](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/BackEnd(ASP.Net)/Application/Interfaces/ManageTransaction/IUnitOfWork.cs): `WebAPI/BackEnd(ASP.Net)/Application/Interfaces/ManageTransaction/IUnitOfWork.cs`
- [User identity](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/BackEnd(ASP.Net)/Domain/Entities/Identity/User.cs): `WebAPI/BackEnd(ASP.Net)/Domain/Entities/Identity/User.cs`

### Data Services

- [Agent trace service](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/src/services/agent_trace_service.py): `src/services/agent_trace_service.py`
- **MongoDB**
- **Chroma vector store**
- [Application database](https://github.com/anhkhoi130605/project-ros-doctor/blob/main/WebAPI/BackEnd(ASP.Net)/Infrastructure/Persistence/AppDbContext.cs): `WebAPI/BackEnd(ASP.Net)/Infrastructure/Persistence/AppDbContext.cs`

### Other components

- **Engineer or admin**

## Connections

- Engineer or admin → Agent API routes: submits chat (evidence: `src/api/routes.py`)
- FastAPI startup → Agent API routes: registers routes (evidence: `src/main.py`)
- FastAPI startup → Diagnostic retrieval: initializes retrieval (evidence: `src/main.py`)
- Agent API routes → LangGraph agent: invokes agent (evidence: `src/api/routes.py`)
- Agent API routes → Output safety service: sanitizes output (evidence: `src/api/routes.py`)
- Agent API routes → Agent trace service: loads traces (evidence: `src/api/routes.py`)
- Diagnostic retrieval → MongoDB: reads documents (evidence: `src/agents/retrieval/pipeline.py`)
- Diagnostic retrieval → Chroma vector store: searches vectors (evidence: `src/agents/retrieval/pipeline.py`)
- Diagnostic retrieval → Runtime settings: reads settings (evidence: `src/agents/retrieval/pipeline.py`)
- Output safety service → Guardrails model engine: uses runtime (evidence: `src/safety/service.py`)
- Engine registry → Guardrails model engine: registers engine (evidence: `src/Guardrails/nemoguardrails/guardrails/engine_registry.py`)
- Engine registry → Rails configuration: loads model config (evidence: `src/Guardrails/nemoguardrails/guardrails/engine_registry.py`)
- Rosbag workflows → Frontend application state: uses shared state
- Rosbag workflows → Frontend API services: requests bag data
- Engineering dashboard → Frontend API services: requests dashboard data
- Engineer or admin → Review endpoints: submits decision (evidence: `WebAPI/BackEnd(ASP.Net)/API/Controller/Reviews/ReviewsController.cs`)
- Review endpoints → Review commands: dispatches command (evidence: `WebAPI/BackEnd(ASP.Net)/API/Controller/Reviews/ReviewsController.cs`)
- Unit of work → User identity: exposes repository (evidence: `WebAPI/BackEnd(ASP.Net)/Application/Interfaces/ManageTransaction/IUnitOfWork.cs`)
