Skip to main content
All CollectionsSite Administration
Overview about rules and how to create them
Overview about rules and how to create them

(reference to video 5 in the making)

Suha Aker avatar
Written by Suha Aker
Updated this week

In this article we will provide guidance on how to set up various types of staffing and rostering rules. In particular we will explain how to create and check:

  1. How rules work

  2. How to test rules

  3. Shift conflict rules, that define gaps and separation of specific activities and are applied to specific rosters. Examples are needing a three-day break after being on call, or not working the next day after a night shift.

  4. Shift work rules, that prevents overworking. Examples include not working more than 76 hours per fortnight or not working more than 2 weekends per month.

  5. User conflict rules, that limit certain individuals working together. For instance if two of your users share childcaring duties and therefore cannot be staffed on after-hours shifts on the same day.

  6. Leave conflict rules, that limit the types of shifts that users can do adjacent to leave. For instance, if a user has approved leave from a Monday to prevent that user being staffed on the weekend before leave.

How rules work

In HosPortal all the different rules work in similar ways. But they are applied differently if you are using them to fill rosters manually, using our various self-roster tools.

When you fill a roster manually, they generate an alert and show users as having a conflict on both draft and published shifts if you try to staff anyone that triggers one of the rules. You will normally be shown a conflict icon – an orange triangle alert – and you can mouse-over the alert to find out further details on the rule or rules that would be broken.

As a roster administrator, you can always staff someone in a way that breaks the rules. If you do that, the conflict icon can be shown on the roster. To see the icons on the roster then you need to turn on that option in the view settings.

Note that normal users who do not have permissions to administer the roster cannot see the conflict icons, even if the conflict applies to them and even if the shift is published. Conflicts are only shown to people with permission to edit the relevant shifts.

If you are using our self-roster tools to build a roster but are not using our optional AI Roster Solver, the rules will never be broken when HosPortal builds a roster: our ‘Original’ roster builder will leave shifts vacant rather than break a rule.

If you are using our optional AI Roster Solver to build you rosters you can decide which rules can be broken and how important they are. This allows you to specify to our solver that you would prefer to break a low-priority rule rather than leave a shift vacant.

Generally, most rules do not have time horizons. If you create a new rule you will generate conflicts on any draft or published shift in the past or the future that breaks that rule. If you delete a rule all the conflicts shown on the shifts will disappear immediately.

How to test rules

It is possible to build quite complex and nuanced rules. We recommend that anyone building a rule should test it by using draft shifts or by waiting to the next day to test on our Mirror site.

The best way to test rules is to go to a blank roster, for instance in 6 or 12-months time. Then try to staff a small number of users to test 2 things:

  1. Firstly, if you staff people in a way that should break the rule, do you get an alert in all those circumstances?

  2. Secondly, if you staff someone close to the edge of the rule but in an acceptable way, you want to make sure you do not generate a conflict.

For instance, if you create a rule that says that people cannot do night shifts within 3 days of each other, it is good to test the rule by trying to staff someone on night shifts that are 2, 3 and 4 days apart. You might want to do another test by putting someone on a night shift and staffing them on a shift that is not a night shift on the next day to make sure that does not generate a conflict.

If you are testing rules on our main site and you are not using Mirror then remember to delete the shifts once you are happy with the test.

Shift conflict rules

Shift conflict rules define the interactions between specific shifts or rosters, and allow you to define the separation between those activities. The separation could be as simple as prohibiting two activities that happen at the same time.

On the Admin page, go to Shift Conflict Rules. To create a new rule select ‘+Add’.

If you are creating a complex rule it is often helpful to name it. This name will be shown when you mouse over the conflict icon rather than show you the full details of the rule. A name can also help administrators understand the intent of the rule.

The conflict rules are defined in 5 parts:

  1. The first shift, which can refer to roster groups, rosters, locations, days of the week, tags attached to the roster, or one of HosPortal’s roster types.

  2. The separator or ‘cause of the conflict’, which we will come back to.

  3. The second shift, which can be defined similar to the first shift.

  4. If the rule applies only to certain roles or certain users

  5. Whether locations are considered in the rule. You might use the ‘both locations are different’ option if, for instance, you want a rule that forces someone to be staffed in the same surgical list in both the AM and PM sessions.

