# vishal060803/theft-surveillance architecture

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

- Interactive diagram: https://gitdiagram.com/vishal060803/theft-surveillance
- Repository: https://github.com/vishal060803/theft-surveillance

## Overview

This prototype monitors webcam and RTSP feeds, turns detected or inferred security events into alerts and recorded evidence, then exposes operational summaries through a Flask dashboard and JSON API. The main path is camera processing → event qualification → alert/evidence persistence → operator review and reporting. Several responsibilities share `backend/realtime_surveillance.py`; the excerpts show its storage, zone, clip, and notification capabilities but omit parts of the processing loop, so some workflow links rely on the README rather than inspected call sites.

Main entry points: [`app.py`](https://github.com/vishal060803/theft-surveillance/blob/main/app.py) (Flask routes and API), [`backend/realtime_surveillance.py`](https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py) (Event and risk assessment), [`backend/dashboard.html`](https://github.com/vishal060803/theft-surveillance/blob/main/backend/dashboard.html) (Operator dashboard), [`config.py`](https://github.com/vishal060803/theft-surveillance/blob/main/config.py) (Runtime configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Surveillance processing"]
  node_pipeline["Camera processing"]
  node_detection["Detection and tracking"]
end

subgraph group_incident["Incident handling"]
  node_eventlogic["Event and risk assessment"]
  node_zones["Zone activity"]
  node_alerts["Alert handling"]
  node_evidence["Evidence capture"]
  node_eventdb[("SQLite event records")]
  node_evidencedir[("Evidence files")]
end

subgraph group_service["Web service"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_flask["Flask routes and API<br/>[app.py]"]
  node_reports["Summaries and reports"]
  node_systemops["Health and retention"]
  node_validation["Validation metrics"]
end

subgraph group_operator["Dashboard and integrations"]
  node_dashboard["Operator dashboard<br/>[dashboard.html]"]
end

node_camera(("Camera feeds"))
node_pushbullet{{"Pushbullet"}}
node_maps{{"Google Maps"}}
node_operatoractor(("Security operator"))

node_camera -->|"supplies frames"| node_pipeline
node_config -->|"configures"| node_flask
node_config -->|"configures"| node_pipeline
node_flask -->|"starts thread"| node_pipeline
node_pipeline -->|"processes frames"| node_detection
node_detection -->|"qualifies events"| node_eventlogic
node_eventlogic -->|"summarizes zones"| node_zones
node_eventlogic -->|"raises alerts"| node_alerts
node_eventlogic -->|"captures incidents"| node_evidence
node_alerts -->|"records alerts"| node_eventdb
node_evidence -->|"records metadata"| node_eventdb
node_evidence -->|"writes clips"| node_evidencedir
node_alerts -.->|"notifies"| node_pushbullet
node_flask -->|"serves"| node_dashboard
node_dashboard -->|"requests data"| node_flask
node_flask -->|"reads records"| node_eventdb
node_flask -->|"lists evidence"| node_evidencedir
node_flask -->|"requests summaries"| node_reports
node_flask -->|"requests health"| node_systemops
node_flask -->|"runs validation"| node_validation
node_reports -->|"queries events"| node_eventdb
node_dashboard -.->|"shows map"| node_maps
node_operatoractor -->|"reviews incidents"| node_dashboard

click node_config "https://github.com/vishal060803/theft-surveillance/blob/main/config.py"
click node_pipeline "https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py"
click node_detection "https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py"
click node_eventlogic "https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py"
click node_zones "https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py"
click node_alerts "https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py"
click node_evidence "https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py"
click node_eventdb "https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py"
click node_evidencedir "https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py"
click node_flask "https://github.com/vishal060803/theft-surveillance/blob/main/app.py"
click node_dashboard "https://github.com/vishal060803/theft-surveillance/blob/main/backend/dashboard.html"
click node_reports "https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py"
click node_systemops "https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py"
click node_validation "https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.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_pipeline,node_detection toneBlue
class node_eventlogic,node_zones,node_alerts,node_evidence,node_eventdb,node_evidencedir toneAmber
class node_config,node_flask,node_reports,node_systemops,node_validation toneMint
class node_dashboard toneRose
class node_camera,node_pushbullet,node_maps,node_operatoractor toneIndigo
```

## Components

### Surveillance processing

- [Camera processing](https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py): `backend/realtime_surveillance.py`
- [Detection and tracking](https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py): `backend/realtime_surveillance.py`

### Incident handling

- [Event and risk assessment](https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py): `backend/realtime_surveillance.py`
- [Zone activity](https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py): `backend/realtime_surveillance.py`
- [Alert handling](https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py): `backend/realtime_surveillance.py`
- [Evidence capture](https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py): `backend/realtime_surveillance.py`
- [SQLite event records](https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py): `backend/realtime_surveillance.py`
- [Evidence files](https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py): `backend/realtime_surveillance.py`

### Web service

- [Runtime configuration](https://github.com/vishal060803/theft-surveillance/blob/main/config.py): `config.py`
- [Flask routes and API](https://github.com/vishal060803/theft-surveillance/blob/main/app.py): `app.py`
- [Summaries and reports](https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py): `backend/realtime_surveillance.py`
- [Health and retention](https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py): `backend/realtime_surveillance.py`
- [Validation metrics](https://github.com/vishal060803/theft-surveillance/blob/main/backend/realtime_surveillance.py): `backend/realtime_surveillance.py`

### Dashboard and integrations

- [Operator dashboard](https://github.com/vishal060803/theft-surveillance/blob/main/backend/dashboard.html): `backend/dashboard.html`

### Other components

- **Camera feeds**
- **Pushbullet**
- **Google Maps**
- **Security operator**

## Connections

- Camera feeds → Camera processing: supplies frames (evidence: `README.md`)
- Runtime configuration → Flask routes and API: configures (evidence: `app.py`)
- Runtime configuration → Camera processing: configures (evidence: `README.md`)
- Flask routes and API → Camera processing: starts thread (evidence: `app.py`)
- Camera processing → Detection and tracking: processes frames (evidence: `README.md`)
- Detection and tracking → Event and risk assessment: qualifies events (evidence: `README.md`)
- Event and risk assessment → Zone activity: summarizes zones (evidence: `README.md`)
- Event and risk assessment → Alert handling: raises alerts (evidence: `README.md`)
- Event and risk assessment → Evidence capture: captures incidents (evidence: `README.md`)
- Alert handling → SQLite event records: records alerts (evidence: `README.md`)
- Evidence capture → SQLite event records: records metadata (evidence: `README.md`)
- Evidence capture → Evidence files: writes clips (evidence: `README.md`)
- Alert handling → Pushbullet: notifies (evidence: `README.md`)
- Flask routes and API → Operator dashboard: serves (evidence: `app.py`)
- Operator dashboard → Flask routes and API: requests data (evidence: `README.md`)
- Flask routes and API → SQLite event records: reads records (evidence: `app.py`)
- Flask routes and API → Evidence files: lists evidence (evidence: `app.py`)
- Flask routes and API → Summaries and reports: requests summaries (evidence: `app.py`)
- Flask routes and API → Health and retention: requests health (evidence: `app.py`)
- Flask routes and API → Validation metrics: runs validation (evidence: `app.py`)
- Summaries and reports → SQLite event records: queries events (evidence: `README.md`)
- Operator dashboard → Google Maps: shows map (evidence: `README.md`)
- Security operator → Operator dashboard: reviews incidents (evidence: `README.md`)
