Judges please test and have a look at the code! (we were running out of time to record and couldn't show off all the features):

https://github.com/Mikop22/diagnostic

Use our doctor facing app to create a new patient and send yourself an email:

You can test the full pipeline from there: https://diagnostic-two.vercel.app

Δ_fla

Δ_flag form

The Cost of Invisibility

The modern medical system has a critical blind spot, and the data proves it.

Hispanic and Black women are 50% less likely to diagnosed with endometriosis despite identical symptom presentations. Black women are 3x more likely to die from pregnancy-related causes. Even when you control for socio-economic status Black women face a 40% higher mortality rate from breast cancer and are significantly more likely to be diagnosed at late-stages (Triple-Negative).

When severe pain is dismissed as "normal" or misattributed to other conditions, patients are trapped in a cycle of medical gaslighting while their illness progresses.

Engineering Advocacy

Diagnostic is a full-stack Electronic Health Record (EHR) overlay. We turn "invisible" symptoms into visible, undeniable clinical evidence through a high-velocity, multi-modal physician dashboard.

It acts as an objective translator in the exam room, merging natural language processing (NLP) with multi-modal physiological data from Apple Watch to produce a more accurate clinical brief for physicians.

Furthermore, we solve the root cause of medical AI bias—a lack of diverse training data—by transforming the platform into a Decentralized Science (DeSci) network, compensating patients directly for their data via the Ripple XRP Ledger (XRPL).

🛠️ How we built it: The Technical Architecture

Diagnostic is built on a high-performance stack: Next.js 15 (React), Python (FastAPI), MongoDB Atlas, LangChain, and the xrpl-py SDK. Here is how our technical pipeline forces objectivity back into the exam room:

1. Objective Biometric Overlays (Anomaly Detection)

We don't just show doctors raw numbers. Our Python backend ingests Apple Health data and computes the exact delta between a patient's acute 7-day state and their 26-week historical baseline.

To objectively quantify physiological distress (such as pain-induced autonomic responses), our backend calculates a normalized deviation score. We isolate the acute rolling average against the longitudinal baseline, triggering a clinical significance flag if the variance exceeds the defined threshold \( \tau \):

Δ_flag formula

Where x-bar represents the 7-day metric mean (e.g., HRV), mu and sigma represent the 26-week mean and standard deviation. This transforms symptoms into a mathematically undeniable biological signal. Perfect for training models and making unbiased diagnosis

2. The RAG Clinical Brief

We use state-of-the-art LLMs wrapped in a LangChain orchestrator to distill complex, emotional patient histories into concise, structured JSON summaries. Enforced via Pydantic strict=True, this extraction highlights key symptom velocities and functional impacts that typically get lost in 15-minute appointments.

3. Diagnostic Nudges (Vector & Hybrid Search)

We eliminate human diagnostic bias by grounding our platform in peer-reviewed science. We encode the patient's clinical narrative and biometric summary into a 768-dimensional dense vector space using the ModernPubMedBERT transformer. We then calculate the Cosine Similarity between the patient's query vector \(\mathbf{q}\) and the document embeddings in our MongoDB Atlas cluster \(\mathbf{d}\):

embeddings

To eliminate retrieval hallucinations, we fuse this dense vector retrieval (semantic intent) with sparse BM25 retrieval (exact keyword matching) using MongoDB's Reciprocal Rank Fusion (RRF) algorithm:

RRF Score Formula

The top documents are injected directly into the LLM context window to ground the clinical brief in undeniable, peer-reviewed science.

4. DeSci & Patient Data Sovereignty (XRPL Integration)

To incentivize marginalized patients to contribute to medical research, we built a zero-friction XRPL integration. When a doctor generates a patient intake link, our backend instantly generates a secure XRPL Testnet wallet. When the patient submits their anonymized biometric and narrative data, the FastAPI orchestrator asynchronously fires a micro-transaction, sending 10 XRP directly to their wallet to compensate them for contributing to inclusive medical research.

🚧 Challenges we ran into

Demo Orchestration: We wanted judges to be able to test the platform live on their own phones without breaking the Next.js dashboard. Orchestrating a single POST route that simultaneously handles database validation, waits for an LLM response, generates PubMed vector embeddings, and fires an asynchronous blockchain transaction (without timing out the frontend) required us to deeply decouple our architecture and master FastAPI's BackgroundTasks.

Bypassing Government CORS Restrictions: We wanted doctors to read the full NIH medical papers directly inside our app, but PubMed uses strict X-Frame-Options: DENY headers. We built a custom backend reverse-proxy route in Python that fetches the binary PDF bytes directly from the Europe PMC API and streams them back to our Next.js <iframe>, flawlessly bypassing the browser security blocks.

🏆 Accomplishments that we're proud of

  • The XRPL Handoff: Successfully integrating a decentralized ledger into a highly regulated healthcare workflow without introducing any friction to the patient onboarding process.
  • The Math-to-UI Pipeline: Taking raw arrays of Apple Health JSON data and turning them into incredibly sleek, F-pattern "Liquid Glass" UI components that doctors can understand in under 5 seconds.
  • Building a product with deep, systemic empathy that attacks one of the most pervasive flaws in modern medicine.

Machine Learning 101: To decrease the variance of a model you must expand the dataset. Diagnostic doesn't exist to undermine the expertise of doctors but to empower medical professions with the time-series data to make decisions that better fit their patients.

🚀 What's next for Diagnostic

We plan to expand our hardware integrations beyond Apple Health (e.g., Oura, Whoop, Garmin) to ensure accessibility for patients across all socioeconomic brackets. Long-term, we aim to partner with clinical research organizations (CROs) to utilize our XRPL data pipeline to fund DeSci trials specifically targeting disease in minority populations.

Built With

Share this project:

Updates