# cdtalley/fall-detection---computer-vision architecture

> Architecture diagram of the GitHub repository cdtalley/fall-detection---computer-vision, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cdtalley/fall-detection---computer-vision
- Repository: https://github.com/cdtalley/fall-detection---computer-vision

## Overview

##### Project type and purpose
- This is a privacy-preserving, real-time fall-risk detection system built around a computer-vision/ML pipeline.
- It consists of two user-facing front ends—a Next.js marketing/demo site and a Streamlit dashboard—and a Python-based processing backend (pose estimation → feature extraction → ML classification → alerting).

##### File structure
- Top-level:
- frontend/ – static Next.js app (marketing site, demo launcher)
- src/ – core Python modules (data_processing.py, model_training.py, realtime_inference.py, performance_analysis.py)
- streamlit_app/ – live monitoring dashboard (realtime_fall_detection.py)
- notebooks/ – exploratory/model investigation notebooks
- quick_start.py – helper to kick off the pipeline end-to-end
- reports/ – MD reports on model performance
- Configuration/build: package.json, tsconfig.json, next.config.js in frontend; requirements.txt at root

##### Extract insights from README
- System pipeline:
Video Input → MediaPipe Pose Estimation → Keypoint Feature Extraction → LSTM/CNN Classification → Streamlit Alert Dashboard
- Tech stack: OpenCV, MediaPipe, TensorFlow, scikit-learn, Streamlit; data analysis via Pandas/NumPy/Matplotlib

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontends"
        FM["Next.js Marketing Site"]:::frontend
        SD["Streamlit Alert Dashboard"]:::frontend
    end

    subgraph "Real-time Processing Pipeline"
        VC["Video Capture (OpenCV VideoCapture)"]:::realtime
        PE["Pose Estimation (MediaPipe Pose)"]:::realtime
        FE["Feature Extraction\n(normalize_and_feature_extract)"]:::realtime
        MI["ML Inference Engine\n(LSTM/CNN Prediction)"]:::realtime
        Alert["Alert Subsystem\n(Email/SMS & Log)"]:::realtime
        VC -->|"frames"| PE
        PE -->|"keypoints"| FE
        FE -->|"features"| MI
        MI -->|"alerts"| Alert
        MI -->|"stream"| SD
    end

    subgraph "Storage & Logging"
        Logs["File-based Logs"]:::storage
        Models["Saved Model Weights\n(models/)"]:::storage
        Alert --> Logs
        MI -->|"update model"| Models
    end

    subgraph "Offline Pipeline"
        DI["Dataset Integration Utilities"]:::offline
        DP["Data Processing Module"]:::offline
        MT["Model Training Module"]:::offline
        PA["Performance Analysis Module"]:::offline
        NB["Exploratory Analysis Notebooks"]:::offline
        DI --> DP
        DP --> MT
        MT --> Models
        Logs --> PA
        PA --> NB
    end

    QC["Quick Start Script\n(End-to-End Launch)"]:::offline
    QC --> VC

    %% Click Events
    click FM "https://github.com/cdtalley/fall-detection---computer-vision/tree/main/frontend/"
    click SD "https://github.com/cdtalley/fall-detection---computer-vision/blob/main/streamlit_app/realtime_fall_detection.py"
    click VC "https://github.com/cdtalley/fall-detection---computer-vision/blob/main/src/realtime_inference.py"
    click PE "https://github.com/cdtalley/fall-detection---computer-vision/blob/main/src/data_processing.py"
    click FE "https://github.com/cdtalley/fall-detection---computer-vision/blob/main/src/data_processing.py"
    click MI "https://github.com/cdtalley/fall-detection---computer-vision/blob/main/src/realtime_inference.py"
    click DI "https://github.com/cdtalley/fall-detection---computer-vision/blob/main/src/dataset_integration.py"
    click MT "https://github.com/cdtalley/fall-detection---computer-vision/blob/main/src/model_training.py"
    click PA "https://github.com/cdtalley/fall-detection---computer-vision/blob/main/src/performance_analysis.py"
    click NB "https://github.com/cdtalley/fall-detection---computer-vision/blob/main/notebooks/Fall_Risk_Detection_Analysis.ipynb"
    click QC "https://github.com/cdtalley/fall-detection---computer-vision/blob/main/quick_start.py"

    %% Styles
    classDef realtime fill:#cce5ff,stroke:#0066cc,color:#000;
    classDef offline fill:#d4edda,stroke:#28a745,color:#000;
    classDef frontend fill:#ffe5b4,stroke:#e69500,color:#000;
    classDef storage fill:#e2e3e5,stroke:#6c757d,color:#000;
```
