Rules as Code (Part 2)
In part 2, get an insider tour of our own Rules as Code project. You'll learn about what the Canada School of Public Service in collaboration with the Community of Federal Regulators, the Labour Program and the Department of Justice, Government of Canada did over a period of 8 weeks to test Rules as Code, what was learned along the way and what you need to run your own Rules as Code project.
Rules as Code (Part 1)
Learn about what Rules as Code is and the potential benefits it can bring for you.
Date: November 27, 2020
Rules as Code
Part 2 of 2
The discovery project
Hi, I am Scott, and I work at the Canada School of Public Service. Rules as Code is a promising concept and we feel like there is so much to learn on the topic.
To this end, we worked with a community of like-minded partners within the Government of Canada to explore the concept's potential and test how it could be put into practice. I'm excited to share what we learned along the way.
To demonstrate the process of drafting rules into code, we first decided on a regulation to test. Our team used employee entitlements to vacation pay, from sections 12 and 13 of the Canada Labour Standards Regulation.
First, we identified key concepts in the regulation and defined relationships between them, creating a concept model that helped us better understand the rules that we would code.
Next, we created a decision tree, by transforming the regulation into a series of yes or no questions. We worked with subject-matter experts to understand the intent of the regulation. We were then able to show how concepts like medical leave could affect vacation pay.
Finally, our private sector partner programmed the decision tree into computer code. This showed the potential of the exercise. From here, any application can be programmed to automatically connect and use this code… such as this proof of concept, built by our partner, that calculates vacation pay entitlements based on key variables entered.
While the code and prototype would require more work to be ready for deployment, they prove that applications can connect directly to the coded rules. As a result, the rules are more accessible, transparent and easier to maintain.
This just scratches the surface of how we can use encoded rules to offer greater value for Canadians!
Rules as Code – Lessons Learned
The most valuable part of our discovery project was learning as we worked through the process.
1) Best suited to… rulesets that can be quantified …. and that are prescriptive – Subjective rules will still need humans to interpret them
First, rules as code is better suited to rulesets that can be quantified and are prescriptive. Subjective rules - those that contain words like 'may' or 'could', will continue to need humans to read and interpret them.
2) Difficult but rewarding process… Need to understand rule and its intent/Legal interpretation is required/But important for accurate coding
Second, turning rules into computer code is not easy. This project showed the importance of fully understanding the rule and its intent. While clear and unambiguous language is ideal, some rules will require legal interpretation. This makes the process more difficult but it is a critical step to allow programmers to accurately encode the rules.
3) Current processes will need to adapt… Current process involves a limited group of subject-matter experts/lawyer/drafter/service designer/programmer
Finally, to move forward with rules as code, it is clear that current processes to draft rules would need to adapt. The current drafting process involves a limited group of subject matter experts and drafters. Our project showed that an effective way of developing rules is for multi-disciplinary teams of subject matter experts, drafters, service designers and programmers to co-design the rule using a user-centric approach. This brings a diverse range of ideas and perspectives, increases mutual understanding of policy decisions on service delivery and ensures everyone has an understanding of the needs of impacted people and systems.
Rules as Code – Moving Forward
This project allowed us to take an abstract concept and test what it would take to turn rules into code.
There are more questions to investigate – for example, we would be curious to know how rules could be drafted in code while being simultaneously (emphasize) drafted in English and French. We think the benefits of rules as code could be amplified if applied to a new rule.
Wherever we or others take this work, we look forward to continuing this ‘learning by doing' journey toward better rules for all Canadians.
Complete your census today!
Help your community make choices about education, employment, transportation, health care and housing services.
This website is continually being updated in response to your feedback.