RAGnosis / README.md
asadsandhu's picture
README.md Updated.
ff04da1
|
raw
history blame
4.53 kB
metadata
title: RAGnosis
emoji: πŸ‘
colorFrom: red
colorTo: indigo
sdk: gradio
sdk_version: 5.35.0
app_file: app.py
pinned: false
license: mit
short_description: Clinical Query Answering with RAG + MIMIC-IV Notes.

🩺 RAGnosis – Clinical Reasoning via Retrieval-Augmented Generation

License: MIT Python Hugging Face GitHub Repo

βš•οΈ A fully offline-capable, Gradio-powered RAG assistant trained on annotated clinical notes from the MIMIC-IV-Ext-DiReCT dataset to perform explainable diagnostic reasoning.


πŸ–ΌοΈ Demo

Try it live on Hugging Face Spaces πŸ‘‰
πŸ”— https://huggingface.co/spaces/asadsandhu/RAGnosis

Demo


βš™οΈ Tech Stack

Layer Details
🧠 Model Nous-Hermes-2-Mistral-7B-DPO
πŸ₯ Dataset MIMIC-IV-Ext-DiReCT
πŸ” Retriever FAISS + SentenceTransformers (all-MiniLM-L6-v2)
πŸ’» Frontend Gradio (Hugging Face Spaces)
🧠 Backend PyTorch + Transformers + BitsAndBytes

πŸš€ Features

  • πŸ”Ž Top-k document retrieval from real annotated clinical notes
  • πŸ“‹ Reasoning based on structured diagnostic chains
  • 🧠 GPT-style generation from LLM (Mistral 7B) without internet dependency
  • 🧾 Clean Gradio interface for natural medical queries
  • 🧠 Answers explained like a clinical reasoning expert

⚑ Example Prompt

Patient presents with fatigue, orthopnea, and lower extremity edema.

πŸ’¬ Model response:

Based on the patient's symptoms and context, the most likely diagnosis is congestive heart failure (CHF)...


πŸ›  How It Works

βœ… Step 1: Preprocessing

  • Extract chains from samples/ and diagnostic_kg/
  • Build retrievable clinical observations + diagnoses

βœ… Step 2: Retrieval (FAISS)

βœ… Step 3: Generation

  • Format prompt in [INST] syntax
  • Generate diagnosis using Nous-Hermes-2-Mistral-7B-DPO

πŸ§ͺ Run Locally

# 1. Clone the repository
git clone https://github.com/asadsandhu/RAG-Diagnostic-Assistant.git
cd RAG-Diagnostic-Assistant

# 2. Install dependencies
pip install -r requirements.txt

# 3. Run the app
python app.py

βœ”οΈ Required files:


πŸ“ Folder Structure

RAG-Diagnostic-Assistant/
β”œβ”€β”€ app.py
β”œβ”€β”€ faiss_index.bin
β”œβ”€β”€ retrieval_corpus.csv
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ assets/
β”‚   └── demo.png
└── README.md

πŸ‘€ Author

Built with ❀️ by Asad Ali πŸ”— LinkedIn – @asadsandhu0 πŸ”— Hugging Face – RAGnosis


πŸ“„ License

This project is under the MIT License.


πŸ™ Acknowledgments

  • MIMIC-IV-Ext-DiReCT: Annotated diagnostic data
  • Hugging Face Transformers + Gradio
  • Facebook Research – FAISS
  • Nous Research – Instruction-tuned Mistral model

⚠️ Disclaimer: This project is for research/demo use only. Not intended for clinical decision-making.