Week 50 — Reflections on Rules as Code

Simplicity and Complexity

As I prepare for a trip to Montreal and Toronto next week to present on the Demonstration Projects, I am reminded about the part of travel I do not like at all: the HRG travel system. For those who have used the system, you know exactly what I am talking about. For those who have not used the system, consider yourself lucky. Between a multiple city trip, another Department paying for the trip and having to sort out multiple flights, it was a messy trip to book and after a few hours I gave in and just called the HRG help desk. I’ve looked at old travel claims and noted the service fees attached to each booking. The service fee for an online booking is significantly lower than the service fee for a booking done over the phone. While it is reasonable to assume the cost of a help desk/phone booking is much higher than online booking it still calls into question whether there is incentive to create a seamless intuitive online booking process when you stand to profit from over the phone bookings. Is it time to put on my tinfoil hat?

The past few weeknotes I have been sharing lessons learned that have emerged as part of the Regulatory AI projects. Today, I wanted to focus more on our Rules as Code Discovery Project. I haven’t forgotten about my promise to share more about our future planned work but Jason Morris shared a great post a few days ago about running a Rules as Code process at the same time as ours in order to compare results and share learning in the open. Go read his blog post because it is awesome.

The Rules as Code Process

I shared the process so far last week. We are looking at Sections 12 and 13 of the Canada Labour Standards Regulations and occasionally referring to the Canada Labour Code (various divisions and sections as needed). Our process started with identifying the key concepts in the regulation. We covered a variety of terms (list here is not exhaustive) like:

  • employee
  • employer
  • vacation
  • vacation pay
  • reference period
  • year of employment
  • date of hiring
  • anniversary date
  • length of service
  • end of employment date
  • termination

After making a list of all the concepts, we started to define the relationship between the concepts. For example:

  • Employee → Has a → Date of Hiring
  • Employee → is entitled to → vacation pay

Next, we started to work out the decision/logic model of the regulations. More specifically what were the key questions to ask in order to make a determination of what vacation pay an employee is eligible for. Here are the considerations we had:

  • The primary question asked from both employees and employers is “Do I have to pay/am I entitled to vacation pay? If so, how much? This framed our focus for this discovery project on how much vacation pay an employee is entitled to rather than the obligations the regulations discuss (e.g. notification in writing of vacation).
  • We are focusing only on vacation pay and not answering how much “vacation time” an employee is entitled to. While an employee may opt to use their vacation for paid time off, we aren’t concerned with returning a result that is time based rather focusing on putting forward a monetary estimate of what vacation is worth.
  • Vacation period and vacation are both mentioned in the regulations and the Act. We understand vacation period as the “time off” if the employee decides to take time off whereas vacation is the total entitlement (which can be seen as either a lump sum, spread out and can be monetary or time based)
  • When calculating the vacation pay entitlement, there are a number of constraining factors which can alter the calculation. One in particular which came up was “protected forms of leave” which are defined primarily in Division VII of the Canada Labour Code. In particular, our subject matter experts say that most questions have to do with medical leave. E.g. “My employee has worked for me for 7 months but has been off on medical leave for 2 months, what do I owe her in vacation pay?”
  • Under Division VII of the Canada Labour Code, it specifically states that employees are entitled to “17 weeks” of medical leave without losing “seniority” and “other benefits”. We have understood this to mean that your accumulation of service to an employer continues as long as you have been on medical leave for a period of 17 continuous weeks or less. If you have been on medical leave for a period of 17 continuous weeks or more, then we need to subtract each week above 17 when doing the vacation pay calculation.
  • Continuous is a deliberate word we are using in this context. An employee can return to work for one day (or more) and the 17 week maximum in the Canada Labour Code would “reset”.

We refined our concept model, added in a few parking lot notes and further developed our decision and logic model based on these observations and considerations. Here is an updated version with some of our parking lot items identified. I’ll share the decision model next week once it is converted into a digital format.

At the end of the last session one of the drafters participating in the project pulled me aside. He mentioned that the vacation pay regulations appeared simple on the surface but the gap between the regulations and service delivery is large. The example of medical leave illustrates this gap perfectly. The regulations say nothing about how an employees vacation pay is impacted by taking a protected form of leave and yet it is an important part of the calculation. Rules as Code helps us prove, if nothing else, that there are gaps in the drafting of our rules. Unpacking our rules, logically thinking through concepts, relationships between concepts and the decisions that need to be made can uncover implementation gaps. In a translation of a rule to code (what we are doing) there is limited opportunity to correct deficiencies. However, this work is proving out the concept of Better Rules where we start with this kind of work in the drafting room so we can draft more through and more comprehensive rules that are responsive to the situations often encountered by those who are subject to rules.

AI Demonstrator Projects (Incorporation by Reference, Regulatory Evaluation Platform, Rules as Code)

Regulatory Evaluation Platform: We are finalizing the scope for the next phase of this project. In the meantime, we are trying to finalize the contract to do a “Peer Review” of the system which would represent the first ever peer review of an AI system in the Government of Canada. We aren’t sure how the peer review will play out but we are excited to bring some rigour to the development of an AI system.

Incorporation by Reference: The prototype for this project is under testing. We will be measuring its accuracy and whether the reduction in manual labour facilitated by this tool reaches the levels we want it to/as promised.

Rules as Code: See above

Future Demonstration Projects: Next week I promise to talk more about the future work we have planned.

With that, week 50 is done. I hope everyone has a good week.




Working on public sector innovation one problem at a time. Found biking and hiking on weekends. Father of young baby… what is sleep?

Love podcasts or audiobooks? Learn on the go with our new app.

Your guide to personal and professional development

Finding A Remote Job? Learn How to Get One!

Why LinkedIn matters: 7 reasons for your current profile making

Should Content Based Internships Always Be Paid?

If You Don’t Adapt, the Job Market Is Going to Pass You By Unless!

Here Are The Best Podcasts For The Life-Long Learner

How to Showcase the Value You can Bring to a [Tech] Company as You Career Switch

Turning the ‘Dreaded Churn’ into a Learning Experience…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Scott McNaughton

Scott McNaughton

Working on public sector innovation one problem at a time. Found biking and hiking on weekends. Father of young baby… what is sleep?

More from Medium

What is Middleware and IOC ?

CS371p Spring 2022 Week 14: Mueed Ahmad

Jest-playwright integration with Qase.

CS373 Spring 2022: Week 7 Ting-Yin Chang Chien