This project develops a local, AI-driven medical chatbot designed to assist users with symptom analysis and provide preliminary health guidance. The chatbot employs a pre-trained GPT-2 model for natural language understanding and integrates with MongoDB to store user interactions.
Key features include:
- Symptom-based analysis: Extract relevant medical conditions and offer follow-up questions.
- Medical recommendations: Provide tailored guidance based on a pre-programmed symptom questionnaire.
- Emergency response: Direct users to nearby medical facilities in urgent cases.
The chatbot includes a Graphical User Interface (GUI) built with PyQt5, enabling easy interaction with users. The project demonstrates the integration of machine learning for conversational AI, symptom classification, and basic medical guidance, while focusing on a user-friendly interface.
To develop a medical chatbot that helps users by analyzing symptoms and providing tailored health-related recommendations and emergency guidance.
- Python programming
- Natural Language Processing (NLP) using GPT-2
- PyQt5 for GUI development
- MongoDB for data storage and retrieval
- Torch for machine learning model execution
- Basic understanding of medical terminologies
- 🧠 Problem-solving
- 🎯 Attention to Detail
- 🎨 User Interface Design
- 🗣️ Communication for handling user input effectively
- 🤖 A functional chatbot application with:
- Symptom-based conversation flow
- Dynamic question generation based on user input
- Real-time medical recommendations
- A fully operational GUI for user interaction
- 🧠 Pre-trained NLP model integration for text generation and intent recognition
- 🗂 Stored conversation logs in MongoDB for future analysis or improvements
- 🚨 Emergency handling system with integrated browser redirection for urgent care
- Model Used: GPT-2 for generating dynamic responses.
- Conversation Flow: Customized using a keyword-based intent extraction system.
- Data Storage: MongoDB is used to maintain user-specific context and manage multiple symptoms.
- GUI Development: PyQt5 ensures ease of use and a professional interface.
- Environment: Built locally to provide quick access and ensure user privacy during conversations.
medical-chatbot/
├── src/
│ ├── main.py # Application entry point
│ ├── chatbot/
│ │ └── core.py # Core chatbot functionality
│ ├── gui/
│ │ └── main_window.py # GUI implementation
│ └── database/
│ └── mongodb.py # Database operations
├── config/
│ └── settings.py # Configuration settings
└── requirements/
├── base.txt # Core dependencies
└── dev.txt # Development dependencies
- Python 3.8 or higher
- MongoDB
- Virtual environment (recommended)
-
Clone the repository:
git clone https://github.com/AliNikoo73/Medical-Chatbot.git cd Medical-Chatbot -
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements/base.txt
-
Start MongoDB:
# On macOS with Homebrew: brew services start mongodb-community
- Ensure MongoDB is running
- Run the application:
PYTHONPATH=$PYTHONPATH:. python src/main.py
- Launch the application
- Choose a conversation mode:
- "I am not feeling good!!" for symptom analysis
- "I need a doctor right away" for emergency help
- "I want to ask questions about my disease" for general questions
- Type your message in the input field
- Press Enter or click Send to interact with the chatbot
- Interactive questioning about symptoms
- Follow-up questions based on responses
- Medical recommendations based on symptoms
- Quick access to emergency resources
- Maps integration for nearby clinics
- Emergency guidance
- AI-powered responses using GPT-2
- Context-aware conversations
- Medical information retrieval
- MongoDB integration for conversation history
- Secure storage of medical interactions
- Easy retrieval of past conversations
For development setup, install additional dependencies:
pip install -r requirements/dev.txtThis project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request