There are 6 ways of defining what causes the conflict:

  1. ‘Calendar duration’ considers entire clear days measured midnight to midnight. So someone that has 1 calendar day separation from a shift that finishes on a Monday cannot do any shift on a Tuesday no matter what time the shift finishes on Monday and no matter what time any shift starts on a Tuesday. But the person on the Monday shift can do any shift starting at any time on Wednesday.

  2. ‘Duration’ is a separation between the end of one shift and the start of the next shift, which can be measured in minutes, hours, days, weeks and months. So if the separation is 1 day, someone finishing a shift at 8am on Monday cannot be staffed again until 8am on Tuesday.

  3. ‘Overlapping’ is straightforward: the two shifts can not have any time over which they overlap.

  4. ‘Same day’ looks at the start of the first shift and compares it to either the start or end of the second shift – depending on how you have defined it – to see if they are on the same day.

  5. ‘Next days’ combines a rule similar to the duration rule, with a test triggered by the start or end of the second shift.

  6. Same/next week looks at the calendar week, rather than look at a strict 7-day gap. So if your facility has a working week defined to start on a Monday, as most of our customers do, then someone on a shift on a Wednesday that has a separation defined as the ‘same week’ cannot do a shift at any time from the Monday 2 days earlier to the Sunday night after the shift.

Note that if you choose ‘Calendar duration’ (and only if you choose calendar duration) you are allowed to specify that people can do a number of consecutive shifts in a row before the rule is tested. For instance, you can create a rule that users must have 3 days off after they have done a block of night shifts, but they can do up to 4 nights shifts in a row as a single block before they need the break.

Transition slide: shift work rules

Shift work rules define the maximum number of activities or hours that someone can do over a span of time. We allow that maximum number to be zero if you want, to prohibit any of a type of activity.

Our work rules can be quite sophisticated and consider things such as a user’s FTE status, the approved leave logged in HosPortal and how payroll periods are defined. Unlike other rules, work rules can be defined to apply over specific date ranges. In the rest of this video we cover just the headlines to get started on rules. Please get in touch if you would like to discuss detailed rule constructions that you feel you need.

On the Admin page, go to Shift Work Rules. To create a new rule select ‘+Add’.

Like conflict rules, if you are creating a complex rule it is often helpful to name it. This name will be shown when you mouse over the conflict icon rather than show you the full details of the rule. A name can also help administrators understand the intent of the rule.

Generally, you will be selecting the amount of activity, the units of activity and the time range over which that activity will be tested. For instance, up to 3 days per week. We will go into each of those.

Select the maximum amount of activity and the units. Units like hours and shifts should be self-explanatory. For the others:

  1. A day is any period midnight to midnight that has a shift on it. Someone who does many shifts on the same day still only counts as 1 day.

  2. Consecutive days limits the number of days people can do in a role

  3. Weekdays are days where the shift starts on any day Monday to Friday.

  4. Weekend days are any shift that starts on a Saturday or Sunday. Being on a Saturday shift and a Sunday shift counts as 2 weekend days.

  5. Weekends treats both Saturday and Sunday as a block, so someone on a Saturday shift and working the next day Sunday counts as working 1 weekend.

You can consider a users contracted hours and FTE status to pro-rata work rules. For example, if you create a rule that someone cannot work more than 80 hours per fortnight, then someone with a 0.5 FTE will be limited to 40 hours per fortnight. HosPortal will always round down: where there is a limit of 5 shifts per week, a 0.5FTE will be limited to 2 shifts per week. Talk to your HosPortal team to discuss whether FTE and contracted hours are important for you.

Select the time range over which the rule applies.

You can then filter to the subset of shifts and rosters that the work rule applies to. And the roles or individuals that must comply with the rules.

User conflict rules

User conflict rules are similar to shift conflict rules, but they look at the individuals who are staffed on the shifts, so that if person A is on a certain shift then Person B has some restrictions when they can work. An example might be that Greg House and Jennifer Melfi cannot be on On Call at the same time.

Currently there are only two causes of conflict: the people are working on shifts that start on the same day, or they are working at any times that overlap.

Leave conflict rules

Leave conflict rules are similar to shift conflict rules except that instead of separating two shifts, this separates a shift from any days when a user has approved leave. As an example, we can create a rule that people cannot be on On Call the day before they are on leave.

Did this answer your question?