L
Leaphealth - OSDocs

How Slot Search Works

How the system finds available appointment slots based on doctor schedules, configs, and booking rules.

How Slot Search Works

When a patient or staff member searches for available appointments, the system runs through a multi-step process to find open slots. Understanding this process helps you configure the system to match your hospital's workflow.

The Slot Search Process

Here's what happens behind the scenes when someone searches for available slots:

  1. Load the doctor's schedule — Get their recurring weekly pattern, blocks (leave), and one-time overrides
  2. Apply centre hours — Clip the schedule to the centre's operating hours (a doctor can't have slots when the centre is closed)
  3. Generate time slots — Break the available time into slots based on the slot duration and granularity settings
  4. Add buffer time — Insert gaps between consecutive slots for doctor preparation
  5. Check existing bookings — Remove slots that are already taken (including drafts and pending approvals)
  6. Apply walk-in reservation — If configured, reserve a portion of slots for walk-in patients
  7. Apply patient-type duration — Adjust slot length for new vs existing vs follow-up patients
  8. Apply booking rules — Enforce limits like minimum advance booking, same-day cutoff, and per-patient limits
  9. Return results — Show available slots sorted by time (earliest first by default)

What Affects Search Results

Many configuration settings influence which slots appear. Here's a complete reference:

Slot Generation Settings

Setting

What It Does

Default

Example

Slot Granularity

Time slice size for generating slots

15 minutes

Set to 30: slots start at :00 and :30 only

Min Slot Duration

Shortest allowed appointment

10 minutes

Prevents very short slots from appearing

Buffer Between Slots

Gap after each appointment

5 minutes

Gives doctor prep time between patients

Align to Hour

Force slots to start at hour boundaries

Off

When on, slots only start at :00

Break Handling

How to handle doctor breaks

Exclude overlapping

Removes slots that overlap with break times

Search Range Settings

Setting

What It Does

Default

Example

Default Search Range

How many days ahead to search

7 days

Patient sees next 7 days of availability

Max Search Range

Maximum days a patient can look ahead

90 days

Limits how far in advance someone can browse

Max Results

Maximum slots returned per search

100

Prevents overwhelming results on busy days

Sort Order

How results are sorted

Earliest first

Shows closest available slots first

Include Fully Booked

Show slots that are full

Off

When on, shows booked slots as 'unavailable'

Capacity & Walk-in Settings

Setting

What It Does

Default

Example

Default Capacity Per Slot

How many patients per slot

1

Set to 3: doctor can see 3 patients in the same time window

Overbooking

Allow booking beyond capacity

Off

When on with 10%, a slot with capacity 10 allows 11

Walk-in Reserve Strategy

How to reserve slots for walk-ins

None

PERCENTAGE: reserve 20% for walk-ins

Walk-in Reserve %

Percentage of slots reserved

0%

20%: 4 out of 20 slots reserved for walk-ins

Apply to Online Only

Only apply walk-in reserve to online bookings

Yes

Walk-in reserve doesn't affect staff-initiated bookings

Booking Rule Settings

Setting

What It Does

Default

Example

Min Advance Booking

How far ahead patients must book

1 hour

Set to 2: can't book less than 2 hours from now

Max Advance Booking

How far ahead patients can book

90 days

Set to 30: can only book up to 30 days ahead

Same-Day Booking

Allow bookings for today

Yes

Turn off to require at least 1 day notice

Same-Day Cutoff

Hours before slot for same-day booking

2 hours

Can't book a 3 PM slot after 1 PM

Max Per Patient Per Day

Patient's daily booking limit

3

Prevents one patient from booking too many slots

Max Per Patient Per Doctor Per Day

Same patient-doctor daily limit

1

Patient can't book twice with the same doctor on the same day

Patient-Type Duration Settings

Setting

What It Does

Default

Example

New Patient Extra Time

Additional minutes for first-time patients

0 minutes

Set to 10: new patients get 25-minute slots instead of 15

Existing Patient Extra Time

Additional minutes for returning patients

0 minutes

Usually kept at 0 (standard duration)

Follow-Up Extra Time

Additional minutes for follow-ups

0 minutes

Set to -5: follow-ups are shorter than standard

Test Your Settings

After changing any of these settings, do a test slot search to see how the results change. Small tweaks can significantly affect how many slots appear.

Config Hierarchy for Slot Settings

Most slot settings can be configured at multiple levels. The most specific level wins:

  1. System defaults — Built-in base values
  2. Tenant settings — Your hospital-wide configuration
  3. Centre settings — Per-location overrides
  4. Doctor settings — Per-doctor overrides (highest priority)

For example, if the hospital default slot duration is 15 minutes but Dr. Patel needs 30 minutes, you set it at the doctor level. Everyone else keeps 15.

See Config Hierarchy

For a detailed explanation of how settings cascade, see the Config Hierarchy page.

What's Next?

Understand the end-to-end booking process in Booking an Appointment.

slotssearchavailabilityslot-engineconfiguration

Last updated on

On this page