# shivin1234/sld-vision architecture

> Architecture diagram of the GitHub repository shivin1234/sld-vision, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shivin1234/sld-vision
- Repository: https://github.com/shivin1234/sld-vision

## Overview

SLD Vision is a web application for detecting electrical components in single-line diagrams, comparing detector outputs, and reviewing saved analyses. The user-facing workflow centers on selecting an image and model in the workspace, running backend inference, then inspecting detections and component summaries; comparison, old-versus-new evaluation, and history are separate capabilities. The backend supports several detector implementations and persists analysis sessions and images. Evidence is limited to the provided excerpts and SOURCE INDEX; connections for unsampled page behavior are omitted where not established.

Main entry points: [`frontend/src/App.jsx`](https://github.com/shivin1234/sld-vision/blob/main/frontend/src/App.jsx) (Workspace coordinator), [`backend/main.py`](https://github.com/shivin1234/sld-vision/blob/main/backend/main.py) (HTTP API), [`backend/database.py`](https://github.com/shivin1234/sld-vision/blob/main/backend/database.py) (Session persistence), [`frontend/src/pages/Dashboard.jsx`](https://github.com/shivin1234/sld-vision/blob/main/frontend/src/pages/Dashboard.jsx) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["Workspace coordinator<br/>[App.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_compare["Model comparison<br/>[CompareModels.jsx]"]
  node_history["Analysis history<br/>[History.jsx]"]
  node_oldnew["Old/new evaluation<br/>[OldVsNew.jsx]"]
end

subgraph group_api["Inference API"]
  node_api_main["HTTP API<br/>[main.py]"]
end

subgraph group_detectors["Detection models"]
  node_rtdetrv2["RT-DETRv2<br/>[RTDETRV2.py]"]
  node_retinanet["RetinaNet<br/>[RetinaNet.py]"]
  node_rtdetr["RT-DETR SAHI<br/>[Rtdetr.py]"]
  node_frcnn["Faster R-CNN<br/>[frcnn.py]"]
end

subgraph group_persistence["Analysis persistence"]
  node_db_helpers["Session persistence<br/>[database.py]"]
  node_mongo[("MongoDB and image store")]
end

node_user(("Diagram analyst"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_compare
node_app -->|"renders"| node_history
node_app -->|"renders"| node_oldnew
node_app -->|"requests history"| node_api_main
node_api_main -->|"reads history"| node_db_helpers
node_api_main -->|"dispatches inference"| node_rtdetrv2
node_api_main -->|"dispatches inference"| node_retinanet
node_api_main -->|"dispatches inference"| node_rtdetr
node_api_main -->|"dispatches inference"| node_frcnn
node_db_helpers -->|"persists sessions"| node_mongo

click node_app "https://github.com/shivin1234/sld-vision/blob/main/frontend/src/App.jsx"
click node_dashboard "https://github.com/shivin1234/sld-vision/blob/main/frontend/src/pages/Dashboard.jsx"
click node_compare "https://github.com/shivin1234/sld-vision/blob/main/frontend/src/pages/CompareModels.jsx"
click node_history "https://github.com/shivin1234/sld-vision/blob/main/frontend/src/pages/History.jsx"
click node_oldnew "https://github.com/shivin1234/sld-vision/blob/main/frontend/src/pages/OldVsNew.jsx"
click node_api_main "https://github.com/shivin1234/sld-vision/blob/main/backend/main.py"
click node_rtdetrv2 "https://github.com/shivin1234/sld-vision/blob/main/backend/RTDETRV2.py"
click node_retinanet "https://github.com/shivin1234/sld-vision/blob/main/backend/RetinaNet.py"
click node_rtdetr "https://github.com/shivin1234/sld-vision/blob/main/backend/Rtdetr.py"
click node_frcnn "https://github.com/shivin1234/sld-vision/blob/main/backend/frcnn.py"
click node_db_helpers "https://github.com/shivin1234/sld-vision/blob/main/backend/database.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_app,node_dashboard,node_compare,node_history,node_oldnew toneBlue
class node_api_main toneAmber
class node_rtdetrv2,node_retinanet,node_rtdetr,node_frcnn toneMint
class node_db_helpers,node_mongo toneRose
class node_user toneIndigo
```

## Components

### Web experience

- [Workspace coordinator](https://github.com/shivin1234/sld-vision/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Dashboard](https://github.com/shivin1234/sld-vision/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Model comparison](https://github.com/shivin1234/sld-vision/blob/main/frontend/src/pages/CompareModels.jsx): `frontend/src/pages/CompareModels.jsx`
- [Analysis history](https://github.com/shivin1234/sld-vision/blob/main/frontend/src/pages/History.jsx): `frontend/src/pages/History.jsx`
- [Old/new evaluation](https://github.com/shivin1234/sld-vision/blob/main/frontend/src/pages/OldVsNew.jsx): `frontend/src/pages/OldVsNew.jsx`

### Inference API

- [HTTP API](https://github.com/shivin1234/sld-vision/blob/main/backend/main.py): `backend/main.py`

### Detection models

- [RT-DETRv2](https://github.com/shivin1234/sld-vision/blob/main/backend/RTDETRV2.py): `backend/RTDETRV2.py`
- [RetinaNet](https://github.com/shivin1234/sld-vision/blob/main/backend/RetinaNet.py): `backend/RetinaNet.py`
- [RT-DETR SAHI](https://github.com/shivin1234/sld-vision/blob/main/backend/Rtdetr.py): `backend/Rtdetr.py`
- [Faster R-CNN](https://github.com/shivin1234/sld-vision/blob/main/backend/frcnn.py): `backend/frcnn.py`

### Analysis persistence

- [Session persistence](https://github.com/shivin1234/sld-vision/blob/main/backend/database.py): `backend/database.py`
- **MongoDB and image store**

### Other components

- **Diagram analyst**

## Connections

- Diagram analyst → Workspace coordinator: uses
- Workspace coordinator → Dashboard: renders (evidence: `frontend/src/App.jsx`)
- Workspace coordinator → Model comparison: renders (evidence: `frontend/src/App.jsx`)
- Workspace coordinator → Analysis history: renders (evidence: `frontend/src/App.jsx`)
- Workspace coordinator → Old/new evaluation: renders (evidence: `frontend/src/App.jsx`)
- Workspace coordinator → HTTP API: requests history (evidence: `frontend/src/App.jsx`)
- HTTP API → Session persistence: reads history (evidence: `backend/main.py`)
- HTTP API → RT-DETRv2: dispatches inference (evidence: `backend/main.py`)
- HTTP API → RetinaNet: dispatches inference (evidence: `backend/main.py`)
- HTTP API → RT-DETR SAHI: dispatches inference (evidence: `backend/main.py`)
- HTTP API → Faster R-CNN: dispatches inference (evidence: `backend/main.py`)
- Session persistence → MongoDB and image store: persists sessions (evidence: `backend/database.py`)
