A comprehensive medical assistant that provides grounded, cited health information from authoritative sources (MedlinePlus, CDC). Not medical advice.
- 35+ Medical Conditions with detailed summaries
- Multiple Cancer Types (breast, lung, colon, prostate, skin, ovarian, cervical, pancreatic, liver)
- Physical Injuries (sprains, fractures, bruises)
- Women's Health (menopause, PCOS, hormonal imbalance)
- Neurological Conditions (stroke, brain tumors, migraines)
- Infectious Diseases (COVID-19, flu, tuberculosis, measles, cholera)
- Chronic Conditions (diabetes, hypertension, heart disease, asthma)
- Overview: Clear explanation of the condition
- Symptoms: Key signs to watch for
- Causes: What leads to the condition
- Treatment: Available treatment options
- Prevention: How to reduce risk
- Direct Links: MedlinePlus and CDC official pages
- Emergency Detection: Flags potential emergency situations
- Medical Disclaimers: Clear warnings that this is not medical advice
- Professional Guidance: Encourages consulting healthcare providers
- Emergency Contact Info: Reminds users to call 911 when appropriate
- Intelligent Keyword Detection: Matches similar terms
- Exact Word Boundaries: Prevents false matches
- Priority Matching: Longer, more specific terms matched first
- Python 3.8+
- pip package manager
- Clone the repository
git clone https://github.com/yourusername/Medical-RAG-Assistant.git
cd Medical-RAG-Assistant- Install dependencies
pip install -r requirements.txt- Start the backend API
uvicorn app.api:app --host 0.0.0.0 --port 8000 --reload- Start the frontend (new terminal)
streamlit run streamlit_app.py- Access the application
- Web Interface: http://localhost:8501
- API Documentation: http://localhost:8000/docs
- Health Check: http://localhost:8000/health
Ask questions like:
- "What are diabetes symptoms?"
- "How to treat a sprained ankle?"
- "COVID-19 prevention methods"
- "Breast cancer screening guidelines"
- "Low blood pressure causes"
curl -X POST "http://localhost:8000/ask" \
-H "Content-Type: application/json" \
-d '{
"query": "What are the symptoms of heart disease?",
"top_k": 6,
"voice": false
}'{
"answer": "General health guidance...",
"condition_pages": [
{
"provider": "MedlinePlus",
"title": "Heart Disease - MedlinePlus",
"url": "https://medlineplus.gov/heartdiseases.html"
}
],
"disease_summary": {
"condition": "Heart Disease",
"overview": "A range of conditions that affect the heart.",
"symptoms": "Chest pain, shortness of breath, fatigue...",
"causes": "High blood pressure, high cholesterol...",
"treatment": "Medications, lifestyle changes...",
"prevention": "Healthy diet, regular exercise..."
},
"safety": {
"disclaimer": "This is for informational purposes only...",
"emergency": false
}
}- API Endpoints:
/ask,/health,/ - RAG System: Retrieval-Augmented Generation with embeddings
- Disease Database: Comprehensive static medical knowledge base
- Safety Guardrails: Emergency detection and medical disclaimers
- Clean UI: Intuitive medical query interface
- Disease Summaries: Structured medical information display
- Direct Links: Quick access to authoritative sources
- Safety Warnings: Prominent emergency and disclaimer notices
- MedlinePlus: National Library of Medicine
- CDC: Centers for Disease Control and Prevention
- Embeddings: Sentence transformers for semantic search
- Static Database: 35+ curated medical conditions
Medical-RAG-Assistant/
├── app/
│ ├── api.py # FastAPI backend
│ ├── schemas.py # Pydantic models
│ ├── rag.py # RAG retrieval system
│ ├── condition_links.py # Disease database
│ ├── guardrails.py # Safety features
│ └── stt_tts.py # Voice features (placeholder)
├── streamlit_app.py # Frontend interface
├── requirements.txt # Dependencies
├── store/ # Data storage
└── README.md # This file
# Optional configurations
EMBEDDINGS_MODEL=all-MiniLM-L6-v2 # Sentence transformer model
STORE_DIR=./store # Data storage directory
API_BASE=http://localhost:8000 # Backend URL for frontend- Add new diseases: Update
DISEASESdictionary incondition_links.py - Modify safety rules: Edit
guardrails.py - Change UI: Customize
streamlit_app.py - Update embeddings: Modify
EMBEDDINGS_MODELinrag.py
- Not Medical Advice: This tool provides general health information only
- Emergency Situations: Call 911 or local emergency services for emergencies
- Professional Consultation: Always consult healthcare providers for medical decisions
- Information Purpose: Content is for educational purposes only
The system automatically flags queries containing emergency keywords:
- "emergency", "urgent", "911"
- "chest pain", "heart attack", "stroke"
- And displays prominent warnings
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-condition) - Add medical conditions to
condition_links.py - Test thoroughly with various queries
- Commit changes (
git commit -am 'Add new medical condition') - Push to branch (
git push origin feature/new-condition) - Create Pull Request
"condition_name": {
"keywords": ["keyword1", "keyword2", "synonym"],
"condition": "Display Name",
"overview": "Brief description...",
"symptoms": "List of symptoms...",
"causes": "What causes it...",
"treatment": "Treatment options...",
"prevention": "Prevention methods...",
"links": [
{"provider": "MedlinePlus", "title": "...", "url": "..."},
{"provider": "CDC", "title": "...", "url": "..."}
]
}- Response Time: < 2 seconds for most queries
- Accuracy: Exact keyword matching prevents false positives
- Coverage: 35+ medical conditions with comprehensive information
- Reliability: Static database ensures consistent responses
- Scalability: Lightweight architecture supports high query volumes
- Voice Integration: Real speech-to-text and text-to-speech
- LLM Integration: Advanced language model for better responses
- More Conditions: Expand to 100+ medical conditions
- Multilingual Support: Support for multiple languages
- Mobile App: Native mobile applications
- Symptom Checker: Interactive symptom assessment tool
- Drug Information: Medication database integration
- Doctor Finder: Healthcare provider location service
This project is licensed under the MIT License - see the LICENSE file for details.
- MedlinePlus: National Library of Medicine for authoritative health information
- CDC: Centers for Disease Control and Prevention for public health data
- FastAPI: Modern, fast web framework for building APIs
- Streamlit: Open-source app framework for machine learning projects
- Sentence Transformers: State-of-the-art text embeddings
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: spoddutoori@umass.edu