Skip to content

Moolahva/dulub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

433 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏥 Dulub - AI-Powered Healthcare Platform

Version License Status

A comprehensive telemedicine platform connecting patients with doctors through AI-assisted healthcare services and video consultations.

📋 Table of Contents


🎯 Project Goals

Primary Objectives

  1. Democratize Healthcare Access: Provide easy access to medical consultations regardless of location
  2. AI-Powered Assistance: Use artificial intelligence to help with symptom checking and medical report analysis
  3. Streamline Appointments: Simplify the process of booking and managing doctor appointments
  4. Digital Health Records: Enable secure storage and management of medical records
  5. Telemedicine Ready: Facilitate remote consultations through integrated video conferencing

Vision

To create a comprehensive healthcare platform that makes quality medical care accessible, efficient, and intelligent through technology.


👥 Users

1. Patients 👤

Who they are: Regular users seeking medical consultation and healthcare services

What they can do:

  • Browse and search for doctors by specialization
  • Book appointments with preferred doctors
  • Upload and manage medical records
  • Use AI symptom checker for preliminary health assessment
  • Get AI-powered analysis of medical reports (OCR)
  • Join video consultations with doctors
  • View appointment history and status

User Journey:

Login → Browse Doctors → Select Doctor → Book Appointment → 
Wait for Confirmation → Join Video Meeting → Consultation Complete

2. Doctors 👨‍⚕️

Who they are: Licensed medical professionals providing consultations

What they can do:

  • View all scheduled appointments
  • Confirm or cancel appointment requests
  • Access patient information and medical history
  • Conduct video consultations with patients
  • Mark appointments as completed
  • View patient medical records
  • Manage their profile and specialization

User Journey:

Login → View Appointments → Confirm Appointment → 
Review Patient Info → Join Video Meeting → Provide Consultation → 
Mark as Complete

3. Administrators 👔

Who they are: Platform administrators managing the system

What they can do:

  • View system-wide statistics and analytics
  • Manage staff (doctors and admins)
  • Monitor all appointments across the platform
  • View patient demographics
  • Access system health metrics
  • Manage user accounts

User Journey:

Login → View Dashboard → Monitor Statistics → 
Manage Staff → Oversee Operations

✨ Features

🔐 Authentication & Authorization

  • Multi-role Authentication: Separate login flows for patients, doctors, and admins
  • JWT-based Security: Secure token-based authentication
  • Role-based Access Control: Different permissions for different user types
  • Auto-login Demo: Pre-configured demo accounts for easy testing

📅 Appointment Scheduling System

  • Doctor Discovery: Browse all available doctors with specializations
  • Smart Booking:
    • Date picker (minimum tomorrow)
    • Time selection
    • Reason for visit
  • Status Management:
    • Pending → Confirmed → Completed workflow
    • Real-time status updates
  • Doctor Approval: Doctors can confirm or cancel appointments

🎥 Video Consultation (Telemedicine)

  • Jitsi Meet Integration: Free, open-source video conferencing
  • Unique Meeting Rooms: Each appointment gets its own room ID
  • One-Click Join: Easy access for both patients and doctors
  • HD Video & Audio: Professional quality consultations
  • Screen Sharing: Doctors can share medical information
  • No Registration Required: Join meetings directly from platform

📁 Medical Records Management

  • Upload Documents: Patients can upload lab reports, prescriptions, X-rays
  • Categorization: Organize by type (lab report, prescription, MRI, etc.)
  • Secure Storage: Files stored with metadata in database
  • Easy Access: View records anytime from dashboard
  • Doctor Access: Doctors can view patient medical history

🤖 AI-Powered Features

Symptom Checker

  • Chat Interface: Natural conversation with AI
  • Gemini 2.5 Pro: Powered by Google's latest AI model
  • Medical Knowledge: Provides information about symptoms
  • Safety First: Always reminds users to seek professional advice
  • Session Memory: Maintains conversation context

