# gokkul-ks/fall-detector-agent architecture

> Architecture diagram of the GitHub repository gokkul-ks/fall-detector-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gokkul-ks/fall-detector-agent
- Repository: https://github.com/gokkul-ks/fall-detector-agent

## Overview

CareGuard AI monitors a camera feed, detects and verifies possible falls, records confirmed incidents, and alerts caretakers; the React dashboard supports monitoring and incident management. The graph retains the documented analytics, reports, settings, contacts, authentication, and live-stream capabilities. Some backend links rely on the README sequence diagram or SOURCE INDEX references; unsampled implementation details are not inferred beyond those relationships.

Main entry points: [`frontend/src/App.js`](https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/App.js) (App router), [`backend/models/detect.py`](https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/models/detect.py) (Fall detector), [`backend/alerts/alert.py`](https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/alerts/alert.py) (Alert dispatcher), [`backend/main.py`](https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/main.py) (API and auth)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and detection"]
  node_camera["Camera stream<br/>[camera.py]"]
  node_detector["Fall detector<br/>[detect.py]"]
  node_tracker["Object tracker<br/>[tracker.py]"]
end

subgraph group_response["Incident response"]
  node_alert_dispatcher["Alert dispatcher<br/>[alert.py]"]
  node_video_recorder["Video recorder<br/>[video_recorder.py]"]
  node_sms["SMS and WhatsApp<br/>[sms_service.py]"]
  node_email["Email alerts<br/>[email_service.py]"]
end

subgraph group_backend["Backend services"]
  node_api["API and auth<br/>[main.py]"]
  node_database[("Incident database<br/>[database.py]")]
  node_settings["System settings<br/>[settings.py]"]
  node_dashboard_service["Dashboard telemetry<br/>[dashboard.py]"]
  node_reports_service["Report generation<br/>[reports.py]"]
end

subgraph group_frontend["Dashboard experience"]
  node_app["App router<br/>[App.js]"]
  node_dashboard_page["Live dashboard<br/>[Dashboard.js]"]
  node_analytics["Analytics<br/>[Analytics.js]"]
  node_history["Incident history<br/>[IncidentHistory.js]"]
  node_reports_page["Reports<br/>[Reports.js]"]
  node_settings_page["Settings<br/>[Settings.js]"]
  node_contacts["Emergency contacts"]
  node_login["Login<br/>[Login.js]"]
  node_about["About<br/>[About.js]"]
end

node_caretaker(("Caretaker"))
node_sms_provider["Twilio"]
node_mail_provider["SMTP server"]
node_web_client(("Caretaker browser"))

node_web_client -->|"opens"| node_app
node_caretaker -->|"uses"| node_web_client
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard_page
node_app -->|"routes to"| node_analytics
node_app -->|"routes to"| node_history
node_app -->|"routes to"| node_reports_page
node_app -->|"routes to"| node_settings_page
node_app -->|"routes to"| node_contacts
node_app -->|"routes to"| node_about
node_app -.->|"sends API requests"| node_api
node_api -->|"reads and writes"| node_database
node_api -->|"starts stream"| node_camera
node_api -.->|"starts inference"| node_detector
node_detector -->|"fetches frames"| node_camera
node_detector -->|"updates tracks"| node_tracker
node_detector -->|"records incident"| node_database
node_detector -->|"triggers response"| node_alert_dispatcher
node_detector -->|"streams telemetry"| node_dashboard_service
node_alert_dispatcher -->|"stores incident"| node_database
node_alert_dispatcher -->|"starts recording"| node_video_recorder
node_alert_dispatcher -->|"dispatches message"| node_sms
node_alert_dispatcher -->|"dispatches email"| node_email
node_sms -->|"sends via"| node_sms_provider
node_email -->|"sends via"| node_mail_provider
node_reports_page -.->|"requests reports"| node_reports_service
node_reports_service -->|"reads incidents"| node_database
node_analytics -.->|"requests telemetry"| node_dashboard_service
node_dashboard_service -->|"queries incidents"| node_database
node_settings_page -.->|"configures"| node_settings
node_contacts -.->|"manages contacts"| node_settings
node_api -.->|"loads configuration"| node_settings

