Skip to main content
Demand is the need for workforce and defines how many employees you need at work at any given time in the planning period. Specifying demands in the payload is done using the Demands property.

Demand schema

object
The Automatic Rostering API allows you to define demand for workforce in two different ways:
  • ShiftDemand allows you to specify demand by stating which shifts you need on which days, and how many people you need working those shifts.
  • TimeDemand allows you to specify demand by stating how many employees you need at different times of day throughout your schedule. The API will then assign shifts to cover the demand at those times.
A request to the Automatic Rostering API should either specify all demand as ShiftDemand, or all demand as TimeDemand. A combination of both is currently not supported.
Choose which type of demand suits your needs, then find below some pointers on how to configure the Demands object for your use case.

ShiftDemand

If you have already configured Shifts in your request, then using these to specify ShiftDemand is very simple. Consider the following example.
The following shows how to specify that on days 1 and 2 you require 2 people to work Shift A and 2 people to work Shift B, while on day 3 you only require 2 people working Shift B.
A ShiftDemand must contain exactly one of shiftId or shifts. Use shiftId when one specific shift must fulfill the demand, like the example above. Use shifts when any shift matching the supplied IDs and labels may fulfill the same demand. Employees assigned across the alternative shifts count toward the same min, ideal, and max levels. When the eligible shifts have different durations, minute-based shortage metrics use the shortest eligible shift duration.
This demand can be fulfilled by any shift with the early label.

Attribute requirements

In principle, all employees assigned to a demand must be compatible with the attribute requirements on that demand. However, it is also possible to specify a minimum number of assigned employees that must be compatible.
The first demand requires all employees to be able to drive. For the second demand, at least one of the assigned employees should be a nurse.

Demand coverage

By default, each assigned shift covers one compatible shift demand. This is equivalent to omitting context.demandCoverageType, or setting it to SINGLE. Set context.demandCoverageType to MULTIPLE when one assignment should cover every shift demand on the same day shift that is compatible with the assigned employee and role. This is useful when several demand lines describe staffing needs that can be fulfilled by the same physical shift. MULTIPLE is only supported for ShiftDemand.

TimeDemand

When demand is defined as the time periods for when employees are needed, the solver assigns employees to the shifts that are able to cover this demand.