Medical Report Analyzer

  • OCR Capabilities: Extract text from medical reports
  • Image Analysis: Understand charts, graphs, and test results
  • Detailed Explanations: AI explains medical terminology
  • Key Findings: Highlights important information
  • Supports Multiple Formats: JPEG, PNG, WEBP

📊 Dashboard & Analytics

Patient Dashboard

  • Total appointments count
  • Upcoming appointments
  • Medical records count
  • Quick access to all features

Doctor Dashboard

  • Total patients served
  • Today's appointments
  • Pending confirmations
  • Patient management tools

Admin Dashboard

  • Total patients on platform
  • Total doctors available
  • Total appointments
  • Pending approvals
  • System health metrics

🎨 User Interface

  • Modern Design: Clean, professional healthcare UI
  • Responsive: Works on desktop, tablet, and mobile
  • Color-Coded: Different colors for different user roles
  • Accessible: Easy to navigate and understand
  • Fast Loading: Optimized performance

🏗️ Architecture

High-Level Overview

┌─────────────────────────────────────────────────────────────┐
│                    CLIENT (Browser)                         │
│  React 18 + TypeScript + Material-UI + Vite                │
└───────────────────────┬─────────────────────────────────────┘
                        │ HTTPS
                        │ (Preview URL)
┌───────────────────────▼─────────────────────────────────────┐
│              Kubernetes Ingress (Nginx)                      │
│  Routes: /api/* → Backend, /* → Frontend                   │
└───────────┬─────────────────────────┬───────────────────────┘
            │                         │
            │ Port 8001              │ Port 3000
            │                         │
┌───────────▼─────────────┐   ┌──────▼──────────────────────┐
│   BACKEND               │   │   FRONTEND                  │
│   FastAPI + Uvicorn     │   │   Vite Dev Server          │
│   Python 3.11+          │   │   React 18 + TypeScript    │
│                         │   │                             │
│   • JWT Auth            │   │   • MUI Components         │
│   • REST APIs           │   │   • Axios HTTP Client      │
│   • Motor (Async)       │   │   • React Router           │
│   • Gemini AI           │   │   • Context API            │
└───────────┬─────────────┘   └─────────────────────────────┘
            │
            │ MongoDB Driver
            │
┌───────────▼─────────────────────────────────────────────────┐
│              MongoDB Atlas (Cloud Database)                  │
│  • Users Collection                                          │
│  • Appointments Collection                                   │
│  • Medical Records Collection                                │
└──────────────────────────────────────────────────────────────┘

External Integrations:
┌──────────────────────┐    ┌──────────────────────┐
│  Gemini 2.5 Pro API  │    │   Jitsi Meet         │
│  (Text & Vision)     │    │   (Video Calls)      │
└──────────────────────┘    └──────────────────────┘

Technology Stack

Frontend

  • Framework: React 18.2.0
  • Language: TypeScript 5.x
  • Build Tool: Vite 5.2.10
  • UI Library: Material-UI (MUI) v5
  • Routing: React Router v6
  • State Management: React Context API
  • HTTP Client: Axios
  • Form Handling: Formik + Yup
  • Styling: Emotion + CSS

Backend

  • Framework: FastAPI 0.110.1
  • Language: Python 3.11+
  • Server: Uvicorn (ASGI)
  • Database Driver: Motor 3.3.1 (Async MongoDB)
  • Authentication: JWT (python-jose)
  • Password Hashing: Passlib with bcrypt
  • AI Integration: emergentintegrations 0.1.0
  • Validation: Pydantic

Database

  • Type: MongoDB Atlas (Cloud)
  • Driver: Motor (Async)
  • Features: Document-based NoSQL

DevOps & Deployment

  • Container: Docker/Kubernetes
  • Process Manager: Supervisor
  • Reverse Proxy: Nginx (Kubernetes Ingress)
  • Environment: Production preview deployment

External Services

  • AI: Google Gemini 2.5 Pro (Text + Vision)
  • Video: Jitsi Meet (Open-source)
  • Cloud DB: MongoDB Atlas

API Architecture

RESTful Endpoints

Authentication

POST   /api/auth/register    - Create new user account
POST   /api/auth/login       - Authenticate user
GET    /api/auth/me          - Get current user info

Users

GET    /api/doctors          - List all doctors
GET    /api/patients         - List all patients (doctors/admins only)
GET    /api/staff            - List staff members (admins only)

Appointments

POST   /api/appointments                    - Book new appointment
GET    /api/appointments                    - Get user's appointments
PATCH  /api/appointments/{id}               - Update appointment status
GET    /api/appointments/{id}/meeting       - Get video meeting link

Medical Records

POST   /api/medical-records                 - Upload medical record
GET    /api/medical-records                 - Get user's records
GET    /api/medical-records/{id}            - Get specific record

AI Services

POST   /api/ai/symptom-checker              - Chat with symptom checker
POST   /api/ai/analyze-report               - Analyze medical report image

Dashboard

GET    /api/dashboard/stats                 - Get role-based statistics

Security Architecture

Authentication Flow

1. User submits credentials (email + password)
   ↓
2. Backend validates credentials
   ↓
3. If valid, generate JWT token with user info
   ↓
4. Return token + user data to frontend
   ↓
5. Frontend stores token in localStorage
   ↓
6. All subsequent requests include token in Authorization header
   ↓
7. Backend validates token on each request
   ↓
8. If valid, process request; if invalid, return 401

JWT Token Structure

{
  "sub": "user@example.com",     // Subject (user email)
  "exp": 1735123456,              // Expiration timestamp
  "iat": 1735120000               // Issued at timestamp
}

Password Security

  • Hashed using bcrypt algorithm
  • Salt automatically generated
  • Never stored in plain text
  • One-way hashing (cannot be reversed)

Role-Based Access Control (RBAC)

# Example permission matrix:
Endpoint                    | Patient | Doctor | Admin
---------------------------|---------|--------|-------
GET /api/doctors          |||POST /api/appointments    |||PATCH /api/appointments   |||GET /api/patients         |||GET /api/staff            |||

💾 Database Schema

MongoDB Collections

1. users Collection

Stores all user accounts (patients, doctors, admins)

{
  "_id": ObjectId("..."),               // MongoDB auto-generated ID
  "email": "doctor@example.com",        // Unique email (login ID)
  "hashed_password": "$2b$12$...",      // Bcrypt hashed password
  "full_name": "Dr. Sarah Chen",        // User's full name
  "role": "doctor",                     // "patient" | "doctor" | "admin"
  "specialization": "Cardiologist",     // Only for doctors
  "created_at": "2025-01-26T10:00:00Z"  // ISO 8601 timestamp
}

Indexes:

  • email (unique)
  • role

Sample Data:

// Patient
{
  "email": "patient1@demo.com",
  "full_name": "Alice Johnson",
  "role": "patient",
  "specialization": null
}

// Doctor
{
  "email": "doctor1@demo.com",
  "full_name": "Dr. Sarah Chen",
  "role": "doctor",
  "specialization": "Cardiologist"
}

// Admin
{
  "email": "admin1@demo.com",
  "full_name": "James Anderson",
  "role": "admin",
  "specialization": null
}

2. appointments Collection

Stores appointment bookings and meeting information

{
  "_id": ObjectId("..."),                           // MongoDB auto-generated ID
  "patient_email": "patient1@demo.com",             // Reference to patient
  "patient_name": "Alice Johnson",                  // Cached for quick display
  "doctor_id": "doctor1@demo.com",                  // Reference to doctor
  "date": "2025-02-15",                             // Appointment date (YYYY-MM-DD)
  "time": "10:00",                                  // Appointment time (HH:MM)
  "reason": "Regular checkup",                      // Patient's reason for visit
  "status": "confirmed",                            // "pending" | "confirmed" | "completed" | "cancelled"
  "meeting_room_id": "uuid-v4-string",              // Unique room ID for video call
  "created_at": "2025-01-26T10:00:00Z",            // When appointment was booked
  "updated_at": "2025-01-26T11:00:00Z"             // Last status update
}

Indexes:

  • patient_email
  • doctor_id
  • status
  • date

Status Workflow:

pending → confirmed → completed
        ↘ cancelled

Sample Data:

{
  "patient_email": "patient1@demo.com",
  "patient_name": "Alice Johnson",
  "doctor_id": "doctor1@demo.com",
  "date": "2025-02-20",
  "time": "14:00",
  "reason": "Follow-up consultation",
  "status": "confirmed",
  "meeting_room_id": "3be4980e-c050-4ecd-8dc7-431e8098cf19",
  "created_at": "2025-01-26T10:00:00Z"
}

3. medical_records Collection

Stores patient medical documents and files

{
  "_id": ObjectId("..."),                           // MongoDB auto-generated ID
  "patient_email": "patient1@demo.com",             // Owner of the record
  "title": "Blood Test Results",                    // Record title
  "description": "Annual health checkup",           // Optional description
  "record_type": "lab_report",                      // "lab_report" | "prescription" | "xray" | "mri" | "other"
  "file_data": "base64-encoded-string",             // File content (base64)
  "file_name": "blood_test_2025.pdf",               // Original filename
  "file_type": "application/pdf",                   // MIME type
  "uploaded_by": "patient1@demo.com",               // Who uploaded it
  "created_at": "2025-01-26T10:00:00Z"             // Upload timestamp
}

Indexes:

  • patient_email
  • record_type
  • created_at

Supported File Types:

  • Images: JPEG, PNG, WEBP
  • Documents: PDF
  • Any file type for storage

Sample Data:

{
  "patient_email": "patient1@demo.com",
  "title": "X-Ray Chest",
  "description": "Post-COVID follow-up",
  "record_type": "xray",
  "file_name": "chest_xray_jan2025.jpg",
  "file_type": "image/jpeg",
  "uploaded_by": "doctor1@demo.com",
  "created_at": "2025-01-26T10:00:00Z"
}

Database Relationships

users (patients)
    ↓ (1:N)
appointments ← (N:1) → users (doctors)
    ↓
meeting_room_id → Jitsi Meet URL

users (patients)
    ↓ (1:N)
medical_records

📚 Technical Documentation

See full technical documentation, setup instructions, and deployment guides in the complete README sections above.

Quick Start

Demo Accounts (Password: demo123)

Patients: patient1-3@demo.com Doctors: doctor1-3@demo.com Admins: admin1-3@demo.com

Access


✅ Finished Works

Core Features (100% Complete)

✅ Multi-role authentication system ✅ User management & dashboards ✅ Complete appointment scheduling ✅ Video consultation with Jitsi ✅ Medical records management ✅ AI symptom checker ✅ AI report analyzer with OCR ✅ Role-based access control ✅ Responsive UI design ✅ Complete backend APIs


🚀 Future Work

High Priority

  • Real-time notifications (WebSocket)
  • Doctor availability calendar
  • Payment integration (Stripe)
  • Email/SMS notifications
  • Prescription management

Medium Priority

  • Advanced search & filters
  • Rating & review system
  • Mobile application
  • Third-party integrations
  • Enhanced analytics

Low Priority

  • Multi-language support
  • Voice-based features
  • Community forums
  • Health challenges
  • Emergency services

⚠️ Unfinished Works

Known Limitations

  • No call recording
  • No email/SMS notifications
  • No payment processing
  • Basic search only
  • No availability calendar
  • No timezone handling
  • No data export
  • No pagination
  • No automated tests
  • Limited accessibility features

See full list in complete documentation above.


🤝 Contributing

We welcome contributions! Please:

  1. Report bugs via issues
  2. Suggest features
  3. Submit pull requests
  4. Improve documentation
  5. Help with testing

📄 License

MIT License


👨‍💻 Authors

Developed with ❤️ by the Dulub Team


Last Updated: January 26, 2025 Version: 1.0.0 Status: Production Ready ✅

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors