Skip to content

Healthcare

DiReCT RAG for Clinical Diagnostic Reasoning

DiReCT is a Retrieval-Augmented Generation (RAG) system designed to retrieve relevant clinical notes from the MIMIC-IV-Ext Direct dataset and generate context-aware responses using an open-source large language model. It combines BM25 keyword search, SentenceTransformers embeddings, FAISS vector similarity search, and a Streamlit interface to support clinical information retrieval and evidence-grounded diagnostic reasoning research.

DiReCT RAG for Clinical Diagnostic Reasoning

The challenge

Clinical documentation contains large volumes of unstructured text, making it difficult to retrieve relevant information efficiently and use it as context for language-model-generated responses. General-purpose language models may produce unsupported statements when answering clinical questions without access to relevant evidence. The challenge was to develop a retrieval pipeline that could identify useful clinical notes and provide supporting context for generated answers.

Context

DiReCT was developed as a healthcare-focused Generative AI and information-retrieval project using the MIMIC-IV-Ext Direct dataset. The system combines traditional keyword-based retrieval with semantic search to identify relevant clinical documentation. A Retrieval-Augmented Generation architecture then supplies retrieved passages to an open-source large language model to produce context-aware responses. The project also incorporates evaluation methods and privacy-conscious data-handling practices.

The solution

Developed a modular RAG pipeline combining BM25 keyword retrieval with dense semantic retrieval using SentenceTransformers and FAISS. Retrieved clinical passages are incorporated into a structured prompt that provides context for an open-source language model to generate responses. A Streamlit frontend allows users to submit questions, inspect retrieved documents, and review generated answers. The system also supports retrieval evaluation using Precision@K and Recall@K.

Design

The system follows a retrieval-first design in which user questions are processed by complementary keyword and semantic search components. Relevant passages are collected and supplied to the generation model as contextual evidence. The Streamlit interface separates user input, retrieved clinical information, and generated responses to improve transparency and usability. Privacy-conscious design principles keep raw clinical data outside the public repository.

Architecture

The system consists of the following logical components:

  1. User Interface: Streamlit-based interface for submitting queries and reviewing results.
  2. Query Processing: Prepares user questions for retrieval.
  3. Keyword Retrieval: BM25-based search for lexical matching.
  4. Semantic Retrieval: SentenceTransformers embeddings with FAISS similarity search.
  5. Context Assembly: Selects and prepares retrieved passages for the generation stage.
  6. Answer Generation: An open-source large language model generates context-aware responses.
  7. Evaluation: Precision@K and Recall@K measure retrieval performance.
  8. Data Management: Local storage for authorized clinical data, with privacy-conscious handling.

Development

The project was implemented in Python using a modular retrieval and generation workflow. SentenceTransformers supports dense text embeddings, FAISS enables efficient similarity search, and BM25 provides keyword-based retrieval. The retrieved passages are integrated into prompts for an open-source LLM. Streamlit provides the interactive frontend, while evaluation utilities support retrieval-quality analysis. The development workflow includes environment setup, dependency installation, local data storage, and documentation for responsible dataset use.

Results

DiReCT brings together keyword retrieval, semantic search, and language-model-based answer generation in a single research-oriented application. It enables users to inspect retrieved clinical passages alongside generated responses and provides a foundation for evaluating retrieval quality using Precision@K and Recall@K. Quantitative performance claims should be added after running the evaluation pipeline and recording the actual results. The system is intended for research and educational use, not as a replacement for professional medical judgment.

Technology

Python

Have a similar project in mind?

Your Privacy Matters

We use necessary cookies to keep INFORSORSA working properly. With your permission, we may also use optional cookies for preferences, analytics and marketing. You can manage your choices at any time. Privacy Policy · Cookie Policy