A multi-dataset Retrieval-Augmented Generation (RAG) system built with LangChain, ChromaDB, and Streamlit. Supports intelligent conversational querying over three healthcare datasets.
healthcare_rag/
├── data/ ← Place your CSV files here
│ ├── heart.csv
│ ├── dermatology.csv
│ └── diabetes.csv
├── chroma_db/ ← Auto-created: persisted vector stores
├── data_ingestion.py ← CSV loading, cleaning, row→text conversion
├── vector_store.py ← ChromaDB collections builder/loader
├── agent.py ← Tools + ReAct agent setup
├── ingest.py ← One-time ingestion script
├── app.py ← Streamlit web UI
├── cli_chat.py ← Terminal chat interface
├── requirements.txt
├── .env.example ← Copy to .env and fill in your API key
└── README.md
git clone https://github.com/javaidgithub/healthcare-rag-chatbot.git
cd healthcare-rag-chatbot
python -m venv venv
venv\Scripts\activate # (Windows)
pip install -r requirements.txtOR
Place all project files in a folder, e.g. healthcare_rag/.
pip install -r requirements.txtcp .env.example .envEdit .env and add your API key:
# Free option — get a key at https://console.groq.com
GROQ_API_KEY=your_groq_api_key_here
LLM_PROVIDER=groq| Dataset | Kaggle URL | Save as |
|---|---|---|
| Heart Disease | link | data/heart.csv |
| Dermatology | link | data/dermatology.csv |
| Pakistani Diabetes | link | data/diabetes.csv |
Create the data/ folder and place the CSVs inside.
python ingest.pyThis reads the CSVs, converts each row to natural-language text, generates embeddings, and saves three ChromaDB collections to ./chroma_db/.
Streamlit (recommended):
streamlit run app.pyTerminal CLI:
python cli_chat.pyUser Query
│
▼
ReAct Agent (LangChain)
│
├─ Decides which Tool(s) to use
│
├── heart_disease_tool ──► heart_disease_index (ChromaDB)
├── dermatology_tool ──► dermatology_index (ChromaDB)
└── diabetes_tool ──► diabetes_index (ChromaDB)
│
HuggingFace Embeddings
(sentence-transformers/all-MiniLM-L6-v2)
│
Retrieved Docs
│
LLM
(Groq / OpenAI)
│
Answer
- Loads CSVs with pandas
- Normalises column names (lowercase, underscores)
- Drops columns with >50% missing values
- Fills remaining NaNs (median for numerics, "unknown" for text)
- Converts each row → structured natural-language sentence
- Embedding model:
sentence-transformers/all-MiniLM-L6-v2(free, local) - 3 separate ChromaDB collections:
heart_disease_indexdermatology_indexdiabetes_index
- Persistent local storage
- Three
create_retriever_tooltools (one per dataset) - ReAct agent using
hwchase17/react-chatprompt from LangChain Hub ConversationBufferMemoryfor multi-turn context- Configurable
k(documents retrieved per query)
- "What are common features of patients with heart disease?"
- "Tell me about psoriasis cases in the dermatology dataset."
- "What is the average glucose level in diabetic patients?"
- "Do older patients tend to have higher cholesterol?"
- "What skin conditions involve erythema?"
| Provider | Setup | Notes |
|---|---|---|
| Groq | Free at console.groq.com | Fast, recommended |
| OpenAI | platform.openai.com | Paid |
Switch provider in .env:
LLM_PROVIDER=groq # or openai- 💬 Multi-turn conversation with memory
- 🔍 Optional reasoning trace (shows which tool was used and why)
- 💡 Example questions panel
- ⚙️ Sidebar controls for
kand reasoning trace toggle - 🗑️ Clear conversation button
- Vector stores are built once and reused on every run.
- To rebuild stores (after new data), delete
./chroma_db/and re-runpython ingest.py. - The embedding model runs locally on CPU — no API key needed for embeddings.
- The agent automatically routes questions to the correct dataset(s).