# syeswanth156/alzheimer-patient-monitoring-iot architecture

> Architecture diagram of the GitHub repository syeswanth156/alzheimer-patient-monitoring-iot, 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/syeswanth156/alzheimer-patient-monitoring-iot
- Repository: https://github.com/syeswanth156/alzheimer-patient-monitoring-iot

## Overview

This repository is an IoT and ANN-based Alzheimer’s patient-monitoring and emergency-alert system. The principal workflow is sensor measurements stored in Firebase, Python inference that classifies activity and checks safe-zone status, then prediction updates and WhatsApp alerts; a browser dashboard displays live status, sensor values, and location. A separate collector records labeled sensor samples. The firmware’s exact role and its connection to Firebase are suggested by the product description and filename, but its implementation was not sampled, so that link is unverified.

Main entry points: [`predict1.py`](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/predict1.py) (Activity inference), [`firebase.js`](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/firebase.js) (Live status display), [`map.js`](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/map.js) (Patient location map), [`collect_data.py`](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/collect_data.py) (Sample collector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_device["Patient device"]
  node_device["ESP32 monitor<br/>[fire.ino]"]
end

subgraph group_backend["Inference and alerts"]
  node_inference["Activity inference<br/>[predict1.py]"]
  node_model["ANN and scaler<br/>[predict1.py]"]
end

subgraph group_dashboard["Monitoring dashboard"]
  node_dashboard["Monitoring page<br/>[index.html]"]
  node_firebase_config["Browser Firebase setup<br/>[firebase-config.js]"]
  node_live_status["Live status display<br/>[firebase.js]"]
  node_charts["Motion charts<br/>[charts.js]"]
  node_map["Patient location map<br/>[map.js]"]
  node_ui_actions["Dashboard interactions<br/>[script.js]"]
end

subgraph group_collection["Activity data capture"]
  node_collector["Sample collector<br/>[collect_data.py]"]
  node_sample_data[("Activity samples")]
  node_fall_samples[("Fall samples<br/>[fall_data.csv]")]
  node_walking_samples[("Walking samples<br/>[walking_data.csv]")]
end

node_realtime_db[("Firebase database")]
node_messaging["WhatsApp API"]
node_map_tiles["OpenStreetMap tiles"]

node_device -.->|"uploads sensor data"| node_realtime_db
node_inference -->|"reads sensor and zone"| node_realtime_db
node_inference -->|"scales and predicts"| node_model
node_inference -->|"writes prediction"| node_realtime_db
node_inference -->|"sends alerts"| node_messaging
node_collector -->|"reads sensor data"| node_realtime_db
node_collector -->|"records labeled samples"| node_sample_data
node_firebase_config -->|"configures access"| node_realtime_db
node_live_status -->|"imports connection"| node_firebase_config
node_live_status -->|"subscribes to updates"| node_realtime_db
node_map -->|"subscribes to location"| node_realtime_db
node_map -->|"loads map tiles"| node_map_tiles
node_charts -.->|"reads sensor globals"| node_live_status
node_live_status -->|"calls popup and history"| node_ui_actions

click node_device "https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/fire.ino"
click node_inference "https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/predict1.py"
click node_model "https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/predict1.py"
click node_collector "https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/collect_data.py"
click node_sample_data "https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/stationary_data.csv"
click node_fall_samples "https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/fall_data.csv"
click node_walking_samples "https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/walking_data.csv"
click node_dashboard "https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/index.html"
click node_firebase_config "https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/firebase-config.js"
click node_live_status "https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/firebase.js"
click node_charts "https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/charts.js"
click node_map "https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/map.js"
click node_ui_actions "https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/script.js"

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_device toneBlue
class node_inference,node_model,node_realtime_db toneAmber
class node_dashboard,node_firebase_config,node_live_status,node_charts,node_map,node_ui_actions,node_messaging toneMint
class node_collector,node_sample_data,node_fall_samples,node_walking_samples toneRose
class node_map_tiles toneIndigo
```

## Components

### Patient device

- [ESP32 monitor](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/fire.ino): `fire.ino`

### Inference and alerts

- [Activity inference](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/predict1.py): `predict1.py`
- [ANN and scaler](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/predict1.py): `predict1.py`

### Monitoring dashboard

- [Monitoring page](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/index.html): `index.html`
- [Browser Firebase setup](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/firebase-config.js): `firebase-config.js`
- [Live status display](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/firebase.js): `firebase.js`
- [Motion charts](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/charts.js): `charts.js`
- [Patient location map](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/map.js): `map.js`
- [Dashboard interactions](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/script.js): `script.js`

### Activity data capture

- [Sample collector](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/collect_data.py): `collect_data.py`
- [Activity samples](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/stationary_data.csv): `stationary_data.csv`
- [Fall samples](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/fall_data.csv): `fall_data.csv`
- [Walking samples](https://github.com/syeswanth156/alzheimer-patient-monitoring-iot/blob/main/walking_data.csv): `walking_data.csv`

### Other components

- **Firebase database**
- **WhatsApp API**
- **OpenStreetMap tiles**

## Connections

- ESP32 monitor → Firebase database: uploads sensor data
- Activity inference → Firebase database: reads sensor and zone (evidence: `predict1.py`)
- Activity inference → ANN and scaler: scales and predicts (evidence: `predict1.py`)
- Activity inference → Firebase database: writes prediction (evidence: `predict1.py`)
- Activity inference → WhatsApp API: sends alerts (evidence: `predict1.py`)
- Sample collector → Firebase database: reads sensor data (evidence: `collect_data.py`)
- Sample collector → Activity samples: records labeled samples (evidence: `collect_data.py`)
- Browser Firebase setup → Firebase database: configures access (evidence: `firebase-config.js`)
- Live status display → Browser Firebase setup: imports connection (evidence: `firebase.js`)
- Live status display → Firebase database: subscribes to updates (evidence: `firebase.js`)
- Patient location map → Firebase database: subscribes to location (evidence: `map.js`)
- Patient location map → OpenStreetMap tiles: loads map tiles (evidence: `map.js`)
- Motion charts → Live status display: reads sensor globals
- Live status display → Dashboard interactions: calls popup and history (evidence: `firebase.js`)
