# ragelayasree-5725/infrasight architecture

> Architecture diagram of the GitHub repository ragelayasree-5725/infrasight, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ragelayasree-5725/infrasight
- Repository: https://github.com/ragelayasree-5725/infrasight

## Overview

InfraSight is a local road-damage inspection prototype: a user supplies a road image, the FastAPI application runs YOLO detection, and the result includes damage classes, confidence, and bounding-box evidence. The application also exposes inspection history, per-detection details, and metrics, with SQLite-backed detection records and locally served output images. The README documents these capabilities; the sampled Python excerpts show the API, inference, and storage mechanisms, but omit some wiring and the HTML contents, so uncertain links are left out.

Main entry points: [`main.py`](https://github.com/ragelayasree-5725/infrasight/blob/main/main.py) (FastAPI application), [`index.html`](https://github.com/ragelayasree-5725/infrasight/blob/main/index.html) (Image dashboard), [`camera.html`](https://github.com/ragelayasree-5725/infrasight/blob/main/camera.html) (Camera page), [`model/best.pt`](https://github.com/ragelayasree-5725/infrasight/blob/main/model/best.pt) (Trained YOLO model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Inspection interface"]
  node_dashboard["Image dashboard<br/>[index.html]"]
  node_camera["Camera page<br/>[camera.html]"]
end

subgraph group_api["Application API"]
  node_app["FastAPI application<br/>[main.py]"]
  node_upload["Image upload<br/>[main.py]"]
  node_history_api["History and metrics<br/>[main.py]"]
  node_detail_api["Detection details<br/>[main.py]"]
end

subgraph group_vision["Detection pipeline"]
  node_inference["YOLO inference<br/>[main.py]"]
  node_model["Trained YOLO model<br/>[best.pt]"]
  node_classification["Class and confidence<br/>[main.py]"]
  node_severity["Severity assessment<br/>[main.py]"]
  node_visualization["Box visualization<br/>[main.py]"]
end

subgraph group_records["Inspection records"]
  node_output_files["Detection images<br/>[main.py]"]
  node_sqlite[("Detection database<br/>[main.py]")]
  node_record_logic["Record and history logic<br/>[main.py]"]
  node_risk["Persistence and priority<br/>[main.py]"]
end

node_inspector(("Inspector"))

node_inspector -->|"opens"| node_dashboard
node_inspector -->|"opens"| node_camera
node_dashboard -->|"submits image"| node_upload
node_camera -->|"submits image"| node_upload
node_app -->|"routes requests"| node_upload
node_app -->|"routes requests"| node_history_api
node_app -->|"routes requests"| node_detail_api
node_upload -->|"runs detection"| node_inference
node_inference -->|"uses weights"| node_model
node_inference -->|"produces detections"| node_classification
node_classification -->|"assesses damage"| node_severity
node_inference -->|"plots boxes"| node_visualization
node_visualization -->|"writes image"| node_output_files
node_app -->|"serves files"| node_output_files
node_record_logic -->|"reads and writes"| node_sqlite
node_history_api -->|"loads history"| node_record_logic
node_detail_api -->|"queries record"| node_sqlite
node_risk -->|"supports assessment"| node_record_logic

click node_dashboard "https://github.com/ragelayasree-5725/infrasight/blob/main/index.html"
click node_camera "https://github.com/ragelayasree-5725/infrasight/blob/main/camera.html"
click node_app "https://github.com/ragelayasree-5725/infrasight/blob/main/main.py"
click node_upload "https://github.com/ragelayasree-5725/infrasight/blob/main/main.py"
click node_history_api "https://github.com/ragelayasree-5725/infrasight/blob/main/main.py"
click node_detail_api "https://github.com/ragelayasree-5725/infrasight/blob/main/main.py"
click node_inference "https://github.com/ragelayasree-5725/infrasight/blob/main/main.py"
click node_model "https://github.com/ragelayasree-5725/infrasight/blob/main/model/best.pt"
click node_classification "https://github.com/ragelayasree-5725/infrasight/blob/main/main.py"
click node_severity "https://github.com/ragelayasree-5725/infrasight/blob/main/main.py"
click node_visualization "https://github.com/ragelayasree-5725/infrasight/blob/main/main.py"
click node_output_files "https://github.com/ragelayasree-5725/infrasight/blob/main/main.py"
click node_sqlite "https://github.com/ragelayasree-5725/infrasight/blob/main/main.py"
click node_record_logic "https://github.com/ragelayasree-5725/infrasight/blob/main/main.py"
click node_risk "https://github.com/ragelayasree-5725/infrasight/blob/main/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_dashboard,node_camera toneBlue
class node_app,node_upload,node_history_api,node_detail_api toneAmber
class node_inference,node_model,node_classification,node_severity,node_visualization toneMint
class node_output_files,node_sqlite,node_record_logic,node_risk toneRose
class node_inspector toneIndigo
```

## Components

### Inspection interface

- [Image dashboard](https://github.com/ragelayasree-5725/infrasight/blob/main/index.html): `index.html`
- [Camera page](https://github.com/ragelayasree-5725/infrasight/blob/main/camera.html): `camera.html`

### Application API

- [FastAPI application](https://github.com/ragelayasree-5725/infrasight/blob/main/main.py): `main.py`
- [Image upload](https://github.com/ragelayasree-5725/infrasight/blob/main/main.py): `main.py`
- [History and metrics](https://github.com/ragelayasree-5725/infrasight/blob/main/main.py): `main.py`
- [Detection details](https://github.com/ragelayasree-5725/infrasight/blob/main/main.py): `main.py`

### Detection pipeline

- [YOLO inference](https://github.com/ragelayasree-5725/infrasight/blob/main/main.py): `main.py`
- [Trained YOLO model](https://github.com/ragelayasree-5725/infrasight/blob/main/model/best.pt): `model/best.pt`
- [Class and confidence](https://github.com/ragelayasree-5725/infrasight/blob/main/main.py): `main.py`
- [Severity assessment](https://github.com/ragelayasree-5725/infrasight/blob/main/main.py): `main.py`
- [Box visualization](https://github.com/ragelayasree-5725/infrasight/blob/main/main.py): `main.py`

### Inspection records

- [Detection images](https://github.com/ragelayasree-5725/infrasight/blob/main/main.py): `main.py`
- [Detection database](https://github.com/ragelayasree-5725/infrasight/blob/main/main.py): `main.py`
- [Record and history logic](https://github.com/ragelayasree-5725/infrasight/blob/main/main.py): `main.py`
- [Persistence and priority](https://github.com/ragelayasree-5725/infrasight/blob/main/main.py): `main.py`

### Other components

- **Inspector**

## Connections

- Inspector → Image dashboard: opens
- Inspector → Camera page: opens
- Image dashboard → Image upload: submits image
- Camera page → Image upload: submits image
- FastAPI application → Image upload: routes requests
- FastAPI application → History and metrics: routes requests
- FastAPI application → Detection details: routes requests
- Image upload → YOLO inference: runs detection
- YOLO inference → Trained YOLO model: uses weights
- YOLO inference → Class and confidence: produces detections
- Class and confidence → Severity assessment: assesses damage
- YOLO inference → Box visualization: plots boxes
- Box visualization → Detection images: writes image
- FastAPI application → Detection images: serves files
- Record and history logic → Detection database: reads and writes
- History and metrics → Record and history logic: loads history
- Detection details → Detection database: queries record
- Persistence and priority → Record and history logic: supports assessment
