Skip to content

rizwanullah-dev/Appointment-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Healthcare Ecosystem — SaaS Appointment & Diagnostic Management System

Node.js Version React Version Docker Compose License

An enterprise-grade, multi-tenant SaaS healthcare platform connecting patients, medical practitioners, diagnostics laboratories, and local pharmacies. Built on the MERN stack with selective microservice separation, the system features AI-powered prescription parsing (OCR), virtual telemedicine consultations, voice-activated booking channels, and automated patient reminder networks.


🏗️ Technical Architecture & Ecosystem

The system consists of three web portals (Patient, Doctor, Admin) communicating with a monolithic Node.js/Express API, integrated with a Python drug-import migration pipeline and multiple external communication/AI services.

graph TD
    %% Portals
    subgraph Client Portals [Client Web Applications]
        A[Patient React Portal]
        B[Doctor React Portal]
        C[Admin Management Portal]
    end

    %% Routing / Load Balancer
    D[Nginx Gateway / Reverse Proxy]
    
    %% Backend Services
    subgraph API Services [Core Application Tier]
        E[Express.js Web Server]
        F[Python Drug-Import Script]
    end
    
    %% Databases
    subgraph Databases [Persistent Storage]
        G[(MongoDB Primary DB)]
        H[(Redis Queue & Cache)]
    end

    %% External Services
    subgraph Integration Tier [External Services Integrations]
        I[Cloudinary CDN]
        J[Twilio SMS Gateway]
        K[Gemini & Groq AI Engines]
        L[Vapi.ai Telephony Webhook]
        M[Jitsi WebRTC SDK]
    end

    %% Connections
    A & B & C -->|HTTP / HTTPS| D
    D -->|Route Proxy| E
    F -->|Bulk Seed| G
    E -->|Mongoose ODM| G
    E -->|Caching / BullMQ| H
    
    %% Integrations links
    E -->|Upload Prescriptions| I
    E -->|Outbound Reminders| J
    E -->|OCR & Translation| K
    E -->|Voice Assistant Booking| L
    A & B -->|WebRTC Sessions| M

    style Client Portals fill:#f5f7ff,stroke:#5c76ff,stroke-width:2px;
    style API Services fill:#fffbf5,stroke:#ff9d00,stroke-width:2px;
    style Databases fill:#fff0f0,stroke:#da1e28,stroke-width:2px;
Loading

🌟 Core Features & Integrations

  1. Multi-Role Authentication: Dedicated JWT namespaces and authentication tokens (utoken, dtoken, atoken) securing patient, doctor, and administrator views.
  2. AI Prescription OCR: Automated OCR prescription reading using Google Gemini and Groq (with automatic fallback routing). Extracts compositions, dosages, and maps them to active pharmacy inventory.
  3. Telehealth / Telemedicine: Embedded WebRTC audio-video consultations powered by @jitsi/react-sdk directly inside doctor and patient portals.
  4. Voice Booking Gateway: Integration with Vapi.ai webhook nodes to allow patients to book appointments over phone calls via an interactive AI agent.
  5. e-Pharmacy & Diagnostics: Fully functioning pharmacy shopping cart, checkout pipeline, and laboratory/radiology slot reservation management.
  6. Automated Reminders: Secured /api/cron/reminders endpoint triggered by external cron triggers, sending SMS (Twilio) and email alerts to reduce clinic no-show rates.

📁 Repository Structure

├── admin/                      # React 19 + Vite Admin & Doctor Dashboard
├── backend/                    # Node.js + Express API Backend service
│   ├── api/                    # Serverless routing wrappers
│   ├── config/                 # Mongoose database & Cloudinary configurations
│   ├── controllers/            # Controller logic (Auth, Bookings, AI, Pharmacy)
│   ├── middleware/             # Role verification & file upload middlewares
│   ├── models/                 # Mongoose Schemas (User, Doctor, Appointment, Medicine)
│   ├── routes/                 # Express API routes
│   └── services/               # Reusable business logic services (e.g., appointment booking)
├── frontend/                   # React 19 + Vite Patient Portal
├── drug-data-service/          # Python pipeline for bulk importing drug datasets
│   └── bulk_import.py          # Pandas-based MongoDB bulk upsert migration script
├── docker-compose.yml          # Container configuration for local orchestration
├── nginx.conf                  # Gateway proxy routing configuration
└── package.json                # Monorepo workspaces definition

🚀 Quick Start & Installation

You can spin up the entire application stack using Docker Compose, or run the components manually in a development environment.

Option A: Running with Docker Compose (Recommended)

Make sure you have Docker and Docker Compose installed on your machine.

  1. Clone the repository:
    git clone https://github.com/your-username/appointment-management-system.git
    cd appointment-management-system
  2. Configure Environment Variables: Create a .env file inside the backend/ directory and populate it with your API keys (see Environment Configuration).
  3. Spin up the stack:
    docker-compose up -d --build
  4. Access the Portals:
    • Patient Portal: http://localhost:3000
    • Admin & Doctor Dashboard: http://localhost:3001
    • API Backend: http://localhost:4000

Option B: Manual Installation

  1. Install dependencies across the monorepo: From the root directory, run:
    npm run install-all
  2. Import Medicine Dataset (Optional): Navigate to the drug-data-service folder, configure a Python virtual environment, and run the ingestion script:
    cd drug-data-service
    python -m venv venv
    source venv/bin/activate  # On Windows use: venv\Scripts\activate
    pip install pandas pymongo tqdm python-dotenv
    python bulk_import.py
  3. Start the Backend server:
    cd ../backend
    npm run server
  4. Start the Patient Frontend portal:
    cd ../frontend
    npm run dev
  5. Start the Admin/Doctor Dashboard portal:
    cd ../admin
    npm run dev

🔑 Environment Configuration

Create a .env file inside the backend/ directory with the following variables:

# Server Config
PORT=4000
MONGODB_URI=mongodb://localhost:27017/Appointment_Management_System

# Security
JWT_SECRET=your_jwt_signing_secret_key
ADMIN_EMAIL=admin@smarthealth.com
ADMIN_PASSWORD=your_secure_admin_password
CRON_SECRET=your_reminder_cron_secret_token

# Cloudinary
CLOUDINARY_CLOUD_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_cloudinary_key
CLOUDINARY_API_SECRET=your_cloudinary_secret

# AI API Keys
GEMINI_API_KEY=your_gemini_api_key
GROQ_API_KEY=your_groq_api_key

# Twilio (SMS Reminders)
TWILIO_ACCOUNT_SID=your_twilio_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE_NUMBER=your_twilio_phone_number

🛠️ Testing & Verification

The test suite includes unit, integration, and end-to-end API tests.

# Run backend tests
cd backend
npm run test

See our Testing Strategy Document for full details on our QA methodologies, manual test plans, and synthetic performance testing targets.


📄 License

This project is licensed under the MIT License. See LICENSE for details.

About

An enterprise-grade, multi-tenant SaaS healthcare platform connecting patients, doctors, labs, and pharmacies. Features AI-powered prescription OCR (Gemini), WebRTC tele-consultations (Jitsi SDK), voice-activated booking (Vapi.ai), and automated reminders (Twilio). Fully containerized (Docker) with automated GitHub Actions CI/CD.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors