Skip to content

Doctor Schedule Service

Overview

The Doctor Schedule Service is responsible for managing provider availability across the VitalBridge platform.

The service determines when providers are available for appointments by combining:

  • Weekly availability templates
  • Schedule overrides
  • Leave requests
  • Appointment blocks

The service acts as the authoritative source for provider availability.


Responsibilities

The Doctor Schedule Service is responsible for:

  • Weekly availability management
  • Availability overrides
  • Provider leave management
  • Slot generation
  • Effective availability calculation
  • Appointment blocking

The service does not manage:

  • Provider profiles
  • Patients
  • Appointments

Service Architecture

flowchart TB

    PROVIDER["Provider"]

    SCHEDULE["Doctor Schedule Service"]

    DB[("Doctor Schedule DB")]

    PROVIDER --> SCHEDULE

    SCHEDULE --> DB
Hold "Alt" / "Option" to enable pan & zoom

Availability Model

flowchart LR

    TEMPLATE["Weekly Template"]

    OVERRIDE["Overrides"]

    LEAVE["Leave Requests"]

    BLOCKS["Appointment Blocks"]

    TEMPLATE --> AVAILABILITY["Effective Availability"]

    OVERRIDE --> AVAILABILITY

    LEAVE --> AVAILABILITY

    BLOCKS --> AVAILABILITY
Hold "Alt" / "Option" to enable pan & zoom

The resulting effective availability is used when generating appointment slots.


Schedule Aggregate

flowchart TB

    SCHEDULE["Provider Schedule"]

    TEMPLATE["Weekly Template"]

    OVERRIDE["Override"]

    LEAVE["Leave"]

    BLOCK["Appointment Block"]

    SCHEDULE --> TEMPLATE
    SCHEDULE --> OVERRIDE
    SCHEDULE --> LEAVE
    SCHEDULE --> BLOCK
Hold "Alt" / "Option" to enable pan & zoom

Slot Generation

flowchart LR

    AVAILABILITY["Effective Availability"]

    RULES["Slot Rules"]

    SLOTS["Available Slots"]

    AVAILABILITY --> RULES

    RULES --> SLOTS
Hold "Alt" / "Option" to enable pan & zoom

Slot generation is performed dynamically rather than storing generated slots.


Appointment Blocking

flowchart LR

    APPT["Appointment Created"]

    BLOCK["Schedule Block"]

    APPT --> BLOCK
Hold "Alt" / "Option" to enable pan & zoom

When appointments are confirmed, the corresponding time window becomes unavailable.


Domain Events

Published Events:

  • provider.schedule.created
  • provider.schedule.updated
  • provider.leave.created
  • provider.leave.cancelled
  • provider.availability.changed

Consumed Events:

  • provider.created
  • appointment.confirmed
  • appointment.cancelled