CareMate
An AI-powered clinical decision support system that automates medical coding, symptom analysis, and differential diagnosis — built on DBRX, LlamaIndex, and a RAG pipeline backed by MongoDB.

The Problem
Healthcare professionals spend a disproportionate amount of time on administrative and diagnostic overhead. Manually searching for the correct ICD-11, CPT, or HCPCS codes from clinical reports is tedious and error-prone. Symptom triage relies heavily on individual clinician experience, and differential diagnosis — the process of narrowing down possible conditions from a set of symptoms — requires cross-referencing vast medical knowledge under time pressure. CareMate automates all three workflows through a single AI-powered platform.
Medical Code Suggestion
The first module eliminates manual code lookup entirely. Clinicians input a clinical report or diagnosis description, and the system analyzes the text to suggest the most relevant standardized codes across three coding systems: ICD-11 (International Classification of Diseases) for diagnosis classification, CPT (Current Procedural Terminology) for procedure billing, and HCPCS (Healthcare Common Procedure Coding System) for services and equipment. The system returns precise code suggestions in seconds, reducing coding errors and accelerating the billing workflow.
Symptom Analysis
The symptom analysis module empowers both patients and clinicians to make informed decisions. Users describe their symptoms in natural language, and CareMate leverages its medical knowledge base to suggest potential conditions, recommend next steps, and flag urgency indicators. The system is designed as a decision-support tool — augmenting clinical judgment rather than replacing it — helping clinicians prioritize investigations and patients understand when to seek immediate care.
Differential Diagnosis
The differential diagnosis engine is the most technically complex module. It accepts structured patient input — age, medical history, symptom details with timeline, and additional context like family history and lifestyle factors. The system compares this data against a comprehensive medical database, producing a prioritized list of candidate conditions ranked by likelihood. Each suggestion is cross-referenced for accuracy, enabling clinicians to systematically rule out conditions and converge on the correct diagnosis faster.


Differential diagnosis — structured patient input with medical history, symptoms, and timeline
RAG Pipeline Architecture
CareMate runs two specialized RAG (Retrieval-Augmented Generation) pipelines, each optimized for its domain. The symptom evaluation pipeline ingests medical disease and diagnosis documents through semantic chunking, embeds them using OpenAI's text-embedding-3-small model, and stores the vectors in a MongoDB-backed vector database. At query time, the patient's input is transformed using HyDE (Hypothetical Document Embedding) — the system first generates a hypothetical ideal document that would answer the query, then embeds that document to retrieve more semantically relevant evidence than a raw query embedding would produce.
The medical codes pipeline follows a similar architecture but uses sentence-level splitting instead of semantic chunking, optimized for the structured, codified nature of ICD-11, CPT, and HCPCS documentation. Both pipelines pass retrieved evidence through a DBRX Reranker with Long Context Reorder — re-scoring and reordering retrieved chunks by relevance before concatenating them with the original query for final generation by DBRX via Together.ai.


RAG architecture — evidence-based symptom evaluation pipeline with HyDE, vector retrieval, and DBRX reranking
Pipeline Optimization with TruLens
Rather than guessing which RAG configuration works best, we systematically optimized the pipeline using TruLens — an evaluation framework that scores every response across three metrics: Answer Relevance (does the output address the query?), Context Relevance (are the retrieved documents actually useful?), and Groundedness (is the response factually supported by the retrieved context?). These metrics enabled data-driven hyperparameter tuning across the entire retrieval stack.
The optimization sweep tested multiple configurations across three pipeline components. For query transformation: HyDE, Step Decompose, Retry Query, FLARE Instruct, and no transformation. For reranking: Colbert Rerank, RankGPT Rerank, Cohere Rerank, ms-marco-MiniLM, and mMiniLM. For prompt compression: LongLLMLingua versus no compression. Each combination was evaluated against the TruLens metrics to identify the optimal pipeline configuration for clinical accuracy.


TruLens hyperparameter tuning — sweep across query transforms, rerankers, and prompt compression
Frontend & Deployment
The frontend is built with Streamlit, providing a lightweight web interface that clinicians can access from any device — whether in a hospital ward or a remote clinic. The application is designed for immediate usability with no installation required, prioritizing speed and accessibility over visual complexity.
The optimized RAG pipeline achieved high groundedness scores across TruLens evaluations, confirming that responses were consistently anchored in retrieved medical literature rather than hallucinated. The project also served as the foundation for the team's 2nd Runner Up finish at the MEDCHIC Health Data Hackathon 2024, where the same retrieval and classification techniques were applied to kidney disease diagnosis from the MIMIC-IV clinical dataset.
Technical Highlights
- -Automated medical code suggestion across ICD-11, CPT, and HCPCS coding systems
- -Differential diagnosis engine with prioritized candidate conditions from structured patient input
- -Two specialized RAG pipelines — semantic chunking for symptoms, sentence splitting for medical codes
- -HyDE (Hypothetical Document Embedding) for improved query-to-document semantic matching
- -DBRX Reranker with Long Context Reorder for post-retrieval relevance optimization
- -TruLens pipeline evaluation — Answer Relevance, Context Relevance, and Groundedness scoring
- -Hyperparameter sweep across query transforms (HyDE, FLARE Instruct), rerankers (Colbert, RankGPT, Cohere), and prompt compression (LongLLMLingua)
- -text-embedding-3-small for vector embeddings stored in MongoDB
- -DBRX via Together.ai for low-latency clinical inference