Skip to content

Latest commit

Β 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ MediCenter β€” Premium Doctor Booking & AI Medical Assistant Platform

MediCenter is a modern, full-stack healthcare platform designed to streamline doctor appointment booking, patient management, and provide instant AI-driven medical guidance. It features a complete patient portal, an interactive doctor panel, a comprehensive admin dashboard, and an integrated AI Medical Chatbot powered by OpenRouter.


✨ Features at a Glance

πŸ‘€ Patient Portal (Frontend)

  • Smart Doctor Search: Filter doctors dynamically by speciality (General Physician, Gynecologist, Neurologist, Pediatrician, Dermatologist, Gastroenterologist).
  • Interactive Booking System: Real-time slot selection with automatic calendar updates and slot booking validation.
  • Comprehensive Profile Management: Edit personal details, upload profile pictures (Cloudinary), and track appointment statuses.
  • Secure Payment Integration: Seamlessly pay booking fees using Stripe or Razorpay checkout.
  • AI Medical Assistant: Interactive chatbot that answers health queries, suggests specialties based on symptoms, and guides users on bookings.
  • AI Medical Report Summarizer (Vector RAG): Upload clinical report documents (PDFs or images) and get layout-aware structured explanations in plain English. Integrates a local Retrieval-Augmented Generation (RAG) pipeline to compute Cosine Similarity search over OpenAI Embeddings, returning verified NIH MedlinePlus/PubMed citations and links.

πŸ’Ό Admin & Doctor Dashboard

  • Rich Analytics Dashboards (Recharts): View responsive visual charts (Area, Donut Pie, and Bar charts) visualizing appointments, total revenue, doctor specialty distribution, and booking completion rates.
  • Doctor Specific Portal: Individual doctor logins to manage bookings, track monthly earnings trends, and update personal availability with custom charts.
  • Doctor Management: Easily add doctors with credentials, qualifications, specialities, fees, addresses, and bios. Toggle availability status.
  • Appointment Management: View all appointments, mark appointments as completed, or process cancellations.

πŸ€– AI Doctor Recommendation Engine

MediCenter uses an AI-assisted care-routing system that analyzes a patient's natural-language description and recommends an appropriate medical specialty.

The system then retrieves doctors from the existing database and ranks them using a deterministic scoring algorithm based on specialty match, availability, rating, experience and profile completeness.

AI is used for specialty classification only. Doctor ranking is handled deterministically by the backend.

πŸ“ System Architecture Diagram

graph TD
    A[Patient Input: Natural Language Health Concern] -->|HTTP POST /api/ai/doctor-recommendations| B[Express Router & authUser Middleware]
    B --> C[Rate Limiter: max 10 req / 15 mins / user]
    C --> D[AI Recommendation Controller]
    D --> E[AI Classification Service]
    E -->|OpenRouter API / gpt-4o-mini| F[Structured JSON Output]
    F --> G{Safety / Urgency Check}
    G -->|Urgent Symptoms| H[Return Emergency Care Banner]
    G -->|Non-Urgent| I[Specialty Normalization & Validation]
    I --> J[MongoDB Doctor Query]
    J --> K[Deterministic Scoring & Ranking Engine]
    K --> L["Weighted Score Breakdown:\nβ€’ Specialty Match (40%)\nβ€’ Slot Availability (20%)\nβ€’ Rating (15%)\nβ€’ Experience (15%)\nβ€’ Profile Completeness (10%)"]
    L --> M[Explainable Ranked Doctor Cards]
    M --> N[Direct Appointment Booking Route]
Loading

🩺 Doctor AI Copilot

MediCenter includes an AI-powered Doctor Copilot inside the Doctor Dashboard (admin/src) that helps healthcare professionals retrieve and summarize relevant patient information.

The Copilot uses patient-specific retrieval to access relevant appointments, doctor clinical notes, and medical records before generating a grounded response.

Core capabilities:

  • Patient history summarization
  • Medical report / clinical notes comparison
  • Medication history retrieval
  • Relevant record discovery via Patient-Specific Vector RAG
  • AI-assisted editable consultation drafts
  • Clickable source citations
  • Strict doctor authorization and patient isolation

πŸ“ Doctor AI Copilot Architecture Diagram

