A comprehensive full-stack healthcare application powered by AI and Machine Learning
Features • Installation • Usage • API • Architecture
- Overview
- Features
- Technology Stack
- Project Structure
- Installation
- Configuration
- Usage
- Chatbot Architecture
- Model Architecture
- Disclaimer
MediCure is an advanced AI-powered healthcare assistant that combines traditional medicine knowledge with cutting-edge machine learning technology. The application provides intelligent healthcare solutions through three main modules:
-
🔍 Medicine Prediction System: Analyzes medicine names using fine-tuned BERT models
- Common usage and indications (583 categories)
- Possible side effects (1,271 categories)
- Alternative substitutes (43,297 categories)
-
🌿 Home Remedies Engine:
- Database of 144+ traditional remedies
- AI-powered remedy generation using Google Gemini
- Yoga pose recommendations
- Smart search with multiple matching strategies
-
🤖 AI Doctor Chatbot:
- Conversational health assistant powered by Google Gemini 2.0 Flash
- Symptom analysis and disease predictions
- Diet and workout recommendations
- Precautionary measures
- ✅ Usage Prediction: Identify what a medicine is commonly used for
- ✅ Side Effects Detection: Get comprehensive list of potential side effects
- ✅ Substitute Finder: Discover alternative medicines
- ✅ Fast Inference: Optimized BERT models for quick predictions
- ✅ Real-time Results: Instant predictions without delays
- ✅ Database Search: Search through 144+ traditional remedies
- ✅ AI Fallback: Generates 5 remedies when database doesn't have results
- ✅ Yoga Integration: Links to recommended yoga poses
- ✅ Bullet-Point Format: Easy-to-read numbered remedy instructions
- ✅ Source Tracking: Visual indicators for database vs AI-generated content
- ✅ Popular Searches: Quick access to common conditions
- ✅ Natural Conversation: Chat naturally about health concerns
- ✅ Symptom Analysis: AI analyzes symptoms and suggests possible conditions (max 2)
- ✅ Holistic Advice: Diet plans, workouts, and precautions
- ✅ Context Awareness: Maintains conversation history
- ✅ Medical Disclaimer: Always reminds users to consult professionals
- ✅ Real-time Responses: Powered by Google Gemini 2.0 Flash
- ✅ Responsive Design: Works on desktop, tablet, and mobile
- ✅ Modern UI: Built with Tailwind CSS
- ✅ Real-time Updates: Instant results and feedback
- ✅ Loading States: Visual feedback during API calls
- ✅ Error Handling: Graceful error messages
| Technology | Version | Purpose |
|---|---|---|
| Python | 3.8+ | Core language |
| FastAPI | 0.115.6 | Web framework |
| Uvicorn | 0.34.0 | ASGI server |
| PyTorch | 2.7.0 | Deep learning |
| Transformers | 4.52.3 | BERT models |
| Google Gemini AI | 0.8.5 | Conversational AI |
| Pandas | 2.2.3 | Data processing |
| Joblib | 1.5.1 | Model serialization |
| Technology | Version | Purpose |
|---|---|---|
| React | 18.3.1 | UI library |
| Vite | 6.0.3 | Build tool |
| Tailwind CSS | 3.4.17 | Styling |
| React Router | 6.28.0 | Routing |
| Axios | 1.7.9 | HTTP client |
| Lucide React | 0.263.1 | Icons |
- BERT Base Uncased: Pre-trained transformer model
- Fine-tuned Models: Custom training for medical domain
- Medicine Usage: 583 labels
- Side Effects: 1,271 labels
- Substitutes: 43,297 labels
- Label Encoders: For classification decoding
medicure-fullstack/
│
├── 📂 backend/ # FastAPI Backend
│ ├── main.py # Main application (400+ lines)
│ ├── requirements.txt # Python dependencies
│ ├── .env # Environment variables (gitignored)
│ ├── .env.example # Environment template
│ ├── .gitignore # Git ignore rules
│ │
│ ├── 🧠 ML Models (150MB+)
│ ├── bert_finetuned_model_prediction.pkl # Medicine usage model
│ ├── bert_finetuned_model_sideffects.pkl # Side effects model
│ ├── bert_finetuned_model_substitute.pkl # Substitutes model
│ ├── label_encoder_prediction.pkl # Usage labels encoder
│ ├── label_encoder_sideeffects.pkl # Side effects labels
│ ├── label_encoder_substitute.pkl # Substitute labels
│ │
│ ├── 📊 Data
│ ├── Home Remedies.csv # 144 traditional remedies
│ │
│ └── venv/ # Virtual environment
│
├── 📂 frontend/ # React Frontend
│ ├── 📂 public/
│ │ └── vite.svg # Favicon
│ │
│ ├── 📂 src/
│ │ ├── 📂 components/
│ │ │ └── Layout.jsx # Navigation & layout
│ │ │
│ │ ├── 📂 pages/
│ │ │ ├── Home.jsx # Landing page
│ │ │ ├── MedicinePrediction.jsx # Medicine analysis
│ │ │ ├── HomeRemedies.jsx # Remedies search
│ │ │ └── Chatbot.jsx # AI doctor chat
│ │ │
│ │ ├── 📂 services/
│ │ │ └── api.js # Axios API client
│ │ │
│ │ ├── App.jsx # Main app component
│ │ ├── main.jsx # Entry point
│ │ └── index.css # Global styles + Tailwind
│ │
│ ├── index.html # HTML template
│ ├── package.json # Dependencies
│ ├── vite.config.js # Vite config
│ ├── tailwind.config.js # Tailwind config
│ ├── postcss.config.js # PostCSS config
│ ├── .env.example # Environment template
│ ├── .gitignore
│ └── node_modules/ # Dependencies
│
├── 📂 Documentation
├── README.md # Main documentation
├── API_DOCUMENTATION.md # API reference
├── DEPLOYMENT.md # Deployment guide
├── PROJECT_STRUCTURE.md # Detailed structure
├── QUICK_REFERENCE.md # Quick commands
└── COPY_FILES_INSTRUCTIONS.md # Setup instructions
│
└── 📂 Scripts
├── setup.bat # Windows setup
├── setup.sh # Linux/Mac setup
└── start.bat # Windows launcher
Make sure you have the following installed before running the project:
- ✅ Python 3.8+ — Download here
- ✅ FastAPI — Documentation
- ✅ Git — Download here
- ✅ Google Gemini API Key — Get a free key
- ✅ 4GB+ RAM (recommended for ML models)
- ✅ 2GB+ Disk Space
git clone https://github.com/yourusername/medicure-fullstack.git
cd medicure-fullstack
setup.batgit clone https://github.com/yourusername/medicure-fullstack.git
cd medicure-fullstack
chmod +x setup.sh
./setup.shcd backend
python -m venv venv
venv\Scripts\activate # Windows
source venv/bin/activate # Linux/Mac
pip install -r requirements.txtCopy these 7 files to backend/:
bert_finetuned_model_prediction.pklbert_finetuned_model_sideffects.pklbert_finetuned_model_substitute.pkllabel_encoder_prediction.pkllabel_encoder_sideeffects.pkllabel_encoder_substitute.pklHome Remedies.csv
cd frontend
npm installGEMINI_API_KEY=your_gemini_api_key_here
PORT=8000VITE_API_URL=http://localhost:8000# Terminal 1 - Backend
cd backend
venv\Scripts\activate
python main.py
# Terminal 2 - Frontend
cd frontend
npm run dev- 🌐 Frontend: http://localhost:3000
- 🔌 Backend API: http://localhost:8000
- 📚 Swagger Docs: http://localhost:8000/docs
- ❤️ Health Check: http://localhost:8000/api/health
User Input
↓
Frontend (React)
↓
API Call (POST /api/chat)
↓
Backend (FastAPI)
↓
Add Medical Context
↓
Google Gemini AI
↓
Generate Response
↓
Return to Frontend
↓
Display to User
- Input: Medicine name
- Output: Usage category (583 classes)
- Architecture: BERT Base + Classification Head
- Input: Medicine name
- Output: Side effects list (1,271 classes)
- Input: Medicine name
- Output: Alternative medicines (43,297 classes)
IMPORTANT MEDICAL DISCLAIMER
This application is for informational and educational purposes only.
- Not Medical Professional: This is an AI tool, not a licensed doctor
- No Medical Advice: Information provided is not medical advice
- Consult Healthcare Professionals: Always seek professional medical advice
- Emergency Situations: Call emergency services for urgent medical issues
- AI Limitations: Predictions may not be accurate or complete
- Use at Your Own Risk: Developers assume no liability
- Severe symptoms
- Chest pain or difficulty breathing
- Persistent high fever
- Signs of stroke or heart attack
- Any life-threatening emergency
Call 911 or your local emergency number immediately for emergencies.
ML Engineer & Full Stack Developer
🎓 BTech ECE @ IIIT Una
💡 Specializing in AI/ML, GenAI, and Web Development
- Email: [email protected]
- GitHub: kumarAbhishek2004
- LinkedIn: kumar-abhishek-6b5828288
- Issues: Report Bug
- ✅ Medicine prediction with BERT
- ✅ Home remedies with AI fallback
- ✅ AI doctor chatbot
- ✅ Responsive UI
- 🔜 User authentication
- 🔜 Save chat history
- 🔜 Medicine interaction checker
- 🔜 Multi-language support
Made with ❤️ for better healthcare accessibility
⭐ Star this repo if you find it helpful!