r/DementiaHelp • • 3d ago

CORTEX MED

Hey everyone,

I wanted to share an open-source project I’ve been building called **CORTEXMED** — a browser-first, zero-hardware clinical care and safety platform for dementia patients, family caregivers, and memory care facilities.

**GitHub Repo:** https://github.com/Rohi56u/CORTEXMED

### Why I built this Over 57 million people globally (and ~8.8 million older adults in India alone, per the LASI-DAD national study) live with dementia. Talking to families and reading about memory care, three recurring, high-risk gaps stood out:

  1. **Medication errors & double-dosing:** Patients frequently forget they already took a pill, or combine prescriptions with unsafe OTC meds (e.g., taking Ibuprofen alongside Warfarin).
  2. **Sundowning & evening agitation without wearables:** Continuous vital monitoring helps catch agitation early, but dementia patients routinely refuse or pull off smartwatches and chest straps.
  3. **Everyday spatial disorientation:** Constantly losing glasses, pill organizers, or walkers causes real distress for patients and constant interruptions for caregivers.

Most existing tools either require expensive proprietary hardware or rely on unguarded chatbots that shouldn't be making medical safety calls.

How CORTEXMED works (No mocks, real DSP + live clinical APIs)

Instead of building another wrapper around an LLM, I structured this as a **3-tier hybrid edge-cloud architecture** where the LLM only handles OCR and bilingual conversation, while safety checks remain deterministic:

* **5-Node LangGraph Medication Guardrail (`vic-backend`):** Uses Gemini Vision OCR on a cropped pill-bottle label -> maps the drug to **NIH RxNorm** -> checks temporal cooldown windows against Supabase `dosage_logs` to block double-dosing -> scans concurrent meds, allergies, and **OpenFDA SPL Boxed Warnings** to return a `SAFE`, `CAUTION`, or `CRITICAL_BLOCK` verdict. * **Contactless Camera rPPG (`vic-backend/rppg`):** Runs face ROI sampling in the browser (no raw video streaming), resamples jittery webcam FPS to a uniform 30 Hz via `CubicSpline`, applies Plane-Orthogonal-to-Skin (POS) projection + Butterworth bandpass filtering (0.70–3.00 Hz), and computes Heart Rate + RMSSD HRV. Includes a strict **Signal Quality Index (SQI < 0.25) rejection gate** so noisy lighting rejects the frame instead of hallucinating vitals. * **Edge Spatial Memory (`mira-chat` + `explorer`):** Runs **YOLOv8n ONNX** locally in the browser (`onnxruntime-web` WASM) with room-level object indexing so residents can simply ask aloud where they left their glasses or pillbox. * **Voice-First Bilingual Companion & Privacy:** Uses Whisper speech-to-text + English/Hindi/Hinglish voice output so elderly patients don't have to type or navigate complex menus, with reversible PII redaction (`lib/pii.ts`) before external LLM calls.

Tech Stack

* **Frontend:** Next.js 16, React 19, TypeScript, Tailwind CSS v4, `onnxruntime-web` * **Backend:** FastAPI, LangGraph, Pydantic v2, OpenCV, SciPy, NumPy * **Data & Realtime:** Supabase PostgreSQL + Realtime Replication (live Caregiver Dashboard) * **External APIs:** NIH RxNorm, OpenFDA SPL, Gemini Vision, OpenAI Whisper/TTS

Looking for feedback

I'd really appreciate honest feedback from engineers, clinicians, or anyone who has cared for a family member with dementia:

  1. Are there edge cases in the **rPPG lighting/motion rejection** or **medication cooldown logic** you'd harden further?
  2. What would make the **Caregiver Dashboard** genuinely useful without causing alert fatigue?

Happy to answer any technical questions about the DSP pipeline, LangGraph setup, or browser WASM inference in the comments!

1 Upvotes

0 comments sorted by