# mohitrawat5399-source/real_time_alert_system architecture

> Architecture diagram of the GitHub repository mohitrawat5399-source/real_time_alert_system, 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/mohitrawat5399-source/real_time_alert_system
- Repository: https://github.com/mohitrawat5399-source/real_time_alert_system

## Overview

This is a Streamlit real-time person-detection alert system. A user configures monitoring and a YOLO model; the app captures webcam frames, runs detection, and treats person detections as alerts. It records alert details in session state, captures screenshot evidence, and updates the live view, logs, and gallery; audio is optional. The README describes configurable alert conditions generally, while the sampled code specifically shows person detection. Source excerpts omit some setup and alert logic, so uncertain wiring is not shown.

Main entry points: [`stream_lit.py`](https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py) (Streamlit app), [`yolov8n.pt`](https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/yolov8n.pt) (YOLO weights), [`config.json`](https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/config.json) (App configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_app["Streamlit app<br/>[stream_lit.py]"]
  node_config["App configuration<br/>[config.json]"]
  node_dashboard["Live dashboard<br/>[stream_lit.py]"]
end

subgraph group_detection["Detection"]
  node_capture["Frame capture<br/>[stream_lit.py]"]
  node_weights["YOLO weights<br/>[yolov8n.pt]"]
  node_detector["YOLO detection<br/>[stream_lit.py]"]
  node_filter["Person detection<br/>[stream_lit.py]"]
end

subgraph group_alerts["Alerts and history"]
  node_alert["Alert handling<br/>[stream_lit.py]"]
  node_history["Session alert history<br/>[stream_lit.py]"]
  node_screenshots["Screenshot evidence<br/>[stream_lit.py]"]
  node_logs["Alert log and gallery<br/>[stream_lit.py]"]
end

node_user(("Operator"))
node_webcam(("Webcam"))
node_audio["System beep"]

node_user -->|"configures monitoring"| node_app
node_app -->|"reads and saves"| node_config
node_app -->|"starts capture"| node_capture
node_capture -->|"reads frames"| node_webcam
node_app -->|"runs inference"| node_detector
node_weights -->|"loads weights"| node_detector
node_detector -->|"provides detections"| node_filter
node_app -->|"handles detections"| node_alert
node_alert -->|"records alerts"| node_history
node_alert -->|"saves evidence"| node_screenshots
node_alert -.->|"starts beep"| node_audio
node_app -->|"updates live view"| node_dashboard
node_app -->|"refreshes displays"| node_logs
node_history -->|"supplies alert entries"| node_logs

click node_app "https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py"
click node_config "https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/config.json"
click node_dashboard "https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py"
click node_capture "https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py"
click node_weights "https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/yolov8n.pt"
click node_detector "https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py"
click node_filter "https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py"
click node_alert "https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py"
click node_history "https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py"
click node_screenshots "https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py"
click node_logs "https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.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_app,node_config,node_dashboard toneBlue
class node_capture,node_weights,node_detector,node_filter toneAmber
class node_alert,node_history,node_screenshots,node_logs toneMint
class node_user,node_webcam,node_audio toneIndigo
```

## Components

### User interface

- [Streamlit app](https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py): `stream_lit.py`
- [App configuration](https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/config.json): `config.json`
- [Live dashboard](https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py): `stream_lit.py`

### Detection

- [Frame capture](https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py): `stream_lit.py`
- [YOLO weights](https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/yolov8n.pt): `yolov8n.pt`
- [YOLO detection](https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py): `stream_lit.py`
- [Person detection](https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py): `stream_lit.py`

### Alerts and history

- [Alert handling](https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py): `stream_lit.py`
- [Session alert history](https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py): `stream_lit.py`
- [Screenshot evidence](https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py): `stream_lit.py`
- [Alert log and gallery](https://github.com/mohitrawat5399-source/real_time_alert_system/blob/main/stream_lit.py): `stream_lit.py`

### Other components

- **Operator**
- **Webcam**
- **System beep**

## Connections

- Operator → Streamlit app: configures monitoring
- Streamlit app → App configuration: reads and saves
- Streamlit app → Frame capture: starts capture
- Frame capture → Webcam: reads frames
- Streamlit app → YOLO detection: runs inference
- YOLO weights → YOLO detection: loads weights
- YOLO detection → Person detection: provides detections
- Streamlit app → Alert handling: handles detections
- Alert handling → Session alert history: records alerts
- Alert handling → Screenshot evidence: saves evidence
- Alert handling → System beep: starts beep
- Streamlit app → Live dashboard: updates live view
- Streamlit app → Alert log and gallery: refreshes displays
- Session alert history → Alert log and gallery: supplies alert entries
