# shreyas-sv1/ai-based-pathhole-detection architecture

> Architecture diagram of the GitHub repository shreyas-sv1/ai-based-pathhole-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shreyas-sv1/ai-based-pathhole-detection
- Repository: https://github.com/shreyas-sv1/ai-based-pathhole-detection

## Overview

Smart Road Monitor accepts image and video reports, runs pothole inference, enriches detections with severity and location, persists incidents, and presents them for spatial review and maintenance tracking. The dashboard also provides analytics and report-management views. The sampled code shows the main upload, inference, persistence, and dashboard call paths; Overview implementation was not sampled, so its internal behavior is based on the README. Video processing and storage are implemented within the same files as their respective services.

Main entry points: [`pothole-dashboard/src/App.jsx`](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-dashboard/src/App.jsx) (Dashboard shell), [`pothole-server/server.js`](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-server/server.js) (REST service), [`pothole-dashboard/src/api.js`](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-dashboard/src/api.js) (REST client), [`pothole-api/main.py`](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-api/main.py) (Video analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Monitoring Dashboard"]
  node_app["Dashboard shell<br/>[App.jsx]"]
  node_overview["Analytics overview<br/>[Overview.jsx]"]
  node_map["Incident map<br/>[MapView.jsx]"]
  node_studio["Detection studio"]
  node_maintenance["Maintenance table"]
  node_client["REST client<br/>[api.js]"]
end

subgraph group_backend["Report Management"]
  node_server["REST service<br/>[server.js]"]
  node_uploads[("Uploaded media<br/>[server.js]")]
end

subgraph group_vision["Detection Engine"]
  node_inference["Image inference<br/>[main.py]"]
  node_video["Video analysis<br/>[main.py]"]
  node_severity["Severity and GPS<br/>[main.py]"]
  node_video_output[("Annotated video files<br/>[main.py]")]
  node_model["YOLO weights<br/>[main.py]"]
end

subgraph group_data["Incident Data"]
  node_records[("Incident records<br/>[server.js]")]
end

node_operator(("Road operator"))
node_map_tiles["OpenStreetMap tiles"]

node_operator -->|"uses"| node_app
node_app -->|"renders"| node_overview
node_app -->|"renders"| node_map
node_app -->|"renders"| node_studio
node_app -->|"renders"| node_maintenance
node_app -->|"fetches reports"| node_client
node_client -->|"REST requests"| node_server
node_studio -->|"submits media"| node_client
node_maintenance -->|"updates or deletes"| node_client
node_map -->|"updates status"| node_client
node_server -->|"stores uploads"| node_uploads
node_server -->|"forwards images"| node_inference
node_server -->|"forwards videos"| node_video
node_inference -->|"runs inference"| node_model
node_video -->|"runs inference"| node_model
node_inference -->|"computes severity and GPS"| node_severity
node_video -->|"computes severity"| node_severity
node_video -->|"writes annotated video"| node_video_output
node_server -->|"creates and queries"| node_records
node_map -->|"loads tiles"| node_map_tiles

click node_app "https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-dashboard/src/App.jsx"
click node_overview "https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-dashboard/src/components/Overview.jsx"
click node_map "https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-dashboard/src/components/MapView.jsx"
click node_studio "https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-dashboard/src/components/DetectionStudio.jsx"
click node_maintenance "https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-dashboard/src/components/MaintenanceTable.jsx"
click node_client "https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-dashboard/src/api.js"
click node_server "https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-server/server.js"
click node_uploads "https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-server/server.js"
click node_inference "https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-api/main.py"
click node_video "https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-api/main.py"
click node_severity "https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-api/main.py"
click node_video_output "https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-api/main.py"
click node_model "https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-api/main.py"
click node_records "https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-server/server.js"

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_overview,node_map,node_studio,node_maintenance,node_client toneBlue
class node_server,node_uploads toneAmber
class node_inference,node_video,node_severity,node_video_output,node_model toneMint
class node_records toneRose
class node_operator,node_map_tiles toneIndigo
```

## Components

### Monitoring Dashboard

- [Dashboard shell](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-dashboard/src/App.jsx): `pothole-dashboard/src/App.jsx`
- [Analytics overview](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-dashboard/src/components/Overview.jsx): `pothole-dashboard/src/components/Overview.jsx`
- [Incident map](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-dashboard/src/components/MapView.jsx): `pothole-dashboard/src/components/MapView.jsx`
- [Detection studio](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-dashboard/src/components/DetectionStudio.jsx): `pothole-dashboard/src/components/DetectionStudio.jsx`
- [Maintenance table](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-dashboard/src/components/MaintenanceTable.jsx): `pothole-dashboard/src/components/MaintenanceTable.jsx`
- [REST client](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-dashboard/src/api.js): `pothole-dashboard/src/api.js`

### Report Management

- [REST service](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-server/server.js): `pothole-server/server.js`
- [Uploaded media](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-server/server.js): `pothole-server/server.js`

### Detection Engine

- [Image inference](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-api/main.py): `pothole-api/main.py`
- [Video analysis](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-api/main.py): `pothole-api/main.py`
- [Severity and GPS](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-api/main.py): `pothole-api/main.py`
- [Annotated video files](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-api/main.py): `pothole-api/main.py`
- [YOLO weights](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-api/main.py): `pothole-api/main.py`

### Incident Data

- [Incident records](https://github.com/shreyas-sv1/ai-based-pathhole-detection/blob/main/pothole-server/server.js): `pothole-server/server.js`

### Other components

- **Road operator**
- **OpenStreetMap tiles**

## Connections

- Road operator → Dashboard shell: uses (evidence: `README.md`)
- Dashboard shell → Analytics overview: renders (evidence: `pothole-dashboard/src/App.jsx`)
- Dashboard shell → Incident map: renders (evidence: `pothole-dashboard/src/App.jsx`)
- Dashboard shell → Detection studio: renders (evidence: `pothole-dashboard/src/App.jsx`)
- Dashboard shell → Maintenance table: renders (evidence: `pothole-dashboard/src/App.jsx`)
- Dashboard shell → REST client: fetches reports (evidence: `pothole-dashboard/src/App.jsx`)
- REST client → REST service: REST requests (evidence: `pothole-dashboard/src/api.js`)
- Detection studio → REST client: submits media (evidence: `pothole-dashboard/src/components/DetectionStudio.jsx`)
- Maintenance table → REST client: updates or deletes (evidence: `pothole-dashboard/src/components/MaintenanceTable.jsx`)
- Incident map → REST client: updates status (evidence: `pothole-dashboard/src/components/MapView.jsx`)
- REST service → Uploaded media: stores uploads (evidence: `pothole-server/server.js`)
- REST service → Image inference: forwards images (evidence: `pothole-server/server.js`)
- REST service → Video analysis: forwards videos (evidence: `pothole-server/server.js`)
- Image inference → YOLO weights: runs inference (evidence: `pothole-api/main.py`)
- Video analysis → YOLO weights: runs inference (evidence: `pothole-api/main.py`)
- Image inference → Severity and GPS: computes severity and GPS (evidence: `pothole-api/main.py`)
- Video analysis → Severity and GPS: computes severity (evidence: `pothole-api/main.py`)
- Video analysis → Annotated video files: writes annotated video (evidence: `pothole-api/main.py`)
- REST service → Incident records: creates and queries (evidence: `pothole-server/server.js`)
- Incident map → OpenStreetMap tiles: loads tiles (evidence: `pothole-dashboard/src/components/MapView.jsx`)
