# dhanush7git/final-major architecture

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

- Interactive diagram: https://gitdiagram.com/dhanush7git/final-major
- Repository: https://github.com/dhanush7git/final-major

## Overview

KAVACH ingests video from multiple cameras, detects weapon, fire/smoke, and violent-action threats, assesses severity, and records incidents with snapshots and alerts. The web console exposes live camera feeds, event management, analytics, snapshots, settings, and system telemetry through a Flask API. The sampled source confirms camera-registry and detection-manager behavior; some downstream pipeline wiring and API details rely on the README, so uncertain links are omitted.

Main entry points: [`detection/detection_manager.py`](https://github.com/dhanush7git/final-major/blob/main/detection/detection_manager.py) (Detection Manager), [`backend/routes/api.py`](https://github.com/dhanush7git/final-major/blob/main/backend/routes/api.py) (REST API Routes), [`event_manager/event_manager.py`](https://github.com/dhanush7git/final-major/blob/main/event_manager/event_manager.py) (Event Manager), [`camera/camera_manager.py`](https://github.com/dhanush7git/final-major/blob/main/camera/camera_manager.py) (Camera Registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Video Ingestion"]
  node_camera_sources(("Camera Sources"))
  node_camera_stream["Camera Stream<br/>[stream.py]"]
  node_camera_registry["Camera Registry<br/>[camera_manager.py]"]
end

subgraph group_analysis["Threat Analysis"]
  node_detection_manager["Detection Manager"]
  node_weapon_detector["Weapon Detection<br/>[weapon_detector.py]"]
  node_fire_detector["Fire Detection<br/>[fire_detector.py]"]
  node_violence_detector["Violence Detection"]
  node_threat_engine["Threat Scoring<br/>[engine.py]"]
  node_renderer["Frame Renderer<br/>[renderer.py]"]
end

subgraph group_response["Incident Response"]
  node_event_manager["Event Manager<br/>[event_manager.py]"]
  node_snapshot_manager["Snapshot Storage"]
  node_database[("SQLite Database<br/>[db.py]")]
  node_alert_service["Alert Dispatch<br/>[alert_service.py]"]
  node_email_service["Email Service"]
  node_local_siren["Local Siren"]
end

subgraph group_console["Operations Console"]
  node_web_console["Operations Console<br/>[App.jsx]"]
  node_console_pages["Console Views"]
  node_api_client["API Client<br/>[api.js]"]
  node_flask_app["Flask Application<br/>[app.py]"]
  node_api_routes["REST API Routes<br/>[api.py]"]
  node_monitoring["System Telemetry"]
  node_settings["Live Settings"]
end

node_operator(("Security Operator"))

node_camera_sources -->|"supply frames"| node_camera_stream
node_camera_registry -->|"starts streams"| node_camera_stream
node_camera_registry -->|"builds per-camera pipeline"| node_detection_manager
node_camera_stream -->|"passes frames"| node_detection_manager
node_detection_manager -->|"runs detection"| node_weapon_detector
node_detection_manager -->|"runs detection"| node_fire_detector
node_detection_manager -->|"runs temporal detection"| node_violence_detector
node_detection_manager -->|"provides detections"| node_threat_engine
node_threat_engine -->|"provides threat assessment"| node_renderer
node_detection_manager -->|"provides detections"| node_renderer
node_detection_manager -->|"provides detections"| node_event_manager
node_event_manager -->|"saves snapshot"| node_snapshot_manager
node_event_manager -->|"records event"| node_database
node_event_manager -->|"dispatches alert"| node_alert_service
node_alert_service -.->|"sends email"| node_email_service
node_alert_service -.->|"plays alarm"| node_local_siren
node_operator -->|"uses"| node_web_console
node_web_console -->|"renders views"| node_console_pages
node_console_pages -->|"requests data"| node_api_client
node_api_client -->|"calls"| node_api_routes
node_api_routes -->|"served by"| node_flask_app
node_api_routes -->|"manages cameras"| node_camera_registry
node_api_routes -->|"reads and writes"| node_database
node_api_routes -->|"serves snapshots"| node_snapshot_manager
node_api_routes -->|"requests telemetry"| node_monitoring
node_api_routes -->|"updates settings"| node_settings
node_monitoring -->|"reads stream metrics"| node_camera_registry
node_settings -->|"persists settings"| node_database

click node_camera_stream "https://github.com/dhanush7git/final-major/blob/main/camera/stream.py"
click node_camera_registry "https://github.com/dhanush7git/final-major/blob/main/camera/camera_manager.py"
click node_detection_manager "https://github.com/dhanush7git/final-major/blob/main/detection/detection_manager.py"
click node_weapon_detector "https://github.com/dhanush7git/final-major/blob/main/detection/weapon_detector.py"
click node_fire_detector "https://github.com/dhanush7git/final-major/blob/main/detection/fire_detector.py"
click node_violence_detector "https://github.com/dhanush7git/final-major/blob/main/detection/violence_detector.py"
click node_threat_engine "https://github.com/dhanush7git/final-major/blob/main/threat_engine/engine.py"
click node_renderer "https://github.com/dhanush7git/final-major/blob/main/renderer/renderer.py"
click node_event_manager "https://github.com/dhanush7git/final-major/blob/main/event_manager/event_manager.py"
click node_snapshot_manager "https://github.com/dhanush7git/final-major/blob/main/storage/snapshot_manager.py"
click node_database "https://github.com/dhanush7git/final-major/blob/main/database/db.py"
click node_alert_service "https://github.com/dhanush7git/final-major/blob/main/backend/services/alert_service.py"
click node_web_console "https://github.com/dhanush7git/final-major/blob/main/frontend/src/App.jsx"
click node_console_pages "https://github.com/dhanush7git/final-major/tree/main/frontend/src/pages"
click node_api_client "https://github.com/dhanush7git/final-major/blob/main/frontend/src/api/api.js"
click node_flask_app "https://github.com/dhanush7git/final-major/blob/main/backend/app.py"
click node_api_routes "https://github.com/dhanush7git/final-major/blob/main/backend/routes/api.py"
click node_monitoring "https://github.com/dhanush7git/final-major/blob/main/backend/services/monitoring_service.py"
click node_settings "https://github.com/dhanush7git/final-major/blob/main/backend/services/settings_service.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_camera_sources,node_camera_stream,node_camera_registry toneBlue
class node_detection_manager,node_weapon_detector,node_fire_detector,node_violence_detector,node_threat_engine,node_renderer toneAmber
class node_event_manager,node_snapshot_manager,node_database,node_alert_service,node_email_service,node_local_siren toneMint
class node_web_console,node_console_pages,node_api_client,node_flask_app,node_api_routes,node_monitoring,node_settings toneRose
class node_operator toneIndigo
```

## Components

### Video Ingestion

- **Camera Sources**
- [Camera Stream](https://github.com/dhanush7git/final-major/blob/main/camera/stream.py): `camera/stream.py`
- [Camera Registry](https://github.com/dhanush7git/final-major/blob/main/camera/camera_manager.py): `camera/camera_manager.py`

### Threat Analysis

- [Detection Manager](https://github.com/dhanush7git/final-major/blob/main/detection/detection_manager.py): `detection/detection_manager.py`
- [Weapon Detection](https://github.com/dhanush7git/final-major/blob/main/detection/weapon_detector.py): `detection/weapon_detector.py`
- [Fire Detection](https://github.com/dhanush7git/final-major/blob/main/detection/fire_detector.py): `detection/fire_detector.py`
- [Violence Detection](https://github.com/dhanush7git/final-major/blob/main/detection/violence_detector.py): `detection/violence_detector.py`
- [Threat Scoring](https://github.com/dhanush7git/final-major/blob/main/threat_engine/engine.py): `threat_engine/engine.py`
- [Frame Renderer](https://github.com/dhanush7git/final-major/blob/main/renderer/renderer.py): `renderer/renderer.py`

### Incident Response

- [Event Manager](https://github.com/dhanush7git/final-major/blob/main/event_manager/event_manager.py): `event_manager/event_manager.py`
- [Snapshot Storage](https://github.com/dhanush7git/final-major/blob/main/storage/snapshot_manager.py): `storage/snapshot_manager.py`
- [SQLite Database](https://github.com/dhanush7git/final-major/blob/main/database/db.py): `database/db.py`
- [Alert Dispatch](https://github.com/dhanush7git/final-major/blob/main/backend/services/alert_service.py): `backend/services/alert_service.py`
- **Email Service**
- **Local Siren**

### Operations Console

- [Operations Console](https://github.com/dhanush7git/final-major/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Console Views](https://github.com/dhanush7git/final-major/tree/main/frontend/src/pages): `frontend/src/pages`
- [API Client](https://github.com/dhanush7git/final-major/blob/main/frontend/src/api/api.js): `frontend/src/api/api.js`
- [Flask Application](https://github.com/dhanush7git/final-major/blob/main/backend/app.py): `backend/app.py`
- [REST API Routes](https://github.com/dhanush7git/final-major/blob/main/backend/routes/api.py): `backend/routes/api.py`
- [System Telemetry](https://github.com/dhanush7git/final-major/blob/main/backend/services/monitoring_service.py): `backend/services/monitoring_service.py`
- [Live Settings](https://github.com/dhanush7git/final-major/blob/main/backend/services/settings_service.py): `backend/services/settings_service.py`

### Other components

- **Security Operator**

## Connections

- Camera Sources → Camera Stream: supply frames
- Camera Registry → Camera Stream: starts streams
- Camera Registry → Detection Manager: builds per-camera pipeline
- Camera Stream → Detection Manager: passes frames
- Detection Manager → Weapon Detection: runs detection
- Detection Manager → Fire Detection: runs detection
- Detection Manager → Violence Detection: runs temporal detection
- Detection Manager → Threat Scoring: provides detections
- Threat Scoring → Frame Renderer: provides threat assessment
- Detection Manager → Frame Renderer: provides detections
- Detection Manager → Event Manager: provides detections
- Event Manager → Snapshot Storage: saves snapshot
- Event Manager → SQLite Database: records event
- Event Manager → Alert Dispatch: dispatches alert
- Alert Dispatch → Email Service: sends email
- Alert Dispatch → Local Siren: plays alarm
- Security Operator → Operations Console: uses
- Operations Console → Console Views: renders views
- Console Views → API Client: requests data
- API Client → REST API Routes: calls
- REST API Routes → Flask Application: served by
- REST API Routes → Camera Registry: manages cameras
- REST API Routes → SQLite Database: reads and writes
- REST API Routes → Snapshot Storage: serves snapshots
- REST API Routes → System Telemetry: requests telemetry
- REST API Routes → Live Settings: updates settings
- System Telemetry → Camera Registry: reads stream metrics
- Live Settings → SQLite Database: persists settings
