# quoccuong66/project-monitoring-model architecture

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

- Interactive diagram: https://gitdiagram.com/quoccuong66/project-monitoring-model
- Repository: https://github.com/quoccuong66/project-monitoring-model

## Overview

This is an edge-based camera monitoring system for detecting falls and other observable abnormal behavior, escalating risk for human verification rather than diagnosis. Its primary workflow ingests live or recorded video, tracks people, extracts pose and temporal behavior signals, fuses risk, and dispatches alerts; a FastAPI service exposes monitoring controls. The README also documents model training. Runtime links follow the README and shown imports/references; unsampled implementation details and some wiring are omitted rather than inferred.

Main entry points: [`src/pipeline/realtime_pipeline.py`](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/pipeline/realtime_pipeline.py) (Inference pipeline), [`src/api/server.py`](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/api/server.py) (Monitoring API), [`src/risk/risk_engine.py`](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/risk/risk_engine.py) (Risk fusion), [`src/alerts/alert_manager.py`](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/alerts/alert_manager.py) (Alert management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Video ingestion"]
  node_stream["Frame stream<br/>[stream.py]"]
  node_camera_sources["Camera sources"]
end

subgraph group_intelligence["Perception and reasoning"]
  node_pipeline["Inference pipeline"]
  node_motion["Motion gating<br/>[motion_gater.py]"]
  node_detection["Person detection<br/>[detector.py]"]
  node_tracking["Person tracking<br/>[track_manager.py]"]
  node_pose["Pose extraction<br/>[keypoints.py]"]
  node_temporal["Temporal features"]
  node_action["Action classification"]
  node_anomaly["Anomaly scoring<br/>[anomaly_score.py]"]
end

subgraph group_response["Risk and alerts"]
  node_risk["Risk fusion<br/>[risk_engine.py]"]
  node_thresholds["Risk thresholds"]
  node_alerts["Alert management<br/>[alert_manager.py]"]
  node_eventlog["Event logging<br/>[event_logger.py]"]
  node_notify["Notification dispatch<br/>[notification.py]"]
  node_channels(("Alert channels"))
end

subgraph group_interfaces["Operator interfaces"]
  node_main["Application launcher<br/>[main.py]"]
  node_api["Monitoring API<br/>[server.py]"]
  node_dashboard["Web dashboard<br/>[app.js]"]
end

subgraph group_modeling["Model training"]
  node_training_prep["Dataset preparation<br/>[prepare_ntu.py]"]
  node_training_action["Action model training<br/>[train_action.py]"]
  node_training_anomaly["Anomaly model training<br/>[train_anomaly.py]"]
end

node_operator(("Care operator"))
node_camera(("Camera or video"))

node_camera -->|"provides video"| node_camera_sources
node_camera_sources -->|"produces frames"| node_stream
node_main -->|"starts inference"| node_pipeline
node_main -->|"starts service"| node_api
node_api -->|"selects source"| node_camera_sources
node_api -->|"starts pipeline"| node_pipeline
node_dashboard -.->|"uses monitoring service"| node_api
node_stream -.->|"supplies frames"| node_pipeline
node_pipeline -->|"gates inference"| node_motion
node_pipeline -->|"detects people"| node_detection
node_pipeline -->|"updates tracks"| node_tracking
node_pipeline -->|"extracts pose"| node_pose
node_pipeline -->|"builds features"| node_temporal
node_pipeline -->|"classifies actions"| node_action
node_pipeline -->|"scores anomalies"| node_anomaly
node_pipeline -->|"assesses risk"| node_risk
node_risk -->|"loads thresholds"| node_thresholds
node_risk -.->|"provides assessment"| node_alerts
node_alerts -->|"logs event"| node_eventlog
node_alerts -->|"dispatches event"| node_notify
node_notify -.->|"sends alerts"| node_channels
node_operator -.->|"reviews status"| node_dashboard
node_training_prep -.->|"prepares data"| node_training_action
node_training_prep -.->|"prepares data"| node_training_anomaly

click node_main "https://github.com/quoccuong66/project-monitoring-model/blob/main/main.py"
click node_api "https://github.com/quoccuong66/project-monitoring-model/blob/main/src/api/server.py"
click node_dashboard "https://github.com/quoccuong66/project-monitoring-model/blob/main/frontend/app.js"
click node_stream "https://github.com/quoccuong66/project-monitoring-model/blob/main/src/camera/stream.py"
click node_camera_sources "https://github.com/quoccuong66/project-monitoring-model/tree/main/src/camera"
click node_pipeline "https://github.com/quoccuong66/project-monitoring-model/blob/main/src/pipeline/realtime_pipeline.py"
click node_motion "https://github.com/quoccuong66/project-monitoring-model/blob/main/src/detection/motion_gater.py"
click node_detection "https://github.com/quoccuong66/project-monitoring-model/blob/main/src/detection/detector.py"
click node_tracking "https://github.com/quoccuong66/project-monitoring-model/blob/main/src/tracking/track_manager.py"
click node_pose "https://github.com/quoccuong66/project-monitoring-model/blob/main/src/pose/keypoints.py"
click node_temporal "https://github.com/quoccuong66/project-monitoring-model/blob/main/src/temporal/temporal_features.py"
click node_action "https://github.com/quoccuong66/project-monitoring-model/blob/main/src/action/action_classifier.py"
click node_anomaly "https://github.com/quoccuong66/project-monitoring-model/blob/main/src/anomaly/anomaly_score.py"
click node_risk "https://github.com/quoccuong66/project-monitoring-model/blob/main/src/risk/risk_engine.py"
click node_thresholds "https://github.com/quoccuong66/project-monitoring-model/blob/main/src/risk/threshold_manager.py"
click node_alerts "https://github.com/quoccuong66/project-monitoring-model/blob/main/src/alerts/alert_manager.py"
click node_eventlog "https://github.com/quoccuong66/project-monitoring-model/blob/main/src/alerts/event_logger.py"
click node_notify "https://github.com/quoccuong66/project-monitoring-model/blob/main/src/alerts/notification.py"
click node_training_prep "https://github.com/quoccuong66/project-monitoring-model/blob/main/training/prepare_ntu.py"
click node_training_action "https://github.com/quoccuong66/project-monitoring-model/blob/main/training/train_action.py"
click node_training_anomaly "https://github.com/quoccuong66/project-monitoring-model/blob/main/training/train_anomaly.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_stream,node_camera_sources toneBlue
class node_pipeline,node_motion,node_detection,node_tracking,node_pose,node_temporal,node_action,node_anomaly toneAmber
class node_risk,node_thresholds,node_alerts,node_eventlog,node_notify,node_channels toneMint
class node_main,node_api,node_dashboard toneRose
class node_training_prep,node_training_action,node_training_anomaly,node_operator,node_camera toneIndigo
```

## Components

### Video ingestion

- [Frame stream](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/camera/stream.py): `src/camera/stream.py`
- [Camera sources](https://github.com/quoccuong66/project-monitoring-model/tree/main/src/camera): `src/camera`

### Perception and reasoning

- [Inference pipeline](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/pipeline/realtime_pipeline.py): `src/pipeline/realtime_pipeline.py`
- [Motion gating](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/detection/motion_gater.py): `src/detection/motion_gater.py`
- [Person detection](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/detection/detector.py): `src/detection/detector.py`
- [Person tracking](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/tracking/track_manager.py): `src/tracking/track_manager.py`
- [Pose extraction](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/pose/keypoints.py): `src/pose/keypoints.py`
- [Temporal features](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/temporal/temporal_features.py): `src/temporal/temporal_features.py`
- [Action classification](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/action/action_classifier.py): `src/action/action_classifier.py`
- [Anomaly scoring](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/anomaly/anomaly_score.py): `src/anomaly/anomaly_score.py`

### Risk and alerts

- [Risk fusion](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/risk/risk_engine.py): `src/risk/risk_engine.py`
- [Risk thresholds](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/risk/threshold_manager.py): `src/risk/threshold_manager.py`
- [Alert management](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/alerts/alert_manager.py): `src/alerts/alert_manager.py`
- [Event logging](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/alerts/event_logger.py): `src/alerts/event_logger.py`
- [Notification dispatch](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/alerts/notification.py): `src/alerts/notification.py`
- **Alert channels**

### Operator interfaces

- [Application launcher](https://github.com/quoccuong66/project-monitoring-model/blob/main/main.py): `main.py`
- [Monitoring API](https://github.com/quoccuong66/project-monitoring-model/blob/main/src/api/server.py): `src/api/server.py`
- [Web dashboard](https://github.com/quoccuong66/project-monitoring-model/blob/main/frontend/app.js): `frontend/app.js`

### Model training

- [Dataset preparation](https://github.com/quoccuong66/project-monitoring-model/blob/main/training/prepare_ntu.py): `training/prepare_ntu.py`
- [Action model training](https://github.com/quoccuong66/project-monitoring-model/blob/main/training/train_action.py): `training/train_action.py`
- [Anomaly model training](https://github.com/quoccuong66/project-monitoring-model/blob/main/training/train_anomaly.py): `training/train_anomaly.py`

### Other components

- **Care operator**
- **Camera or video**

## Connections

- Camera or video → Camera sources: provides video (evidence: `README.md`)
- Camera sources → Frame stream: produces frames (evidence: `src/camera/webcam.py`)
- Application launcher → Inference pipeline: starts inference (evidence: `main.py`)
- Application launcher → Monitoring API: starts service (evidence: `main.py`)
- Monitoring API → Camera sources: selects source (evidence: `src/api/server.py`)
- Monitoring API → Inference pipeline: starts pipeline (evidence: `src/api/server.py`)
- Web dashboard → Monitoring API: uses monitoring service (evidence: `README.md`)
- Frame stream → Inference pipeline: supplies frames (evidence: `README.md`)
- Inference pipeline → Motion gating: gates inference (evidence: `src/pipeline/realtime_pipeline.py`)
- Inference pipeline → Person detection: detects people (evidence: `src/pipeline/realtime_pipeline.py`)
- Inference pipeline → Person tracking: updates tracks (evidence: `src/pipeline/realtime_pipeline.py`)
- Inference pipeline → Pose extraction: extracts pose (evidence: `src/pipeline/realtime_pipeline.py`)
- Inference pipeline → Temporal features: builds features (evidence: `src/pipeline/realtime_pipeline.py`)
- Inference pipeline → Action classification: classifies actions (evidence: `src/pipeline/realtime_pipeline.py`)
- Inference pipeline → Anomaly scoring: scores anomalies (evidence: `src/pipeline/realtime_pipeline.py`)
- Inference pipeline → Risk fusion: assesses risk (evidence: `src/pipeline/realtime_pipeline.py`)
- Risk fusion → Risk thresholds: loads thresholds (evidence: `src/risk/risk_engine.py`)
- Risk fusion → Alert management: provides assessment (evidence: `README.md`)
- Alert management → Event logging: logs event (evidence: `src/alerts/alert_manager.py`)
- Alert management → Notification dispatch: dispatches event (evidence: `src/alerts/alert_manager.py`)
- Notification dispatch → Alert channels: sends alerts (evidence: `README.md`)
- Care operator → Web dashboard: reviews status (evidence: `README.md`)
- Dataset preparation → Action model training: prepares data (evidence: `README.md`)
- Dataset preparation → Anomaly model training: prepares data (evidence: `README.md`)
