Project Info
This project did not submit a demo video on Devpost.
Inspiration
Stroke is a leading cause of death and disability worldwide, despite its distinct early symptoms. Each year, stroke kills 7 million people, with a 60+% disability rate for survivors. If a stroke goes untreated for 60+ minutes, approximately 2 million brain cells die per minute, and the brain ages by over three years. Even if traditional screening tools like FAST are already in place, these protocols still rely on subjective human judgment, resulting in delays in seeking care when every minute counts. We saw an opportunity to leverage widely accessible technology, smartphone cameras and open clinical data, to make stroke screening objective, rapid, and accessible. Cognivi was built with a simple mission: turn a 60-second video into a reliable neurologic triage signal that empowers patients, families, and telehealth providers.
What it does
Cognivi is an AI-assisted screening tool that analyzes a short video recorded on a smartphone to identify signs of acute stroke. It specifically targets objective correlates of neurologic dysfunction, based on established FAST stroke criteria. Hand motion impairment via computer vision to detect the inability to raise both hands at the same time. Facial asymmetry quantification using computer vision to detect lip droop, eyebrow shift, or midline deviation. Speech abnormality detection using acoustic feature analysis and pretrained audio models to identify slurring or irregular prosody. A stroke risk score that combines visual and audio signals into an interpretable risk estimate. Clear, actionable output with visual overlays (e.g., asymmetry heatmaps) and speech abnormality summaries to help users understand why risk was flagged. Rather than diagnosing stroke, Cognivi provides a quantified triage indication that complements clinical workflows and encourages timely care escalation when appropriate.
How we built it
We designed StrokePager around three core principles: clinical grounding, technical rigor, and privacy by design. Robust Video Ingestion ("Sanitizer" Pipeline) Browser-recorded videos (WebM) frequently upload with corrupted headers (e.g., missing moov atom), which causes Python video libraries to crash. To ensure reliability, we implemented a raw FFmpeg ingestion layer: Every uploaded file is immediately re-encoded into a clean H.264 MP4. Codecs and container formats are normalized before any model touches the file. This prevents crashes from malformed uploads and ensures consistent downstream processing. This sanitizer layer makes the backend resilient to real-world browser variability and large (~2-minute) uploads. Computer Vision: Arm Drift & Facial Droop Tools: MediaPipe + OpenCV We perform frame-by-frame skeletal landmark tracking to quantify motor asymmetry. The system computes: Arm drift detection: Vertical displacement differences between left and right wrists during bilateral raise tasks. Facial asymmetry detection: Positional differences between eye corners, mouth corners, and midline landmarks to quantify facial droop. These measurements are transformed into structured risk percentages rather than binary flags. To improve interpretability, we render an annotated output video with skeletal overlays. Clinicians can visually confirm the exact movement that triggered the score. This mirrors objective NIHSS components rather than relying on black-box classification. Speech & Cognitive Assessment Tools: FFmpeg (audio extraction), NVIDIA NeMo (automatic speech recognition), Claude 3 (LLM-based neurologic grading), Retrieval-Augmented Generation (PubMed-grounded prompting). First, we extract audio using FFmpeg and transcribe it with NVIDIA NeMo to obtain a high-fidelity transcript. Rather than using keyword detection, we implement a structured grading pipeline: Relevant stroke literature and diagnostic criteria are retrieved from PubMed-indexed sources and other peer reviewed medical databases. These evidence snippets are injected into Claude’s prompt context. Claude is instructed to act as a neurologist and evaluate: Dysarthria (slurring) Aphasia (word-finding difficulty) Deviations from the expected phrase (“The quick brown fox…”) Cognitive coherence and prosody This is a retrieval-augmented neurologic grading system, not simple LLM classification. The output includes a structured speech impairment score, a medical summary, and evidence-grounded reasoning. By grounding the LLM with peer-reviewed criteria at inference time, we increase interpretability and reduce hallucination risk. Multimodal Risk Fusion The system generates separate scores for: Arm motor impairment Facial asymmetry Speech and language dysfunction These components are fused into a unified stroke risk estimate returned as structured JSON. This approach preserves transparency: clinicians can see which neurologic domain contributed most to risk. Privacy-First Architecture StrokePager is deployed across three separated layers: Frontend (Next.js on Vercel) Secure backend (FastAPI on Render) AI inference engine (Modal deployment) Uploads are processed transiently, and only necessary artifacts and derived scores are retained. The architecture minimizes exposure of raw biometric data while preserving clinical utility. We intentionally separated inference from core application logic to reduce risk surface and support HIPAA-conscious deployment models.
Challenges we ran into
Balancing sensitivity and specificity: Reducing false positives while capturing subtle neurologic abnormalities required iterative tuning and validation. Multi-deploy coordination: Vercel + Render + Modal requires disciplined project roots, env vars, and endpoint hygiene. Privacy vs. usability: video exams are sensitive, so we intentionally separated services and made AI inference its own deploy path. Hackathon reliability: building a smooth end-to-end experience under time pressure meant keeping interfaces stable and minimizing moving parts.
Accomplishments we're proud of
A fully functional prototype that converts a 60-second video into a clinically relevant risk estimate for stroke detection. It contains three distinct layers (web app, secure backend, AI inference backend). Clinical-inspired and accurate scoring that approximates elements of standardized neurologic screening. A deployment architecture that runs on standard consumer devices without requiring wearables or specialized hardware.
What we learned
Real-world clinical signal extraction and the challenges of translating clinician heuristics into machine-usable features. How to responsibly leverage public clinical datasets to train models that generalize to diverse populations. Building privacy-preserving pipelines where sensitive input remains local to the device.
What's next
We’re excited to expand the project in several directions: Clinical validation studies with partners to benchmark sensitivity against real stroke presentations. We are working with researchers from Stanford School of Medicine to expand this project to clinical settings. Integration with telehealth platforms to offer on-demand screening during virtual visits. Expanded language support for broader global accessibility outside of mainstream languages like English. Automated accessibility enhancements (e.g., prompts in local languages, low-bandwidth modes). Our vision is to make objective neurologic triage available to everyone with a smartphone, reducing disparities in stroke recognition and care.
StrokePager / Cognivi
A cloud-connected, privacy-first stroke triage system.
Deploy roots (important)
-
Vercel (frontend)
Use thefrontendfolder as the project root. All frontend code lives underfrontend/. -
Render (backend)
Use thebackendfolder as the project root. The FastAPI app (auth, checkups, patients) is self-contained underbackend/. -
Modal (AI backend)
The AI modeling API (full video exam, doctor dashboard) is deployed separately to Modal. Live endpoint:
https://ddavarma2609--strokepager-backend-fastapi-app.modal.run
(Defined inbackend/stroke_backend.py; deploy with Modal, not Render.)
Architecture
- Frontend (
frontend/): Next.js app. Talks to:- Render backend (
NEXT_PUBLIC_API_URL): auth, checkups, patients, dashboard. - Modal AI (
NEXT_PUBLIC_AI_API_URL):/submit_exam,/doctor_dashboard,/video/{filename}.
- Render backend (
- Backend (
backend/): FastAPI app for Render — auth, checkups, patients, DB. - Patient agent (
patient-agent/): Local/optional FastAPI for real-time inference (/infer,/red_trigger). - Cloud (
cloud/modal_api/): Modal app for events, presign, agents (separate from the main AI deploy above).
Setup
Frontend (Vercel root: frontend/)
cd frontend
cp .env.example .env
# Set NEXT_PUBLIC_API_URL to your Render backend URL
# NEXT_PUBLIC_AI_API_URL is pre-set to the Modal AI endpoint
npm install
npm run dev
Backend (Render root: backend/)
cd backend
pip install -r requirements.txt
# Configure DB and env; then:
uvicorn app.main:app --host 0.0.0.0 --port 8000
Modal AI
The main AI modeling endpoint is deployed from backend/stroke_backend.py (submit_exam, doctor_dashboard, video). Deploy with Modal CLI from the repo root or from backend/ as needed by your Modal config.
Privacy & safety
See docs/safety.md and docs/threat_model.md.
Analysis
View
Metric
- 8
- 4
- 2
- 1
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- CSSIn code
- FastAPIIn code
- HTMLIn code
- JavaScriptIn code
- Next.jsIn code
- PythonIn code
- ReactIn code
- Tailwind CSSIn code
- TypeScriptIn code
- VercelClaimed
9 of 10 appear in the indexed code. 1 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
- CursorCommits
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
437 KB
Source files
136
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
laurie-png/cognivi
203 files · 20.3 MB · @ 246452a
Structure
Interface
40 files · 20%Screens, components and styles rendered to the user.
API & routing
7 files · 3%Request entry points: routes, handlers and controllers.
Application logic
53 files · 26%Domain rules, services and shared utilities.
+10 moreData & schema
8 files · 4%Schema definitions, migrations and data access.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- JavaScript35%
- Markdown29%
- Python25%
- TypeScript9%
- CSS1%
- HTML0%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
backend/requirements.txt
pypi · 81- absl-py
- aiohappyeyeballs
- aiohttp
- aiohttp-retry
- aiosignal
- aiosqlite
- annotated-doc
- annotated-types
- anyio
- argon2-cffi
- argon2-cffi-bindings
- attrs
- audioop-lts
- audioread
- bcrypt
- certifi
- cffi
- charset-normalizer
- +63 more
web/package.json
npm · 19- next
- react
- react-dom
- socket.io
- socket.io-client
- uuid
- zod
- +12 more
frontend/package.json
npm · 11- axios
- lucide-react
- next
- react
- react-dom
- react-webcam
- +5 more
apps/web/package.json
npm · 10- axios
- lucide-react
- next
- react
- react-dom
- react-webcam
- +4 more
patient-agent/requirements.txt
pypi · 10- fastapi
- librosa
- mediapipe
- numpy
- opencv-python-headless
- protobuf
- pydantic
- python-multipart
- soundfile
- uvicorn
stroke-fast/apps/web/package.json
npm · 10- axios
- lucide-react
- next
- react
- react-dom
- react-webcam
- +4 more
stroke-fast/patient-agent/requirements.txt
pypi · 10- fastapi
- librosa
- mediapipe
- numpy
- opencv-python-headless
- protobuf
- pydantic
- python-multipart
- soundfile
- uvicorn
agents/requirements.txt
pypi · 4- pydantic
- python-dotenv
- requests
- uagents
stroke-fast/agents/requirements.txt
pypi · 4- pydantic
- python-dotenv
- requests
- uagents
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.