AWS Builder Center

NeuroTrial: The First Quantified Nystagmus Study & A Breakthrough Step Toward Global Decentralized Clinical Trials

NeuroTrial is a decentralized clinical trial platform on AWS Serverless that synchronizes in-browser computer vision with ECG heart rate tracking, capturing the first quantified proof linking nystagmus head oscillations with acute stress and at the same time being the first step towards decentralized clinical trials




Why I Built It

My name is Manan, and I live with Infantile Nystagmus—a neurological condition that causes my eyes to oscillate involuntarily, and during stressful moments, my head starts nodding too.
For years, neurologists suspected that these head oscillations were triggered by stress, but no scientific research or clinical study had ever objectively proven this link.
Traditional clinical research faced critical roadblocks which NeuroTrial solves:
  • Siloed Research & Lack of Collaboration: Rare neurological movement and patient data is currently trapped in isolated hospitals with no unified way to pool patient cohorts across borders. NeuroTrial provides a single, shared global platform where research centers and neurologists worldwide can collaborate, pool standardized data, and run multi-center decentralized trials.
  • Missing Tool: Doctors lacked a tool to objectively link physical movement flares to physiological stress surges in disorders like Nystagmus and Parkinson's.
  • White Coat Syndrome: The hospital environment itself induces artificial anxiety which distorts natural resting baselines. NeuroTrial can be used at home or any place where the patient is comfortable.
  • High Patient Travel Burden & Trial Dropout Rates: NeuroTrial allows patients to participate directly from their living room using just a browser and a sensor at a fraction of traditional trial costs.
I built NeuroTrial to solve this and tested the entire pipeline on myself. By synchronizing real-time in-browser computer vision with beat-to-beat ECG heart rate variability (HRV) telemetry, we captured the world’s first quantified proof that involuntary head oscillations in nystagmus are directly triggered by acute autonomic stress (a sharp drop in parasympathetic RMSSD vagal tone).
To turn this personal discovery into a worldwide medical platform, we built NeuroTrial as a decentralized clinical trial (DCT) system where patients can participate from home, while research hospitals globally can pool and cross-analyze multi-center trial data in real time.




What Problem Does NeuroTrial Solve?

  • Eliminates Hospital Anxiety: Patients participate from their living rooms, capturing true real-world daily telemetry rather than artificial hospital snapshot data.
  • Zero-Trust Privacy-by-Design: Raw video stays in local device RAM. Only when an oscillation flare occurs is a short 10-second encrypted clip saved to the cloud.
  • Breaks Down Siloed Research: Enables multiple hospitals and research units worldwide to collaborate on a single unified platform, pooling standardized patient cohorts across borders.
  • Dramatically Lowers Trial Costs: Brings clinical trial monitoring costs down to under $0.05 per patient session on AWS Serverless.



End-to-End System Architecture

NeuroTrial unites client-side edge computer vision, Web Bluetooth ECG hardware, and a 100% serverless AWS backend in ap-south-1 (Mumbai).


The Core Pipeline:

  1. Edge Computer Vision: MediaPipe Face Mesh tracks facial landmarks in-browser at 30–60 FPS with zero continuous video sent to the cloud.
  1. ECG Telemetry Engine: Web Bluetooth streams beat-to-beat R-R intervals from a Polar H9 chest strap to compute rolling Root Mean Square of Successive Differences (RMSSD).
  1. 10s Incident Ring Buffer: Retains 150 pre-trigger frames in local RAM. When an oscillation anomaly (2.5 to 6.0 Hz) occurs, it captures 150 post-trigger frames, stitches a 10-second WebM clip (in under 80ms), and uploads it to an encrypted Amazon S3 vault.
  1. AWS Serverless Microservices: API Gateway routes telemetry to AWS Lambda, persisting time-series records in Amazon DynamoDB.
  1. Clinician Triage Workstation: Neurologists review 10s validation clips with 1-click triage, dynamically updating multi-session longitudinal graphs.
  1. Amazon Bedrock AI Copilot: Anthropic Claude 3.5 Sonnet analyzes multi-session telemetry to generate EMR-ready SOAP progress notes for doctors.



In-Browser Patient Studio (Edge Processing)

The Patient Studio ( patient.html ) runs directly inside any web browser with zero installation required.



A. Real-Time Facial Kinematics & Background Tracking

  • Landmark #1 (Nose Tip): Serves as a rigid kinematic anchor to track involuntary head nodding without interference from blinks.
  • Exponential Moving Average (EMA = 0.4): Low-pass filtering eliminates webcam sensor noise with zero phase lag:  S(t) = 0.4 * X(t) + 0.6 * S(t-1) 
  • Background Tracking During Daily Tasks: The platform continues running in the background as the patient goes about normal daily work, studying, or browsing, passively capturing real-world stress spikes.

B. Standardized Cognitive Stress Protocol (Stroop Test)


Includes an interactive Color-Word Stroop conflict challenge (e.g., the word "BLUE" printed in red font) with 1.5-second rapid decision windows to evaluate vagal withdrawal under controlled cognitive load.

C. 10-Second Volatile RAM Buffer & In-Browser WebM Stitcher


  • Pre-Trigger Buffer: Keeps 150 frames (5.0 seconds at 30 FPS) in volatile JavaScript RAM.
  • In-Browser WebM Multiplexer ( webm_encoder.js ): A custom, zero-dependency 8KB EBML/VP8 multiplexer that packages all 300 frames (10.0 seconds) into a seekable WebM blob in under 80 milliseconds (replacing heavy 25MB WebAssembly encoders).
  • 6-Second Cooldown: Locks out duplicate triggers for 180 frames after clip generation.

D. Autonomic Stress Drop Mathematics

