Staff Sorting Service Plugin: Sample Flows

This article presents possible use cases and corresponding sample flows that you can support. This can be a helpful jumping off point as you plan your implementation.

Sort staff members based on workload

This example shows how to implement a workload balancing algorithm that distributes bookings evenly across staff. This approach prevents overworking specific staff members, distributes work fairly, and uses simple logic that's easy to understand and maintain. By working entirely from cached data, the algorithm achieves fast performance.

To sort staff members by workload:

  1. When the Sort Staff Members request arrives, retrieve the cached staff member profiles for each resource in availableResourceIds.
  2. Retrieve the cached historical bookings. For example, for the past 30 days for each staff member.
  3. Calculate each staff member's recent booking count from the cached historical data.
  4. Sort the staff members by booking count in ascending order so that staff members with fewer bookings appear first.
  5. For staff members with equal booking counts, sort them alphabetically by name to ensure consistent ordering.
  6. Return the sorted list of resource IDs in the response.
Did this help?