How sakibuzzaman99/hridpindo works
Purpose and deployment shape
HridPindo is a bilingual remote cardiac-rehabilitation platform with patient and clinician workflows. It has three deployable surfaces: a React/Vite PWA, a native Android app, and Supabase backend/Edge Functions. Patients capture logs, guided tests, phone sensor data, and optional BLE strap streams; clinicians prescribe, review, and communicate. Core persistence and authorization are database-backed.
Paths: src/main.jsx, android/app/src/main/java/com/hridpindo/app/MainActivity.kt, supabase/schema.sql.
Web application entry and role workflows
The browser entry mounts App.jsx, whose routed pages separate public/auth, doctor, and patient experiences. Role-specific layouts organize dashboards, records, prescriptions, medications, chat, and consultations. Shared components provide clinical snapshots, alert queues, charts, record inspection, exercise plans, and video-call UI.
Paths: src/main.jsx, src/App.jsx, src/pages/doctor/DoctorLayout.jsx.
Android application and native sensing
MainActivity and Compose AppRoot host the Android patient experience. Native data adapters cover Health Connect, medication reminders, device IMU/step collection, CameraX PPG heart-rate capture, and MediaPipe pose analysis using the bundled landmarker model. WorkManager/services support passive capture and background continuity.
Paths: android/app/src/main/java/com/hridpindo/app/MainActivity.kt, android/app/src/main/java/com/hridpindo/app/data/PpgCamera.kt, android/app/src/main/assets/pose_landmarker_lite.task.
Shared clinical and signal-processing core
Kotlin Multiplatform centralizes models, patient repository access, sensing semantics, clinical calculations, movement/pose/PPG processing, records parsing, and study-session logic across Android and potential iOS consumers. It is the main boundary for portable science logic versus Android hardware integration; platform-specific locks, upload behavior, and platform APIs use expect/actual-style source sets.
Paths: android/shared/src/commonMain/kotlin/com/hridpindo/app/data/Models.kt, android/shared/src/commonMain/kotlin/com/hridpindo/app/data/Clinical.kt, android/shared/src/commonMain/kotlin/com/hridpindo/app/data/PpgProcessor.kt.
BLE capture, offline archive, and synchronization
The BLE subsystem connects standard HR GATT devices and Polar H10 PMD streams for HR, RR intervals, accelerometry, and raw ECG. Capture flows parse and analyze samples, retain raw chunks/archive data locally, and run foreground/background workers to synchronize idempotently when connectivity returns. Research-device protocols and upload throttling live in shared code; Android owns Bluetooth, stores, workers, and services.
Paths: android/app/src/main/java/com/hridpindo/app/data/ble/PolarH10.kt, android/app/src/main/java/com/hridpindo/app/data/ble/HrSyncWorker.kt, android/shared/src/commonMain/kotlin/com/hridpindo/app/data/ble/PmdProtocol.kt.
Rehabilitation insights and safety boundaries
The platform derives adherence, activity/exercise proposals, HR/HRV/session statistics, recovery metrics, and risk evidence from recorded data. Functional-test and adherence formulas retain missing measurements rather than treating them as zero. Detection is advisory: exercise sessions require patient confirmation; AI summaries require clinician review. ECG is captured/archived, not interpreted, and clinical thresholds are configurable rather than hard-coded.
Paths: android/shared/src/commonMain/kotlin/com/hridpindo/app/data/cr/Adherence.kt, android/shared/src/commonMain/kotlin/com/hridpindo/app/data/ble/SegmentDetector.kt, src/lib/alerts.js.
Backend, authorization, and external services
Supabase PostgreSQL is the system of record, with schema-defined Row-Level Security as the authorization boundary; Auth, Storage, and realtime backend capabilities are consumed by clients. Deno Edge Functions isolate privileged integrations: Gemini for chat, summaries, and OCR; Agora token issuance for video; plus push, speech-to-text, and text-to-speech services. Browser clients use only the anon key; server-side secrets remain in Supabase/function environments.
Paths: supabase/schema.sql, src/lib/supabase.js, supabase/functions/gemini-chat/index.ts.
Data flow
Authenticated patient/clinician clients read and mutate Supabase records under RLS. Android can first collect sensor/test data locally, process it through the shared science core, archive raw streams, then upload through workers. Web and Android render persisted measurements and derived results for patient confirmation or clinician action. Gemini and Agora calls cross only through Edge Functions/token boundaries rather than exposing provider credentials to clients.
Paths: android/app/src/main/java/com/hridpindo/app/data/ble/RawUploadWorker.kt, src/components/DoctorDataExplorer.jsx, supabase/functions/agora-token/index.ts.
Main entry points: App.jsx Role workflows · schema.sql Supabase system of record · PpgCamera.kt Native sensing · PolarH10.kt BLE capture
Components 17
Web PWA
- React PWA entry · Mounts the browser application.
src/main.jsx - Role workflows · Public, patient, and clinician experiences.
src/App.jsx - Clinician workspace · Records, prescriptions, alerts, chat, and consultations.
src/pages/doctor/DoctorLayout.jsx - Web Supabase client · Accesses backend capabilities without service secrets.
src/lib/supabase.js
Android app
- Android patient app · Hosts the native patient experience.
android/app/src/main/java/com/hridpindo/app/MainActivity.kt - Native sensing · Health Connect, IMU, CameraX PPG, pose, reminders, and background services.
android/app/src/main/java/com/hridpindo/app/data/PpgCamera.kt - Pose landmarker model
android/app/src/main/assets/pose_landmarker_lite.task - BLE capture · Connects HR GATT and Polar H10 PMD streams.
android/app/src/main/java/com/hridpindo/app/data/ble/PolarH10.kt - Offline archive & sync · Archives raw data and performs idempotent uploads.
android/app/src/main/java/com/hridpindo/app/data/ble/HrSyncWorker.kt
Shared clinical core
- Clinical models & repository · Portable patient data and sensing semantics.
android/shared/src/commonMain/kotlin/com/hridpindo/app/data/Models.kt - Signal & clinical processing · Clinical calculations, PPG, movement, pose, and study sessions.
android/shared/src/commonMain/kotlin/com/hridpindo/app/data/PpgProcessor.kt - Research BLE protocol · Shared Polar PMD parsing and upload semantics.
android/shared/src/commonMain/kotlin/com/hridpindo/app/data/ble/PmdProtocol.kt - Advisory rehab insights · Derives adherence and recovery evidence; confirmation and review remain required.
android/shared/src/commonMain/kotlin/com/hridpindo/app/data/cr/Adherence.kt
Supabase backend
- Supabase system of record · Database-backed persistence and authorization boundary.
supabase/schema.sql - Gemini integration · Privileged chat, summaries, and OCR boundary.
supabase/functions/gemini-chat/index.ts - Agora token boundary · Issues video tokens without exposing provider credentials.
supabase/functions/agora-token/index.ts
External services
- AI, video & communications · Gemini, Agora, push, speech-to-text, and text-to-speech services.
Connections 20
- React PWA entry → Role workflows: mounts
- Role workflows → Clinician workspace: renders clinician routes
- Role workflows → Web Supabase client: uses
- Web Supabase client → Supabase system of record: authenticated reads/writes · RLS enforces record access.
- Role workflows → Gemini integration: requests AI features
- Role workflows → Agora token boundary: requests video token
- Android patient app → Native sensing: hosts
- Native sensing → Pose landmarker model: uses
- Native sensing → Signal & clinical processing: feeds measurements
- Android patient app → BLE capture: starts capture
- BLE capture → Research BLE protocol: parses PMD streams
- BLE capture → Offline archive & sync: archives raw chunks
- Offline archive & sync → Supabase system of record: syncs when online
- Signal & clinical processing → Clinical models & repository: uses records
- Clinical models & repository → Supabase system of record: patient repository access
- Signal & clinical processing → Advisory rehab insights: derives metrics
- Advisory rehab insights → Supabase system of record: persists derived results
- Supabase system of record → Clinician workspace: clinical records and alerts
- Gemini integration → AI, video & communications: server-side AI calls
- Agora token boundary → AI, video & communications: server-side token calls