An intelligent medical assistant that acts as a Senior Doctor conducting dynamic interviews with ASHA workers. The system uses Agentic AI and RAG (Retrieval Augmented Generation) to ask targeted follow-up questions and provide diagnoses with actionable medical advice.
- 🤖 Agentic AI: Conducts dynamic interviews, asking targeted follow-up questions
- 📚 RAG System: Retrieves relevant medical information from a knowledge base
- 🗄️ Pinecone Vector Database: Stores and searches medical knowledge efficiently
- 💬 Streamlit GUI: Beautiful, interactive web interface
- 🔍 Context-Aware: Maintains conversation context throughout the interview
- PDF Processing: Extracts and chunks medical information from
health.pdf - Vector Database: Stores embeddings in Pinecone for semantic search
- RAG System: Retrieves relevant context based on symptoms
- Doctor Agent: Uses Gemini AI to conduct interviews and provide diagnoses
- Streamlit Interface: User-friendly chat interface for ASHA workers
pip install -r requirements.txt
### 2. Set Up Environment Variables
Create a `.env` file in the project root with the following:
```env
# Gemini API Key
GEMINI_API_KEY=your_gemini_api_key_here
# Pinecone API Key
PINECONE_API_KEY=your_pinecone_api_key_here
# Pinecone Environment (e.g., us-east-1, us-west-2)
PINECONE_ENVIRONMENT=us-east-1
# Pinecone Index Name
PINECONE_INDEX_NAME=doctor-assist
- Gemini API Key: Get it from Google AI Studio
- Pinecone API Key: Sign up at Pinecone and get your API key
Run the setup script to process the PDF and upload it to Pinecone:
python setup_vector_db.pyThis will:
- Extract text from
health.pdf - Chunk the text into manageable pieces
- Generate embeddings
- Upload to Pinecone vector database
Note: This only needs to be run once, or when you update the PDF.
streamlit run app.pyThe app will open in your browser at http://localhost:8501
-
Enter Initial Symptoms: Type the patient's initial symptoms (e.g., "45-year-old male, high fever for 3 days, headache")
-
Answer Follow-up Questions: The AI doctor will ask targeted questions to gather more information
-
Receive Assessment: Once enough information is gathered, you'll receive:
- Diagnosis with confidence level
- Actionable medical advice
- Medication warnings
- Referral recommendations
ASHA Worker: "45-year-old male, high fever for 3 days, headache"
Doctor: "Please check the patient's eyes. Is there any yellowing (Jaundice)?
Also, ask if they have joint pain."
ASHA Worker: "No yellowing. Severe joint pain behind the eyes."
Doctor: ASSESSMENT:
Suspected Dengue Fever (85% Confidence)
Actionable Advice:
- Do NOT give Aspirin (bleeding risk)
- Prescribe Paracetamol
- Refer to District Hospital for Platelet count
Explanation:
High fever combined with retro-orbital pain (pain behind eyes)
is a classic sign of Dengue.
DoctorAssit/
├── app.py # Streamlit main application
├── doctor_agent.py # Core AI agent logic
├── rag_utils.py # RAG utilities for vector search
├── setup_vector_db.py # Script to set up Pinecone database
├── requirements.txt # Python dependencies
├── .env # Environment variables (create this)
├── health.pdf # Medical knowledge base PDF
└── README.md # This file
- Streamlit: Web interface
- Google Gemini: LLM for medical reasoning
- Pinecone: Vector database for semantic search
- Sentence Transformers: Text embeddings
- PyPDF2: PDF text extraction
- Make sure you've run
setup_vector_db.pyfirst - Check that your Pinecone index name matches in
.env
- Verify your API keys are correct in
.env - Make sure the
.envfile is in the project root
- The RAG system might not have found relevant information
- Try rephrasing your query or check if the PDF was uploaded correctly
This project is for educational and healthcare assistance purposes.