L
Leaphealth - OSDocs

Service Configuration

Service flags, centre-service overrides, doctor-service overrides, and how slot duration is resolved.

Service Configuration

Services represent the medical offerings at your hospital (consultations, tests, procedures). Each service has base settings that can be overridden at the centre and doctor levels.

Three Levels of Service Settings

Service settings exist at three levels: base service flags, centre-service overrides, and doctor-service overrides. The most specific level wins.

Base Service Flags

Every service has these base settings that define its fundamental behavior:

{  "requires_doctor": true,  "requires_referral": false,  "requires_prior_appointment": false,  "default_duration_minutes": 15,  "fasting_required": false,  "fasting_hours": null,  "is_active": true,  "display_order": 1,  "metadata": {}}

Field

Type

Default

What It Does

requires_doctor

boolean

true

Whether a doctor must be assigned for this service

requires_referral

boolean

false

Whether a referral is needed to book this service

requires_prior_appointment

boolean

false

Whether a previous appointment is required first

default_duration_minutes

number

15

Base slot duration for this service

fasting_required

boolean

false

Whether patient must fast before this service

fasting_hours

number or null

null

Required fasting duration in hours

is_active

boolean

true

Whether this service is currently available

display_order

number

-

Sorting order in service lists

metadata

object

{}

Additional custom data for the service

Centre-Service Overrides

When a service is assigned to a centre, the centre can override specific settings. These take priority over the base service flags:

{  "is_available": true,  "custom_duration_minutes": 20,  "custom_price": 150000,  "operating_hours": [    {      "day": 1,      "is_open": true,      "times": [        {          "start": "09:00",          "end": "13:00"        }      ]    },    {      "day": 2,      "is_open": true,      "times": [        {          "start": "09:00",          "end": "13:00"        }      ]    }  ],  "slots_per_hour": 3,  "slot_duration_minutes": 20,  "max_per_day": 30,  "overbooking_allowed": false,  "overbooking_percentage": 0,  "walk_in_enabled": false,  "walk_in_slot_strategy": null,  "walk_in_reserve_strategy": null,  "walk_in_reserve_percentage": 0,  "walk_in_reserve_count": 0,  "resources_required": [    {      "type": "CONSULTATION_ROOM",      "count": 1    }  ]}

Centre-Service Fields

Field

Type

Default

What It Does

is_available

boolean

-

Whether this service is offered at this centre

custom_duration_minutes

number or null

null

Override the service's default duration

custom_price

number or null (paise)

null

Override the service price at this centre

operating_hours

array or null

null

Specific hours when this service is available (same format as centre working hours)

slots_per_hour

number or null

null

Override how many slots to generate per hour

slot_duration_minutes

number or null

null

Override individual slot length

max_per_day

number or null

null

Maximum appointments for this service per day

overbooking_allowed

boolean

false

Allow overbooking for this service at this centre

overbooking_percentage

number

0

Maximum overbooking percentage

walk_in_enabled

boolean

false

Accept walk-in patients for this service

resources_required

array

[]

Physical resources needed (rooms, equipment)

Resources Required Structure

[  {    "type": "CONSULTATION_ROOM",    "count": 1  },  {    "type": "ECG_MACHINE",    "count": 1  }]

Field

Type

What It Does

type

string

Resource type code (from tenant resource_types registry)

count

number

How many of this resource are needed per appointment

Doctor-Service Overrides

When a doctor provides a specific service, they can have their own overrides:

{  "custom_duration_minutes": 25,  "custom_fee": 75000,  "is_active": true}

Field

Type

What It Does

custom_duration_minutes

number or null

Override slot duration for this doctor-service combination

custom_fee

number or null (paise)

Override the fee when this doctor performs this service

is_active

boolean

Whether this doctor currently offers this service

Slot Duration Resolution Chain

When the system calculates slot duration, it checks these levels in order (first non-null wins):

  1. Doctor-Service: custom_duration_minutes on the doctor-service record
  2. Centre-Service: custom_duration_minutes on the centre-service record
  3. Doctor Config: slot_duration_minutes in the doctor's config
  4. Base Service: default_duration_minutes on the service (default: 15)
  5. System Default: 15 minutes (hardcoded fallback)

What's Next

  • Doctor Configuration — Doctor-level slot and fee overrides
  • Walk-In Configuration — Walk-in settings across all levels
  • Config Hierarchy — How all these levels merge together
serviceconfigurationdurationoverrides

Last updated on

On this page