Skip to content

aakash4dev/medisence-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

40 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MedicSense AI - Complete Healthcare Assistant ๐Ÿฅ

A comprehensive AI-powered medical chatbot with symptom analysis, emergency detection, appointment scheduling, and health record management.

๐Ÿš€ Features

Core Features

  • โœ… AI Medical Chatbot - Natural language symptom analysis
  • โœ… Emergency Detection - Instant first-aid guidance for critical situations
  • โœ… Severity Classification - 4-level urgency system (Mild to Critical)
  • โœ… Doctor Matching - Find specialists based on symptoms
  • โœ… Appointment Scheduling - Book and manage appointments
  • โœ… Health Records - Track vitals, symptoms, and medical history
  • โœ… Image Analysis - Analyze injury/medical images
  • โœ… Family Doctor System - Save and consult family physician
  • โœ… Real-time Chat - LLM-style conversational interface

Advanced Features

  • ๐Ÿ“Š Health Dashboard - Visualize health trends
  • ๐Ÿ”” Smart Notifications - Appointment reminders and health alerts
  • ๐Ÿ“ฑ Responsive Design - Works on all devices
  • ๐ŸŒ Multi-language Support - (Coming soon)
  • ๐Ÿ”’ Data Privacy - Local storage, HIPAA-compliant ready

๐Ÿ“ Project Structure

medisence-ai/
โ”œโ”€โ”€ backend/                    # Flask backend server
โ”‚   โ”œโ”€โ”€ app.py                 # Main Flask application
โ”‚   โ”œโ”€โ”€ database.py            # Database management
โ”‚   โ”œโ”€โ”€ auth_manager.py        # Authentication & sessions
โ”‚   โ”œโ”€โ”€ symptom_analyzer.py    # Symptom extraction
โ”‚   โ”œโ”€โ”€ severity_classifier.py # Urgency classification
โ”‚   โ”œโ”€โ”€ emergency_detector.py  # Emergency detection
โ”‚   โ”œโ”€โ”€ camera_analyzer.py     # Image analysis
โ”‚   โ”œโ”€โ”€ gemini_service.py      # AI integration
โ”‚   โ”œโ”€โ”€ otp_service.py         # OTP management
โ”‚   โ”œโ”€โ”€ medical_kb.json        # Medical knowledge base
โ”‚   โ”œโ”€โ”€ doctors_db.json        # Doctors database
โ”‚   โ””โ”€โ”€ requirements.txt       # Python dependencies
โ”‚
โ”œโ”€โ”€ frontend/                   # Frontend application
โ”‚   โ”œโ”€โ”€ index.html             # Main page
โ”‚   โ”œโ”€โ”€ script.js              # Core JavaScript
โ”‚   โ”œโ”€โ”€ dashboard.js           # Dashboard functionality
โ”‚   โ”œโ”€โ”€ style.css              # Styles
โ”‚   โ””โ”€โ”€ auth.html              # Authentication page
โ”‚
โ”œโ”€โ”€ API_DOCUMENTATION.md        # Complete API docs
โ””โ”€โ”€ README.md                   # This file

๐Ÿ› ๏ธ Installation & Setup

Prerequisites

  • Python 3.8 or higher
  • Modern web browser
  • VS Code (recommended)

Step 1: Clone the Repository

git clone https://github.com/Shivansh1146/MedicSense-AI

Step 2: Install Backend Dependencies

cd backend
pip install -r requirements.txt

Dependencies installed:

  • Flask 2.3.3 - Web framework
  • flask-cors 4.0.0 - Cross-origin support
  • Pillow 10.1.0 - Image processing

Step 3: Start the Backend Server

python app.py

You should see:

๐Ÿš€ MedicSense AI Backend Starting...
๐Ÿ“ก Server running at http://localhost:5000
๐Ÿ’Š Medical chatbot ready to assist

Step 4: Access the Application

Open your browser and go to:

http://localhost:5000

๐ŸŽฏ How to Use

1. Start a Conversation

  • Click the chat icon in the bottom-right corner
  • Describe your symptoms naturally
  • Get instant AI-powered analysis

2. Example Queries

"I have a severe headache and fever"
"My chest hurts and I feel dizzy"
"I twisted my ankle while playing"
"I need a doctor for heart problems"

3. Emergency Situations

The system automatically detects emergencies and provides first-aid guidance:

  • Chest pain
  • Severe bleeding
  • Difficulty breathing
  • Loss of consciousness

4. Book Appointments

  • Save your family doctor
  • Book appointments with specialists
  • Manage and reschedule appointments

5. Track Health

  • Record vital signs
  • Monitor health trends
  • Store medical history

๐Ÿฅ Severity Levels

Level Severity Action Required
1 Mild Self-care, monitor symptoms
2 Moderate Consult family doctor
3 Serious See specialist soon
4 Critical Emergency - Call 911

๐Ÿ“ก API Endpoints

Main Endpoints

  • POST /api/chat - Chat with AI
  • POST /api/auth/otp/send - Send OTP
  • POST /api/auth/otp/verify - Verify OTP
  • POST /api/appointments/book - Book appointment
  • GET /api/appointments/<user_id> - Get appointments
  • POST /api/health/vitals - Save vital signs
  • GET /api/health/vitals/<user_id> - Get health records
  • POST /api/analyze-injury-image - Analyze images
  • GET /api/find-doctors - Search doctors

See API_DOCUMENTATION.md for complete API reference.

๐Ÿ”ง Configuration

Optional: Add Gemini API Key (Enhanced AI)

  1. Get a free API key from Google AI Studio
  2. Create .env file in backend folder:
GEMINI_API_KEY=your_api_key_here
  1. Restart the server

Customize Medical Knowledge

Edit backend/medical_kb.json to add:

  • New symptoms
  • Medical conditions
  • Treatment recommendations

Add Doctors

Edit backend/doctors_db.json to add local doctors and hospitals.

๐Ÿ”’ Security Features

  • โœ… Session token management
  • โœ… Local data storage
  • โœ… CORS protection
  • โœ… Input sanitization
  • โœ… Secure file uploads

๐Ÿงช Testing

Test the Chatbot

# In backend folder
python test_api.py

Test Emergency Detection

Send messages with emergency keywords:

  • "chest pain"
  • "can't breathe"
  • "severe bleeding"

๐Ÿš€ Deployment

Deploy to Heroku

heroku create medisense-ai
git push heroku main

Deploy to Railway

  1. Connect your GitHub repository
  2. Deploy from main branch
  3. Set environment variables

Deploy to AWS/GCP

See deployment guides in docs/ folder.

๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

๐Ÿ“ License

This project is licensed under the MIT License.

๐Ÿ‘จโ€๐Ÿ’ป Author

Shivansh

๐Ÿ™ Acknowledgments

  • Flask framework
  • Google Gemini AI
  • Medical knowledge databases
  • Open-source community

๐Ÿ“ž Support

For issues and questions:

๐Ÿ”ฎ Roadmap

Coming Soon

  • Multi-language support
  • Prescription management
  • Lab report analysis
  • Medicine reminders
  • Telemedicine integration
  • Insurance integration
  • Mobile app (React Native)

โš ๏ธ Disclaimer

MedicSense AI is an educational tool and should not replace professional medical advice.

Always consult with qualified healthcare professionals for medical concerns. In emergencies, call your local emergency number (911 in the US).


Made with โค๏ธ for better healthcare access

Star โญ this repository if you find it helpful!

About

Intelligent Healthcare Triage & Appointment Assistant.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors