# dalipepaul12/se_crackandpothole_detection architecture

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

- Interactive diagram: https://gitdiagram.com/dalipepaul12/se_crackandpothole_detection
- Repository: https://github.com/dalipepaul12/se_crackandpothole_detection

## Overview

SE_CrackAndPothole_Detection is a road-condition monitoring product for detecting cracks and potholes from submitted media and CCTV, with geospatial reporting. A principal user workflow is to create a report, upload media, validate it, and classify it; administrators can review reports and create projects. The README also highlights real-time CCTV monitoring and geospatial analytics. Several API and service branches are represented from the tree and README, but their internal calls were not sampled, so those links are not asserted.

Main entry points: [`backend/app/main.py`](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/main.py) (API application), [`frontend/src/hooks/usePipeline.js`](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/hooks/usePipeline.js) (Report pipeline), [`backend/app/api/v1/cctv.py`](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/api/v1/cctv.py) (CCTV endpoints), [`frontend/src/pages/Inside-App-Admin/AdminManageReports.jsx`](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/pages/Inside-App-Admin/AdminManageReports.jsx) (Admin report review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_web["Web application<br/>[App.jsx]"]
  node_pipeline["Report pipeline<br/>[usePipeline.js]"]
  node_report_api_client["Report API client<br/>[reports.js]"]
  node_media_api_client["Media API client<br/>[media.js]"]
  node_validation_api_client["Validation API client<br/>[aiValidation.js]"]
  node_ml_api_client["ML API client<br/>[ml.js]"]
  node_admin_reports["Admin report review"]
end

subgraph group_reporting["Reports and projects"]
  node_reports_api["Report endpoints<br/>[reports.py]"]
  node_report_service["Report services<br/>[report_service.py]"]
  node_projects_api["Project endpoints<br/>[projects.py]"]
end

subgraph group_detection["Detection and monitoring"]
  node_cctv_api["CCTV endpoints<br/>[cctv.py]"]
  node_detection_service["Detection orchestration"]
  node_ml_service["Vision inference<br/>[ml_service.py]"]
  node_analytics_api["Geospatial analytics<br/>[analytics.py]"]
end

subgraph group_platform["API and platform"]
  node_auth_api["Authentication endpoints<br/>[auth.py]"]
  node_auth_service["Token and identity service<br/>[auth_service.py]"]
  node_database[("Relational database<br/>[session.py]")]
  node_app_entry["API application<br/>[main.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

node_citizen(("Citizen"))
node_cctv(("CCTV cameras"))

node_citizen -.->|"submits reports"| node_web
node_web -.->|"starts submission"| node_pipeline
node_pipeline -->|"creates report"| node_report_api_client
node_pipeline -->|"uploads media"| node_media_api_client
node_pipeline -->|"validates media"| node_validation_api_client
node_pipeline -->|"classifies media"| node_ml_api_client
node_admin_reports -->|"reviews reports"| node_report_api_client
node_admin_reports -->|"creates projects"| node_projects_api
node_app_entry -->|"registers routes"| node_auth_api
node_app_entry -->|"registers routes"| node_analytics_api
node_auth_api -->|"uses identity service"| node_auth_service
node_detection_service -->|"runs inference"| node_ml_service
node_cctv -.->|"supplies video"| node_cctv_api
node_cctv_api -.->|"initiates detection"| node_detection_service
node_reports_api -.->|"delegates report work"| node_report_service
node_auth_service -.->|"reads and writes"| node_database
node_app_entry -.->|"registers routes"| node_reports_api
node_app_entry -.->|"registers routes"| node_projects_api
node_app_entry -.->|"registers routes"| node_cctv_api
node_app_entry -->|"loads settings"| node_config

click node_web "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/App.jsx"
click node_pipeline "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/hooks/usePipeline.js"
click node_report_api_client "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/api/reports.js"
click node_media_api_client "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/api/media.js"
click node_validation_api_client "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/api/aiValidation.js"
click node_ml_api_client "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/api/ml.js"
click node_admin_reports "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/pages/Inside-App-Admin/AdminManageReports.jsx"
click node_reports_api "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/api/v1/reports.py"
click node_report_service "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/services/report_service.py"
click node_projects_api "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/api/v1/projects.py"
click node_cctv_api "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/api/v1/cctv.py"
click node_detection_service "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/services/detection_service.py"
click node_ml_service "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/services/ml_service.py"
click node_analytics_api "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/api/v1/analytics.py"
click node_auth_api "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/api/v1/auth.py"
click node_auth_service "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/services/auth_service.py"
click node_database "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/db/session.py"
click node_app_entry "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/main.py"
click node_config "https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/core/config.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_web,node_pipeline,node_report_api_client,node_media_api_client,node_validation_api_client,node_ml_api_client,node_admin_reports toneBlue
class node_reports_api,node_report_service,node_projects_api toneAmber
class node_cctv_api,node_detection_service,node_ml_service,node_analytics_api toneMint
class node_auth_api,node_auth_service,node_database,node_app_entry,node_config toneRose
class node_citizen,node_cctv toneIndigo
```

## Components

### Web application

- [Web application](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Report pipeline](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/hooks/usePipeline.js): `frontend/src/hooks/usePipeline.js`
- [Report API client](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/api/reports.js): `frontend/src/api/reports.js`
- [Media API client](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/api/media.js): `frontend/src/api/media.js`
- [Validation API client](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/api/aiValidation.js): `frontend/src/api/aiValidation.js`
- [ML API client](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/api/ml.js): `frontend/src/api/ml.js`
- [Admin report review](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/frontend/src/pages/Inside-App-Admin/AdminManageReports.jsx): `frontend/src/pages/Inside-App-Admin/AdminManageReports.jsx`

### Reports and projects

- [Report endpoints](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/api/v1/reports.py): `backend/app/api/v1/reports.py`
- [Report services](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/services/report_service.py): `backend/app/services/report_service.py`
- [Project endpoints](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/api/v1/projects.py): `backend/app/api/v1/projects.py`

### Detection and monitoring

- [CCTV endpoints](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/api/v1/cctv.py): `backend/app/api/v1/cctv.py`
- [Detection orchestration](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/services/detection_service.py): `backend/app/services/detection_service.py`
- [Vision inference](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/services/ml_service.py): `backend/app/services/ml_service.py`
- [Geospatial analytics](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/api/v1/analytics.py): `backend/app/api/v1/analytics.py`

### API and platform

- [Authentication endpoints](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/api/v1/auth.py): `backend/app/api/v1/auth.py`
- [Token and identity service](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`
- [Relational database](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/db/session.py): `backend/app/db/session.py`
- [API application](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/main.py): `backend/app/main.py`
- [Runtime configuration](https://github.com/dalipepaul12/se_crackandpothole_detection/blob/main/backend/app/core/config.py): `backend/app/core/config.py`

### Other components

- **Citizen**
- **CCTV cameras**

## Connections

- Citizen → Web application: submits reports
- Web application → Report pipeline: starts submission (evidence: `frontend/src/App.jsx`)
- Report pipeline → Report API client: creates report (evidence: `frontend/src/hooks/usePipeline.js`)
- Report pipeline → Media API client: uploads media (evidence: `frontend/src/hooks/usePipeline.js`)
- Report pipeline → Validation API client: validates media (evidence: `frontend/src/hooks/usePipeline.js`)
- Report pipeline → ML API client: classifies media (evidence: `frontend/src/hooks/usePipeline.js`)
- Admin report review → Report API client: reviews reports (evidence: `frontend/src/pages/Inside-App-Admin/AdminManageReports.jsx`)
- Admin report review → Project endpoints: creates projects (evidence: `frontend/src/pages/Inside-App-Admin/AdminManageReports.jsx`)
- API application → Authentication endpoints: registers routes (evidence: `backend/app/main.py`)
- API application → Geospatial analytics: registers routes (evidence: `backend/app/main.py`)
- Authentication endpoints → Token and identity service: uses identity service (evidence: `backend/app/api/v1/auth.py`)
- Detection orchestration → Vision inference: runs inference (evidence: `backend/app/services/detection_service.py`)
- CCTV cameras → CCTV endpoints: supplies video
- CCTV endpoints → Detection orchestration: initiates detection
- Report endpoints → Report services: delegates report work
- Token and identity service → Relational database: reads and writes
- API application → Report endpoints: registers routes (evidence: `backend/app/main.py`)
- API application → Project endpoints: registers routes (evidence: `backend/app/main.py`)
- API application → CCTV endpoints: registers routes (evidence: `backend/app/main.py`)
- API application → Runtime configuration: loads settings (evidence: `backend/app/main.py`)