click node_camera "https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/camera/camera.py"
click node_detector "https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/models/detect.py"
click node_tracker "https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/models/tracker.py"
click node_api "https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/main.py"
click node_database "https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/database/database.py"
click node_settings "https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/utils/settings.py"
click node_dashboard_service "https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/dashboard/dashboard.py"
click node_reports_service "https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/reports/reports.py"
click node_alert_dispatcher "https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/alerts/alert.py"
click node_video_recorder "https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/utils/video_recorder.py"
click node_sms "https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/services/sms_service.py"
click node_email "https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/services/email_service.py"
click node_app "https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/App.js"
click node_dashboard_page "https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/Dashboard.js"
click node_analytics "https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/Analytics.js"
click node_history "https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/IncidentHistory.js"
click node_reports_page "https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/Reports.js"
click node_settings_page "https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/Settings.js"
click node_contacts "https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/EmergencyContacts.js"
click node_login "https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/Login.js"
click node_about "https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/About.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_camera,node_detector,node_tracker,node_web_client toneBlue
class node_alert_dispatcher,node_video_recorder,node_sms,node_email toneAmber
class node_api,node_database,node_settings,node_dashboard_service,node_reports_service,node_mail_provider toneMint
class node_app,node_dashboard_page,node_analytics,node_history,node_reports_page,node_settings_page,node_contacts,node_login,node_about toneRose
class node_caretaker,node_sms_provider toneIndigo
```

## Components

### Capture and detection

- [Camera stream](https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/camera/camera.py): `backend/camera/camera.py`
- [Fall detector](https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/models/detect.py): `backend/models/detect.py`
- [Object tracker](https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/models/tracker.py): `backend/models/tracker.py`

### Incident response

- [Alert dispatcher](https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/alerts/alert.py): `backend/alerts/alert.py`
- [Video recorder](https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/utils/video_recorder.py): `backend/utils/video_recorder.py`
- [SMS and WhatsApp](https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/services/sms_service.py): `backend/services/sms_service.py`
- [Email alerts](https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/services/email_service.py): `backend/services/email_service.py`

### Backend services

- [API and auth](https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/main.py): `backend/main.py`
- [Incident database](https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/database/database.py): `backend/database/database.py`
- [System settings](https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/utils/settings.py): `backend/utils/settings.py`
- [Dashboard telemetry](https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/dashboard/dashboard.py): `backend/dashboard/dashboard.py`
- [Report generation](https://github.com/gokkul-ks/fall-detector-agent/blob/main/backend/reports/reports.py): `backend/reports/reports.py`

### Dashboard experience

- [App router](https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Live dashboard](https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/Dashboard.js): `frontend/src/pages/Dashboard.js`
- [Analytics](https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/Analytics.js): `frontend/src/pages/Analytics.js`
- [Incident history](https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/IncidentHistory.js): `frontend/src/pages/IncidentHistory.js`
- [Reports](https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/Reports.js): `frontend/src/pages/Reports.js`
- [Settings](https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/Settings.js): `frontend/src/pages/Settings.js`
- [Emergency contacts](https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/EmergencyContacts.js): `frontend/src/pages/EmergencyContacts.js`
- [Login](https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/Login.js): `frontend/src/pages/Login.js`
- [About](https://github.com/gokkul-ks/fall-detector-agent/blob/main/frontend/src/pages/About.js): `frontend/src/pages/About.js`

### Other components

- **Caretaker**
- **Twilio**
- **SMTP server**
- **Caretaker browser**

## Connections

- Caretaker browser → App router: opens
- Caretaker → Caretaker browser: uses
- App router → Login: routes to (evidence: `frontend/src/App.js`)
- App router → Live dashboard: routes to (evidence: `frontend/src/App.js`)
- App router → Analytics: routes to (evidence: `frontend/src/App.js`)
- App router → Incident history: routes to (evidence: `frontend/src/App.js`)
- App router → Reports: routes to (evidence: `frontend/src/App.js`)
- App router → Settings: routes to (evidence: `frontend/src/App.js`)
- App router → Emergency contacts: routes to (evidence: `frontend/src/App.js`)
- App router → About: routes to (evidence: `frontend/src/App.js`)
- App router → API and auth: sends API requests (evidence: `README.md`)
- API and auth → Incident database: reads and writes (evidence: `backend/main.py`)
- API and auth → Camera stream: starts stream (evidence: `backend/main.py`)
- API and auth → Fall detector: starts inference (evidence: `README.md`)
- Fall detector → Camera stream: fetches frames (evidence: `README.md`)
- Fall detector → Object tracker: updates tracks (evidence: `README.md`)
- Fall detector → Incident database: records incident (evidence: `README.md`)
- Fall detector → Alert dispatcher: triggers response (evidence: `README.md`)
- Fall detector → Dashboard telemetry: streams telemetry (evidence: `README.md`)
- Alert dispatcher → Incident database: stores incident (evidence: `backend/alerts/alert.py`)
- Alert dispatcher → Video recorder: starts recording (evidence: `backend/alerts/alert.py`)
- Alert dispatcher → SMS and WhatsApp: dispatches message (evidence: `backend/alerts/alert.py`)
- Alert dispatcher → Email alerts: dispatches email (evidence: `backend/alerts/alert.py`)
- SMS and WhatsApp → Twilio: sends via (evidence: `backend/services/sms_service.py`)
- Email alerts → SMTP server: sends via (evidence: `backend/services/email_service.py`)
- Reports → Report generation: requests reports
- Report generation → Incident database: reads incidents (evidence: `backend/reports/reports.py`)
- Analytics → Dashboard telemetry: requests telemetry
- Dashboard telemetry → Incident database: queries incidents (evidence: `backend/dashboard/dashboard.py`)
- Settings → System settings: configures
- Emergency contacts → System settings: manages contacts
- API and auth → System settings: loads configuration (evidence: `backend/main.py`)
