# yogesh-kadwe/recover-ai architecture

> Architecture diagram of the GitHub repository yogesh-kadwe/recover-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yogesh-kadwe/recover-ai
- Repository: https://github.com/yogesh-kadwe/recover-ai

## Overview

RecoverAI combines patient-facing recovery tools and role-specific clinical portals with a Python service for AI monitoring, incident response, appointments, and reporting. The user journey spans recovery tracking, camera/sensor analysis, temporal triage, evidence and escalation, and clinician/caregiver review; rehabilitation and telehealth are additional product capabilities. The frontend excerpts show context-backed portal data and some API calls, while README documents the broader incident pipeline. Unsampled backend and page modules are represented only where the tree or README supports their role; their internal call relationships are not inferred.

Main entry points: [`app.py`](https://github.com/yogesh-kadwe/recover-ai/blob/main/app.py) (Flask API), [`src/context/AppContext.tsx`](https://github.com/yogesh-kadwe/recover-ai/blob/main/src/context/AppContext.tsx) (Portal State), [`src/App.tsx`](https://github.com/yogesh-kadwe/recover-ai/blob/main/src/App.tsx) (Portal Application), [`src/pages/patient/PatientDashboard.tsx`](https://github.com/yogesh-kadwe/recover-ai/blob/main/src/pages/patient/PatientDashboard.tsx) (Patient Portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portals["Care Portals"]
  node_patientportal["Patient Portal"]
  node_caregiverdesk["Caregiver Desk"]
  node_doctorportal["Doctor Portal"]
  node_adminportal["Admin Center<br/>[AdminDashboard.tsx]"]
end

subgraph group_monitoring["Monitoring &amp; Recovery"]
  node_camera["Camera Monitoring"]
  node_detector["Pose &amp; Fall Detector<br/>[detector.py]"]
  node_activityrules["Temporal Activity Rules<br/>[activity_rules.py]"]
  node_videoanalysis["Video Analyzer<br/>[video_analyzer.py]"]
  node_sensorclassifier["Sensor Classifier<br/>[train_model.py]"]
  node_physio["Physiotherapy Coach<br/>[physiotherapy.py]"]
end

subgraph group_incident["Incident Response"]
  node_evidence["Incident Evidence<br/>[evidence.py]"]
  node_alerts["Alert Delivery<br/>[notifications.py]"]
  node_iot["IoT Escalation"]
end

subgraph group_clinical["Clinical Services"]
  node_reports["Medical Reports"]
  node_assistantui["Recovery Assistant UI"]
  node_assistant["Recovery &amp; Appointment Assistant<br/>[assistant.py]"]
  node_appointments["Appointment Tools"]
  node_consultation["Video Consultation"]
end

subgraph group_platform["Application Platform"]
  node_webapp["Portal Application<br/>[App.tsx]"]
  node_sharedstate["Portal State<br/>[AppContext.tsx]"]
  node_mockdata["Recovery Seed Data<br/>[mockData.ts]"]
  node_api["Flask API<br/>[app.py]"]
  node_database[("Application Database<br/>[db.py]")]
  node_security["Security Controls<br/>[security.py]"]
end

node_patient(("Patient"))
node_caregiver(("Caregiver"))
node_doctor(("Doctor"))
node_admin(("Administrator"))

node_patient -->|"uses"| node_webapp
node_caregiver -->|"uses"| node_webapp
node_doctor -->|"uses"| node_webapp
node_admin -->|"uses"| node_webapp
node_webapp -.->|"provides context"| node_sharedstate
node_sharedstate -->|"initializes from"| node_mockdata
node_patientportal -->|"reads state"| node_sharedstate
node_caregiverdesk -->|"reads state"| node_sharedstate
node_doctorportal -->|"reads state"| node_sharedstate
node_adminportal -.->|"uses state"| node_sharedstate
node_patientportal -.->|"opens monitoring"| node_camera
node_camera -.->|"requests analysis"| node_api
node_api -.->|"dispatches detection"| node_detector
node_api -.->|"dispatches analysis"| node_videoanalysis
node_detector -.->|"verifies frames"| node_activityrules
node_sensorclassifier -.->|"informs triage"| node_activityrules
node_camera -.->|"requests coaching"| node_physio
node_api -.->|"captures incidents"| node_evidence
node_evidence -.->|"supplies evidence"| node_alerts
node_api -.->|"dispatches alert"| node_iot
node_caregiverdesk -->|"acknowledges alert"| node_api
node_doctorportal -.->|"views reports"| node_reports
node_patientportal -.->|"opens assistant"| node_assistantui
node_assistantui -.->|"sends requests"| node_api
node_api -.->|"routes assistant"| node_assistant
node_assistant -->|"uses scheduling"| node_appointments
node_doctor -.->|"joins consultation"| node_consultation
node_consultation -.->|"uses signaling"| node_api
node_api -.->|"persists records"| node_database
node_api -.->|"applies controls"| node_security

click node_webapp "https://github.com/yogesh-kadwe/recover-ai/blob/main/src/App.tsx"
click node_sharedstate "https://github.com/yogesh-kadwe/recover-ai/blob/main/src/context/AppContext.tsx"
click node_mockdata "https://github.com/yogesh-kadwe/recover-ai/blob/main/src/data/mockData.ts"
click node_api "https://github.com/yogesh-kadwe/recover-ai/blob/main/app.py"
click node_database "https://github.com/yogesh-kadwe/recover-ai/blob/main/db.py"
click node_security "https://github.com/yogesh-kadwe/recover-ai/blob/main/security.py"
click node_patientportal "https://github.com/yogesh-kadwe/recover-ai/blob/main/src/pages/patient/PatientDashboard.tsx"
click node_caregiverdesk "https://github.com/yogesh-kadwe/recover-ai/blob/main/src/pages/caregiver/CaregiverDashboard.tsx"
click node_doctorportal "https://github.com/yogesh-kadwe/recover-ai/blob/main/src/pages/doctor/DoctorDashboard.tsx"
click node_adminportal "https://github.com/yogesh-kadwe/recover-ai/blob/main/src/pages/admin/AdminDashboard.tsx"
click node_camera "https://github.com/yogesh-kadwe/recover-ai/blob/main/src/pages/patient/CameraMonitoringPage.tsx"
click node_detector "https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/detector.py"
click node_activityrules "https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/activity_rules.py"
click node_videoanalysis "https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/video_analyzer.py"
click node_sensorclassifier "https://github.com/yogesh-kadwe/recover-ai/blob/main/train_model.py"
click node_physio "https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/physiotherapy.py"
click node_evidence "https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/evidence.py"
click node_alerts "https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/notifications.py"
click node_iot "https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/tinkerstream_iot.py"
click node_reports "https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/report_generator.py"
click node_assistantui "https://github.com/yogesh-kadwe/recover-ai/blob/main/src/components/ui/RecoveryAssistantModal.tsx"
click node_assistant "https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/assistant.py"
click node_appointments "https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/appointment_tools.py"
click node_consultation "https://github.com/yogesh-kadwe/recover-ai/blob/main/src/pages/consultation/DoctorConsultationPage.tsx"

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_patientportal,node_caregiverdesk,node_doctorportal,node_adminportal toneBlue
class node_camera,node_detector,node_activityrules,node_videoanalysis,node_sensorclassifier,node_physio toneAmber
class node_evidence,node_alerts,node_iot toneMint
class node_reports,node_assistantui,node_assistant,node_appointments,node_consultation toneRose
class node_webapp,node_sharedstate,node_mockdata,node_api,node_database,node_security,node_patient,node_caregiver,node_doctor,node_admin toneIndigo
```

## Components

### Care Portals

- [Patient Portal](https://github.com/yogesh-kadwe/recover-ai/blob/main/src/pages/patient/PatientDashboard.tsx): `src/pages/patient/PatientDashboard.tsx`
- [Caregiver Desk](https://github.com/yogesh-kadwe/recover-ai/blob/main/src/pages/caregiver/CaregiverDashboard.tsx): `src/pages/caregiver/CaregiverDashboard.tsx`
- [Doctor Portal](https://github.com/yogesh-kadwe/recover-ai/blob/main/src/pages/doctor/DoctorDashboard.tsx): `src/pages/doctor/DoctorDashboard.tsx`
- [Admin Center](https://github.com/yogesh-kadwe/recover-ai/blob/main/src/pages/admin/AdminDashboard.tsx): `src/pages/admin/AdminDashboard.tsx`

### Monitoring & Recovery

- [Camera Monitoring](https://github.com/yogesh-kadwe/recover-ai/blob/main/src/pages/patient/CameraMonitoringPage.tsx): `src/pages/patient/CameraMonitoringPage.tsx`
- [Pose & Fall Detector](https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/detector.py): `ai/detector.py`
- [Temporal Activity Rules](https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/activity_rules.py): `ai/activity_rules.py`
- [Video Analyzer](https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/video_analyzer.py): `ai/video_analyzer.py`
- [Sensor Classifier](https://github.com/yogesh-kadwe/recover-ai/blob/main/train_model.py): `train_model.py`
- [Physiotherapy Coach](https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/physiotherapy.py): `ai/physiotherapy.py`

### Incident Response

- [Incident Evidence](https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/evidence.py): `ai/evidence.py`
- [Alert Delivery](https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/notifications.py): `ai/notifications.py`
- [IoT Escalation](https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/tinkerstream_iot.py): `ai/tinkerstream_iot.py`

### Clinical Services

- [Medical Reports](https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/report_generator.py): `ai/report_generator.py`
- [Recovery Assistant UI](https://github.com/yogesh-kadwe/recover-ai/blob/main/src/components/ui/RecoveryAssistantModal.tsx): `src/components/ui/RecoveryAssistantModal.tsx`
- [Recovery & Appointment Assistant](https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/assistant.py): `ai/assistant.py`
- [Appointment Tools](https://github.com/yogesh-kadwe/recover-ai/blob/main/ai/appointment_tools.py): `ai/appointment_tools.py`
- [Video Consultation](https://github.com/yogesh-kadwe/recover-ai/blob/main/src/pages/consultation/DoctorConsultationPage.tsx): `src/pages/consultation/DoctorConsultationPage.tsx`

### Application Platform

- [Portal Application](https://github.com/yogesh-kadwe/recover-ai/blob/main/src/App.tsx): `src/App.tsx`
- [Portal State](https://github.com/yogesh-kadwe/recover-ai/blob/main/src/context/AppContext.tsx): `src/context/AppContext.tsx`
- [Recovery Seed Data](https://github.com/yogesh-kadwe/recover-ai/blob/main/src/data/mockData.ts): `src/data/mockData.ts`
- [Flask API](https://github.com/yogesh-kadwe/recover-ai/blob/main/app.py): `app.py`
- [Application Database](https://github.com/yogesh-kadwe/recover-ai/blob/main/db.py): `db.py`
- [Security Controls](https://github.com/yogesh-kadwe/recover-ai/blob/main/security.py): `security.py`

### Other components

- **Patient**
- **Caregiver**
- **Doctor**
- **Administrator**

## Connections

- Patient → Portal Application: uses
- Caregiver → Portal Application: uses
- Doctor → Portal Application: uses
- Administrator → Portal Application: uses
- Portal Application → Portal State: provides context
- Portal State → Recovery Seed Data: initializes from (evidence: `src/context/AppContext.tsx`)
- Patient Portal → Portal State: reads state
- Caregiver Desk → Portal State: reads state (evidence: `src/pages/caregiver/CaregiverDashboard.tsx`)
- Doctor Portal → Portal State: reads state
- Admin Center → Portal State: uses state
- Patient Portal → Camera Monitoring: opens monitoring
- Camera Monitoring → Flask API: requests analysis
- Flask API → Pose & Fall Detector: dispatches detection
- Flask API → Video Analyzer: dispatches analysis
- Pose & Fall Detector → Temporal Activity Rules: verifies frames
- Sensor Classifier → Temporal Activity Rules: informs triage
- Camera Monitoring → Physiotherapy Coach: requests coaching
- Flask API → Incident Evidence: captures incidents
- Incident Evidence → Alert Delivery: supplies evidence
- Flask API → IoT Escalation: dispatches alert
- Caregiver Desk → Flask API: acknowledges alert
- Doctor Portal → Medical Reports: views reports
- Patient Portal → Recovery Assistant UI: opens assistant
- Recovery Assistant UI → Flask API: sends requests
- Flask API → Recovery & Appointment Assistant: routes assistant
- Recovery & Appointment Assistant → Appointment Tools: uses scheduling (evidence: `ai/assistant.py`)
- Doctor → Video Consultation: joins consultation
- Video Consultation → Flask API: uses signaling
- Flask API → Application Database: persists records
- Flask API → Security Controls: applies controls