Connecting via Web Bluetooth GATT (Service 0x180D / Characteristic 0x2A37), the system parses beat-to-beat R-R intervals to calculate RMSSD (Root Mean Square of Successive Differences).
During an oscillation flare, it computes the Autonomic Stress Drop Percentage:  Stress Drop % = ((Baseline RMSSD - Incident RMSSD) / Baseline RMSSD) * 100 
A drop of 25% or higher confirms a stress-triggered neurological exacerbation rather than an incidental head turn.



Clinician Review Workstation

The Clinician Workstation ( clinician.html ) provides doctors with an optimized, low-latency review interface built on a strict equal-height 3-column workstation layout.
I tried to upload an image of the clinician portal, but it is being flagged as inappropriate, please check out the portal at  https://main.dfms9o6dmkyla.amplifyapp.com/clinician.html 

Key Capabilities:

  • Multi-Patient Cohort Switcher: Seamlessly switch between clinical trial subjects (patient_001, patient_002, patient_003) with dynamic KPI cards.
  • Multi-Session Longitudinal Tracking: Compare distinct sessions over time for each patient (Session 1: Stroop Test, Session 2: Cognitive Fatigue, Session 3: Visual Strain).
  • 1-Click Triage & Dynamic Graphing: Review 10-second video clips with slow-motion HUD overlays (0.5x / 1.0x) and click  ✓ Verify TP  or  ✕ Dismiss FP , instantly updating DynamoDB and plotting verified points to trend graphs.
  • Amazon Bedrock AI Progress Notes: Uses Anthropic Claude 3.5 Sonnet to automatically synthesize longitudinal telemetry into EMR-ready SOAP progress notes with targeted clinical recommendations.




Empirical Findings: The First Quantified Proof

During standardized testing on myself across cognitive stress challenges, NeuroTrial captured conclusive empirical proof that head oscillations in nystagmus are directly triggered by acute autonomic stress.




AWS Proof of Usage (Technical Role of Each Service)

NeuroTrial runs on a 100% serverless AWS architecture deployed in  ap-south-1  (Mumbai):
AWS Service
Technical Role in NeuroTrial
Key Metrics & Specs
AWS Amplify
Global HTTPS hosting & CI/CD
Automated Git edge delivery
Amazon API Gateway
HTTP REST API entry point
Sub-40ms latency, CORS
AWS Lambda
Serverless microservice compute
Python 3.11 runtimes
Amazon DynamoDB
Single-table NoSQL telemetry
On-Demand, Sub-10ms queries
Amazon S3
Encrypted 10s video vault
SSE-S3 AES-256, Presigned
Amazon Bedrock
AI Clinical SOAP Progress Notes
Anthropic Claude 3.5 Sonnet
  • AWS Amplify: Continuously builds and deploys the frontend on every git push, provisioning valid HTTPS certificates required for Web Bluetooth and camera APIs.
  • Amazon API Gateway & AWS Lambda: Provides sub-40ms REST endpoints (/events, /verify, /bedrock-summary) using Python 3.11 microservices (NeuroStressIngest, NeuroStressQuery, NeuroStressBedrockSummary).
  • Amazon DynamoDB (NeuroStressTelemetry): Single-table NoSQL database (patient_id PK, timestamp SK) delivering sub-10ms time-series queries.
  • Amazon S3 (neurostress-telemetry-vault): Direct in-browser encrypted video uploads via short-lived Pre-Signed URLs (300s expiry) with zero public bucket access.
  • Amazon Bedrock (Claude 3.5 Sonnet): Generates hospital-grade SOAP clinical notes directly from quantitative multi-session telemetry.
  • Infrastructure-as-Code (Boto3 IaC): A 1-click Python script (deploy_infra.py) provisions all tables, buckets, IAM roles, Lambdas, and APIs in under 2 minutes.



Mandatory Disclosures & Open-Source Attributions

A. Disclosure of AI Tools Used

  • Google Antigravity IDE: Used as an agentic AI coding assistant for architecture planning, script automation, and debugging.
  • Amazon Bedrock (Anthropic Claude 3.5 Sonnet): Deployed in the AWS cloud backend to generate clinical progress notes from telemetry.

B. Third-Party & Open-Source Attribution

  • MediaPipe Face Mesh (Google) — Apache License 2.0
  • OpenCV (opencv-python) — Apache License 2.0
  • Chart.js — MIT License
  • Bleak (Bluetooth Low Energy Python) — MIT License
  • Boto3 & Botocore (AWS SDK) — Apache License 2.0
  • WebM VP8 Encoder Helper — MIT License



Future Extensibility & Global Vision

  1. At-Home Clinical Drug Trials: Pharmaceutical companies can remotely evaluate whether new Nystagmus medications reduce the frequency, amplitude, and stress-triggered severity of oscillations in daily life.
  1. Scaling to Other Movement Disorders: Readily expands to evaluate Parkinson’s resting tremors, Essential Tremor, Multiple Sclerosis, and Ataxia worldwide.
  1. Global Multi-Hospital Trial Consortia: Enables medical centers globally to collaborate on a single unified platform, pooling standardized patient cohorts across borders.



Conclusion

NeuroTrial began with a deeply personal question: Why does my head nod under stress?
By uniting in-browser edge computer vision, Web Bluetooth ECG telemetry, and AWS Serverless & Generative AI, we captured the first-ever quantified proof linking nystagmus head oscillations with autonomic stress surges
NeuroTrial proves that global decentralized clinical trials can be private, accessible, and mathematically rigorous, empowering patients and neurologists worldwide to participate in groundbreaking research directly from home.
Built with passion and deployed on Amazon Web Services for the Bharat Builds AWS Hackathon.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article