Production Notes
Diagnostic
“Behind the Scenes”
2026
Synopsis
Diagnostic is a full-stack medtech app I built to combat racial bias in healthcare. It proves physiological distress by calculating the difference between acute biometric data and long-term baselines, then cross-references symptoms with medical literature using a RAG pipeline.
The Problem
Studies show that racial bias in healthcare leads to real harm: minority patients are more likely to have their pain dismissed or their symptoms downplayed. There was no tool that let patients walk into an appointment with objective, data-backed proof of what their body is going through. I wanted to change that.
Starring
Production Challenges
Accurate Biometric Baselines
Getting meaningful deltas between 7-day acute data and 26-week baselines took a lot of careful statistical modelling. We needed to avoid false positives while still being sensitive enough to catch real distress signals.
RAG Pipeline Reliability
Getting the RAG pipeline to produce clinically accurate abstracts was tricky. We spent a lot of time fine-tuning retrieval parameters and making sure responses were grounded in verified medical literature.
Blockchain Compensation
Plugging in the XRPL blockchain for automatic patient compensation meant dealing with async transactions and making sure all data was anonymized before anything touched the chain.
Production Design
The system is a decoupled monorepo with a Next.js 15 App Router frontend (TypeScript, Tailwind CSS, Recharts) and an async FastAPI backend deployed on Railway. We chose a decoupled architecture over a monolithic Next.js API because the ML and biometric processing is CPU-heavy, and separating it lets us scale the backend independently without blocking the frontend. Patient biometric data from Apple Watch (HRV, resting heart rate, wrist temperature, respiratory rate, walking asymmetry, step count, and sleep disruptions) gets ingested via an iOS Shortcut webhook. We went with iOS Shortcuts over a native app because it gave us zero-friction data capture without the overhead of building and maintaining a dedicated mobile client. The backend computes clinically significant deltas between 7-day acute readings and 26-week longitudinal baselines using per-metric thresholds, then encodes the patient narrative and biometric summary into a 768-dimensional embedding via PubMedBERT (lokeshch19/ModernPubMedBERT). We picked PubMedBERT over general-purpose embedding models because clinical terminology needs domain-specific semantic understanding, and generic models consistently missed nuances in medical symptom descriptions. That vector feeds a MongoDB Atlas hybrid search pipeline combining $vectorSearch (cosine similarity) with BM25 keyword $search, merged via Reciprocal Rank Fusion. We tested pure vector search first, but found it missed exact clinical terms that keyword matching catches, so the hybrid approach with RRF gave us the best of both worlds. The top condition matches get formatted as retrieval context and passed to GPT through LangChain with Pydantic structured output (strict=True, temperature 0.1) to produce a typed ClinicalBrief with symptoms, severity, recommended actions, cited sources, and guiding questions. We locked the temperature at 0.1 because clinical outputs need to be deterministic and grounded; higher temperatures introduced hallucinated citations that would be dangerous in a healthcare context. The physician dashboard uses an F-pattern layout with ghost charts (Recharts ComposedChart overlaying acute data on dashed baseline reference lines), delta badges, risk profile severity bars, and expandable PubMed paper accordions proxied through the backend to bypass CORS. A standalone Flask XRPL Oracle handles blockchain transactions (DID registration, MPToken issuance, and escrow finalization on the XRP Ledger Testnet), automatically compensating patients for anonymized data contributions. We chose XRPL over Ethereum because transaction fees are near-zero and settlement is under 4 seconds, which matters when compensating patients in real time rather than batching payouts.