# yaseenupskills-ops/ml-project architecture

> Architecture diagram of the GitHub repository yaseenupskills-ops/ml-project, 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/yaseenupskills-ops/ml-project
- Repository: https://github.com/yaseenupskills-ops/ml-project

## Overview

FallGuard is an on-device fall-detection system: camera/video input becomes pose keypoints and temporal features, then model predictions pass through voting, a grace period, and caregiver alerts. The Streamlit dashboard provides alert and live-monitor views; local metrics and alert history support operations. Evaluation and the CNN-LSTM model are separate documented capabilities. The live pipeline and several integrations are supported by indexed references; unsampled dashboard and server details limit some relationship claims.

Main entry points: [`live_detection.py`](https://github.com/yaseenupskills-ops/ml-project/blob/main/live_detection.py) (Live detection), [`dashboard/app.py`](https://github.com/yaseenupskills-ops/ml-project/blob/main/dashboard/app.py) (Caregiver dashboard), [`alert.py`](https://github.com/yaseenupskills-ops/ml-project/blob/main/alert.py) (Alert delivery), [`stream_server.py`](https://github.com/yaseenupskills-ops/ml-project/blob/main/stream_server.py) (Local stream server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Capture and pose"]
  node_camera["Camera sources<br/>[camera.py]"]
  node_pose["Pose extraction<br/>[pose_extraction.py]"]
  node_features["Temporal features<br/>[features.py]"]
end

subgraph group_inference["Detection pipeline"]
  node_live["Live detection<br/>[live_detection.py]"]
  node_rf["Random Forest<br/>[model_rf.py]"]
  node_cnn["CNN-LSTM<br/>[model_cnn_lstm.py]"]
  node_decision["Voting and tiers<br/>[decision_logic.py]"]
  node_grace["Grace period<br/>[grace_period.py]"]
end

subgraph group_operations["Caregiver operations"]
  node_alerts["Alert delivery<br/>[alert.py]"]
  node_dashboard["Caregiver dashboard<br/>[app.py]"]
  node_history[("Alert history<br/>[alert_store.py]")]
  node_stream["Local stream server<br/>[stream_server.py]"]
end

subgraph group_analysis["Model evaluation"]
  node_evaluation["Held-out evaluation<br/>[evaluate.py]"]
end

subgraph group_foundation["Runtime support"]
  node_metrics["Live metrics<br/>[metrics.py]"]
  node_config["Configuration<br/>[project_config.py]"]
end

node_resident(("Camera scene"))
node_caregiver(("Caregiver"))
node_email_service["Email service"]

node_resident -->|"provides video"| node_camera
node_camera -.->|"supplies frames"| node_pose
node_live -->|"extracts keypoints"| node_pose
node_live -->|"computes features"| node_features
node_live -->|"predicts falls"| node_rf
node_live -->|"votes predictions"| node_decision
node_live -->|"confirms candidate"| node_grace
node_live -->|"sends alert"| node_alerts
node_live -->|"updates metrics"| node_metrics
node_dashboard -.->|"uses live stream"| node_stream
node_stream -->|"opens camera"| node_camera
node_stream -->|"reads metrics"| node_metrics
node_dashboard -->|"views alert history"| node_history
node_alerts -->|"records alerts"| node_history
node_dashboard -->|"presents status"| node_caregiver
node_alerts -->|"sends email"| node_email_service
node_evaluation -->|"evaluates model"| node_rf
node_config -.->|"configures runtime"| node_live
node_cnn -.->|"supports evaluation"| node_evaluation

click node_camera "https://github.com/yaseenupskills-ops/ml-project/blob/main/camera.py"
click node_pose "https://github.com/yaseenupskills-ops/ml-project/blob/main/pose_extraction.py"
click node_features "https://github.com/yaseenupskills-ops/ml-project/blob/main/features.py"
click node_live "https://github.com/yaseenupskills-ops/ml-project/blob/main/live_detection.py"
click node_rf "https://github.com/yaseenupskills-ops/ml-project/blob/main/model_rf.py"
click node_cnn "https://github.com/yaseenupskills-ops/ml-project/blob/main/model_cnn_lstm.py"
click node_decision "https://github.com/yaseenupskills-ops/ml-project/blob/main/decision_logic.py"
click node_grace "https://github.com/yaseenupskills-ops/ml-project/blob/main/grace_period.py"
click node_alerts "https://github.com/yaseenupskills-ops/ml-project/blob/main/alert.py"
click node_dashboard "https://github.com/yaseenupskills-ops/ml-project/blob/main/dashboard/app.py"
click node_history "https://github.com/yaseenupskills-ops/ml-project/blob/main/alert_store.py"
click node_stream "https://github.com/yaseenupskills-ops/ml-project/blob/main/stream_server.py"
click node_metrics "https://github.com/yaseenupskills-ops/ml-project/blob/main/metrics.py"
click node_config "https://github.com/yaseenupskills-ops/ml-project/blob/main/project_config.py"
click node_evaluation "https://github.com/yaseenupskills-ops/ml-project/blob/main/evaluate.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,node_pose,node_features toneBlue
class node_live,node_rf,node_cnn,node_decision,node_grace toneAmber
class node_alerts,node_dashboard,node_history,node_stream toneMint
class node_evaluation toneRose
class node_metrics,node_config,node_resident,node_caregiver,node_email_service toneIndigo
```

## Components

### Capture and pose

- [Camera sources](https://github.com/yaseenupskills-ops/ml-project/blob/main/camera.py): `camera.py`
- [Pose extraction](https://github.com/yaseenupskills-ops/ml-project/blob/main/pose_extraction.py): `pose_extraction.py`
- [Temporal features](https://github.com/yaseenupskills-ops/ml-project/blob/main/features.py): `features.py`

### Detection pipeline

- [Live detection](https://github.com/yaseenupskills-ops/ml-project/blob/main/live_detection.py): `live_detection.py`
- [Random Forest](https://github.com/yaseenupskills-ops/ml-project/blob/main/model_rf.py): `model_rf.py`
- [CNN-LSTM](https://github.com/yaseenupskills-ops/ml-project/blob/main/model_cnn_lstm.py): `model_cnn_lstm.py`
- [Voting and tiers](https://github.com/yaseenupskills-ops/ml-project/blob/main/decision_logic.py): `decision_logic.py`
- [Grace period](https://github.com/yaseenupskills-ops/ml-project/blob/main/grace_period.py): `grace_period.py`

### Caregiver operations

- [Alert delivery](https://github.com/yaseenupskills-ops/ml-project/blob/main/alert.py): `alert.py`
- [Caregiver dashboard](https://github.com/yaseenupskills-ops/ml-project/blob/main/dashboard/app.py): `dashboard/app.py`
- [Alert history](https://github.com/yaseenupskills-ops/ml-project/blob/main/alert_store.py): `alert_store.py`
- [Local stream server](https://github.com/yaseenupskills-ops/ml-project/blob/main/stream_server.py): `stream_server.py`

### Model evaluation

- [Held-out evaluation](https://github.com/yaseenupskills-ops/ml-project/blob/main/evaluate.py): `evaluate.py`

### Runtime support

- [Live metrics](https://github.com/yaseenupskills-ops/ml-project/blob/main/metrics.py): `metrics.py`
- [Configuration](https://github.com/yaseenupskills-ops/ml-project/blob/main/project_config.py): `project_config.py`

### Other components

- **Camera scene**
- **Caregiver**
- **Email service**

## Connections

- Camera scene → Camera sources: provides video (evidence: `README.md`)
- Camera sources → Pose extraction: supplies frames
- Live detection → Pose extraction: extracts keypoints (evidence: `live_detection.py`)
- Live detection → Temporal features: computes features (evidence: `live_detection.py`)
- Live detection → Random Forest: predicts falls (evidence: `live_detection.py`)
- Live detection → Voting and tiers: votes predictions (evidence: `live_detection.py`)
- Live detection → Grace period: confirms candidate (evidence: `live_detection.py`)
- Live detection → Alert delivery: sends alert (evidence: `live_detection.py`)
- Live detection → Live metrics: updates metrics (evidence: `live_detection.py`)
- Caregiver dashboard → Local stream server: uses live stream (evidence: `dashboard/app.py`)
- Local stream server → Camera sources: opens camera (evidence: `stream_server.py`)
- Local stream server → Live metrics: reads metrics (evidence: `stream_server.py`)
- Caregiver dashboard → Alert history: views alert history (evidence: `dashboard/app.py`)
- Alert delivery → Alert history: records alerts (evidence: `alert.py`)
- Caregiver dashboard → Caregiver: presents status (evidence: `README.md`)
- Alert delivery → Email service: sends email (evidence: `alert.py`)
- Held-out evaluation → Random Forest: evaluates model (evidence: `evaluate.py`)
- Configuration → Live detection: configures runtime (evidence: `live_detection.py`)
- CNN-LSTM → Held-out evaluation: supports evaluation
