An advanced AI-powered medical information assistant optimized for Streamlit Cloud deployment.
User Input → Normalize → Symptom Rules → MedQuad/MIMIC-III Search → Gemini 1.5 Flash → Response
- 🧠 Context-Aware Conversations: Thread-based memory system
- 📚 Multi-Dataset Integration: MedQuad + MIMIC-III + Custom rules
- ⚡ Gemini 1.5 Flash: Fast AI-powered response generation
- 🎯 Streamlit Cloud Optimized: Ready for immediate deployment
- 🔒 Secure API Management: Server-side API key configuration
# Create project directory
mkdir healthbot-v2
cd healthbot-v2
# Create required directories
mkdir .streamlitCopy each section from this package into separate files:
app.py(main application)requirements.txt(dependencies)symptoms.json(medical data).streamlit/config.toml(UI config).gitignore(git ignore rules)README.md(documentation)
# Create virtual environment
python -m venv healthbot_env
# Activate virtual environment
# Windows:
healthbot_env\Scripts\activate
# macOS/Linux:
source healthbot_env/bin/activate
# Install dependencies
pip install -r requirements.txt# Create .streamlit/secrets.toml for local testing
echo 'GEMINI_API_KEY = "your_actual_api_key_here"' > .streamlit/secrets.toml
# Get your API key from: https://makersuite.google.com/app/apikey# Run the application
streamlit run app.py
# Open browser to: http://localhost:8501- ✅ App loads without errors
- ✅ Sidebar shows dataset information
- ✅ Chat interface is responsive
- ✅ AI responses are generated (with API key)
- ✅ Medical databases load properly
# Initialize git repository
git init
# Add files (secrets.toml will be ignored)
git add .
# Commit changes
git commit -m "Initial HealthBot v2.0 deployment"
# Push to GitHub
git remote add origin https://github.com/yourusername/healthbot-v2.git
git branch -M main
git push -u origin main- Go to share.streamlit.io
- Sign in with your GitHub account
- Click "New app"
- Select your repository:
yourusername/healthbot-v2 - Set main file path:
app.py - Click "Advanced settings"
- Add secrets:
GEMINI_API_KEY = "your_actual_gemini_api_key_here" - Click "Deploy!"
- ✅ App deploys successfully
- ✅ All datasets load properly
- ✅ AI integration works
- ✅ Chat functionality operational
- ✅ No errors in logs
- Visit Google AI Studio
- Sign in with Google account
- Click "Create API Key"
- Copy the generated key
- Add to Streamlit Cloud secrets
In your Streamlit Cloud dashboard:
- Go to your app settings
- Click on "Secrets"
- Add:
GEMINI_API_KEY = "your_actual_api_key_here"
healthbot-v2/
├── app.py # Main application (Streamlit expects app.py)
├── requirements.txt # Dependencies
├── symptoms.json # Medical symptom database
├── .streamlit/
│ └── config.toml # UI configuration
├── .gitignore # Git ignore rules
└── README.md # This file
- Virtual environment created and activated
- All dependencies installed without errors
- API key configured in
.streamlit/secrets.toml - App runs with
streamlit run app.py - No errors in terminal/console
- Medical datasets load successfully
- Chat interface responds to user input
- AI generates relevant responses
- Repository pushed to GitHub
- Streamlit Cloud deployment successful
- API key added to Cloud secrets
- App accessible via provided URL
- All features working in production
- No errors in Cloud logs
- Input Normalization: Clean and standardize user input
- Symptom Rule Matching: Apply pattern matching from medical rules
- Database Search: Query MedQuad and MIMIC-III datasets
- Context Integration: Include conversation history
- AI Enhancement: Process through Gemini 1.5 Flash
- Response Generation: Deliver comprehensive, contextual response
- MedQuad: 47,000+ medical Q&A pairs from trusted sources
- MIMIC-III: Clinical conversations and professional guidance
- Custom Database: Specialized symptom-advice mappings
- Rule Engine: Pattern matching from medical knowledge base
- Model: Gemini 1.5 Flash for fast, accurate responses
- Context: Thread-based conversation memory
- Safety: Built-in medical disclaimers and safety guidelines
- Fallback: Graceful degradation when AI is unavailable
This application provides general health information only and is not a substitute for professional medical advice, diagnosis, or treatment. Always consult qualified healthcare professionals for medical concerns.
- Never commit API keys to version control
- Use Streamlit Cloud secrets for production
- Use
.streamlit/secrets.tomlfor local development only - Add secrets.toml to .gitignore
- Dataset loading is cached for 1 hour
- Conversation history limited to last 10 messages
- Database search results limited to top 3 per source
- Response length optimized for readability
"Gemini API key not found"
- Solution: Add API key to Streamlit Cloud secrets
- Local: Check
.streamlit/secrets.tomlexists and has correct key
"Dataset loading failed"
- Solution: Check internet connection and Hugging Face access
- App will work with fallback data if datasets fail
"ModuleNotFoundError"
- Solution: Ensure all requirements are installed
- Run:
pip install -r requirements.txt
App won't start locally
- Solution: Check Python version (3.9+ recommended)
- Verify virtual environment is activated
- Check for syntax errors in app.py
- Streamlit Documentation: docs.streamlit.io
- Google AI Studio: makersuite.google.com
- Dataset Sources: Links provided in app sidebar
- ✅ Streamlit Cloud optimized deployment
- ✅ Enhanced conversation context management
- ✅ Improved medical database integration
- ✅ Gemini 1.5 Flash AI integration
- ✅ Better error handling and fallbacks
- ✅ Clean, professional UI design
- ✅ Comprehensive medical disclaimer system
🏥 HealthBot v2.0 - Advanced Medical Information Assistant
Powered by Gemini 1.5 Flash + Medical Databases + AI