graph TD
    Doctor -->|Access Doctor Panel| DoctorDashboard[Doctor Dashboard / Appointments]
    DoctorDashboard -->|Select Patient / Click Copilot| CopilotUI[Doctor AI Copilot Workspace]
    CopilotUI -->|HTTP Request with dtoken| BackendAuth[authDoctor Middleware]
    BackendAuth -->|Verify Authorized Patient Relationship| AuthCheck{Authorized?}
    AuthCheck -->|No| Reject[403 Forbidden]
    AuthCheck -->|Yes| RAGEngine[Patient-Specific Vector RAG Engine]
    RAGEngine -->|Filter Metadata: patientId| VectorSearch[OpenAI Embeddings & Cosine Similarity]
    VectorSearch -->|Top K=5 Patient Records| ContextBuilder[Grounded Prompt Builder]
    ContextBuilder -->|OpenRouter gpt-4o-mini| LLMService[LLM Service]
    LLMService -->|Structured Answer + Source Citations| Response[Doctor Copilot Interface]
    Response --> Display["Grounded Output + Clickable Sources\n+ Safety Disclaimer\n+ Editable Consultation Draft"]
Loading

πŸ› οΈ Technology Stack

Layer Technologies
Frontend React (Vite), Tailwind CSS, Recharts (Data Visualization), Framer Motion, React Icons, Axios, React Router v6, React Toastify
Backend Node.js, Express.js, JWT, bcrypt (Security), Multer (File Uploads), pdf-parse (PDF Text Extraction)
Database MongoDB + Mongoose
Cloud Storage Cloudinary (Doctor/User Profile Pictures)
Payments Stripe & Razorpay
AI Integrations OpenAI SDK, OpenRouter (gpt-4o-mini), Vector RAG (In-memory Cosine Similarity over OpenAI Embeddings)

πŸš€ Setup & Installation

1️⃣ Clone the Repository

git clone https://github.com/khushalkks/MediCenter.git
cd MediCenter

2️⃣ Configure Environment Variables

Create a .env file in each of the three directories based on the provided .env.example templates.

πŸ“ backend/.env

PORT=4000
MONGODB_URI="your_mongodb_connection_string"
DB_NAME="wellora"
JWT_SECRET="your_custom_jwt_secret"
ADMIN_EMAIL="admin@wellora.com"
ADMIN_PASSWORD="admin_secure_password"
CLOUDINARY_NAME="your_cloudinary_name"
CLOUDINARY_API_KEY="your_cloudinary_api_key"
CLOUDINARY_SECRET_KEY="your_cloudinary_secret_key"
STRIPE_SECRET_KEY="your_stripe_secret_key"
RAZORPAY_KEY_ID="your_razorpay_key_id"
RAZORPAY_KEY_SECRET="your_razorpay_key_secret"
CURRENCY="INR"
OPENAI_API_KEY="your_openrouter_api_key"
OPENROUTER_BASE_URL="https://openrouter.ai/api/v1"

πŸ“ frontend/.env

VITE_BACKEND_URL="http://localhost:4000"
VITE_RAZORPAY_KEY_ID="your_razorpay_key_id"

πŸ“ admin/.env

VITE_BACKEND_URL="http://localhost:4000"
VITE_CURRENCY="INR"

πŸ—„οΈ Database Seeding

To get started quickly, you can seed the database with 15 sample doctors including images, qualifications, specialities, fees, and addresses.

cd backend
node seed.js

All seeded doctors will have the default login password: Doctor@123


πŸ’» Running the Project

MediCenter is configured with root scripts to let you install and run all services concurrently in development mode.

# 1. Install all dependencies across backend, frontend, and admin panels
npm run install:all

# 2. Start all three services together
npm run dev

πŸ”— Local Services Ports:

  • Frontend (Patient Portal): http://localhost:5173
  • Admin Dashboard: http://localhost:5174 (or next free port)
  • Backend API Server: http://localhost:4000

πŸ“¦ Production Deployment

To build the project for deployment:

Frontend:

cd frontend
npm run build

Admin Dashboard:

cd admin
npm run build

πŸ‘¨β€πŸ’» Contributor

  • Khushal Kumar Sahu

*Made with πŸ’– by Khushal

About

MERN Stack Doctor Appointment Booking platform featuring Stripe/Razorpay payments, Cloudinary uploads, and an AI chatbot powered by OpenRouter.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages