This important work started when looking at Rules as Code as part of the Lab’s reusable components workstream. The team soon realised there was a systemic issue that other agencies were interested in exploring how to ensure government rules could be accurately delivered as Rules as Code without creating yet another siloed version of the rules (which is essentially what happened with the coded legislation behind the SmartStart financial help tool).
What are Better Rules and Rules as Code (aka Legislation as Code)?
Imagine if the creation and implementation of government ‘rules’ (i.e. legislation, regulation, policy) was multidisciplinary, more open, participatory and robust. What if these rules were unambiguous, and understandable and usable by both people and digital government services from the day they are enacted?
Better still, what if the wording and logic of the rules was drafted by a multidisciplinary and multi stakeholder team to better capture what the government really intended when creating or amending rules?
The practice of making business rules directly available to digital systems as software code has been around for decades, e.g. for tax calculator tools on the IRD website, or internal business systems within government departments.
This approach can be thought of as Rules as Code. This is usually done after the rules have already been written and requires a reinterpretation of the rules by service delivery people and software developers. This has proved a risky approach where implementation by government and non-government organisations are out-of-step with either the intent or the actual rules.
What is new is testing the implementation logic and service design impacts alongside the policy development process, utilising approaches from other disciplines such as human centred design and test-driven software development. This opening up of the drafting process to include other ways of thinking and testing the rules has been coined ‘Better Rules’.
The benefits of this approach
Not only does it make the Rules of government accessible to all people and agencies to use and to be easily updated from a single authoritative source, but it represents a fundamental shift in how we draft government rules. It brings multi-disciplinary teams together to look at what’s proposed in a Bill or Amendment: People from policy and operations, software developers and those working on the delivery side: working together to virtually model and test the draft rules, using real data and likely scenarios, to ensure the rules are implementable and more likely to achieve the intended outcome. This represents a real sea change for governments, allowing simultaneously for more complex and more comprehensible rules that can better adapt to edge cases. This is not only about harnessing the speedier benefits of digital. There’s less risk of misinterpretation. It means more issues and errors are identified before the legislation is passed through the rapid iteration of the rulesets during their development. The approach is also more democratic, supporting open, transparent government and enabling NGOs, communities, social enterprises and the private sector to be part of the government services ecosystem.
The Better Rules work began early 2018 as a collaboration with Inland Revenue, the Ministry of Business, Innovation and Employment, the Parliamentary Counsel Office and a private software company, to explore the digital transformation of legislation and policy (including machine readable Legislation as Code).
The Lab provided the environment and led the design process. In parallel, the Lab was also working on it’s first implementations of legislation as code to create digital services to help people to understand their eligibility for government financial help when they started a family (SmartStart), or were a low income homeowner (Rates Rebate). The work generated much interest across Government, local councils, the D7 (now the Digital Nations), the New Zealand Law Foundation, World Bank, World Trade Organisation, European Commission, OECD, and the UN Develop Programme. It led to the development of a Legislation as Code reusable component in the Lab which is currently used for three life event services.
A Demonstrator and growing world interest
At the end of 2018, the Lab collaborated with counterparts in Israel and Uruguay to build a small Legislation as Code demonstrator to explain the concept using pension eligibility as the example. This was shown to the D7 (now Digital Nations) Ministerial Summit in Israel.
Global interest in the Better Rules and Rules as code approaches accelerated after the OECD’s Observatory for Public Sector Innovation selected the Better Rules approach from over 500 public sector innovation case studies to be included in the Embracing Innovation in Government Global Trends Report 2019. The Governments of New South Wales, Canada and the US have since conducted their own Better Rules and Rules as Code experiments.
In September 2018 a global Better Rules online discussion forum was launched. Lively discussion is ongoing in this forum as well as on Twitter (
#betterrules) and LinkedIn (
By 2019, Better Rules had become its own programme led by MBIE and supported by the Lab.
The OECD released a draft rules as code primer in May 2020 as a way to collate everything that is currently understood about Better Rules and rules as code at this time
Exploring the Better Rules approach with review of the ACC Act 2001
The Lab facilitated a Discovery workshop over several weeks with the Accident Compensation Corporation and MBIE who wanted to improve the coherence of the eligibility criteria in the ACC Act. This was not an opportunity to re-write this section of the Act, rather to make it more usable by ACC and the public.
They were interested in seeing if there is advantage in applying the Better Rules approach. The workshop involved policy, operational and legislative specialists, service design and software developers. ACC concluded the approach was valuable and was written up in the following report: ACC Discovery Report
In November 2019, the OECD’s Observatory for Public Sector Innovation began work on a new Innovation Primer focused on Rules as Code, stating:
“Rules as Code presents a new approach to designing rules for human and machine consumption’… it ‘involves rethinking a core function of government and reinventing it for compatibility with our digital age’…. ‘if government is to be truly responsive, transparent and effective, then Rules as Code could be an important part of making this a reality’.”
“The team working to drive New Zealand’s Government into the digital age believes that part of the problem is the way that laws themselves are written. Earlier this year, over a three-week experiment, they tested the theory by rewriting legislation itself as software code.
“Their work is turning heads: upon seeing a presentation by the team at Digital Nations Summit in February, Estonia’s Chief Information Officer Siim Sikkut described legislation-as-code as “the most transformative idea’ to come from it. It could be key to creating more and better digital services, and laying the groundwork for the safe use of artificial intelligence in the public sector…”
Recent exploration of the Better Rules approach
Wellington Council District Plan Discovery (RuBRIC)
A Wellington City Council team has developed a pilot project looking at how to incorporate Better Rules methodologies along with rules as code into the review of its District Plan. It is starting with a rules as code implementation of part of the existing District Plan to help people through the resource consent process.
The New Zealand Law Foundation late in 2018 funded a 9-month project described as“examining the legal, social, constitutional and democratic implications of converting, drafting and consuming legislation in machine-readable computer languages, commonly known as code.”
This project is using Better Rules methodologies to identify and collate practices from government payroll practitioners to understand the potential impacts of new legislation.
Ministry for Primary Industries - development of new legislation
MPI is exploring the Better Rules approach for new legislation around food safety. The multi-disciplinary team would see the potential rules tested from policy intent through to service design/application considerations and the Rules as Code aspect would help ensure the rules were conceptually and logically sound and implementable.
- Draft Rules as Code primer, OECD (May 2020)
- A rules-as-code case study from New Zealand (May 2020)
- The State of Rules as Code in the Government of Canada (May 2020)
- Rapid implementation of policy as code (May 2020)
- GovInsider: Four things you should know about rules as code (March 2020)
- Better Rules and Rules as Code - references collated list of sources for the European Union (February 2020)
- When we code the rules on which our society runs, we can create better results and new opportunities for the public and regulators, and companies looking to make compliance easier (October 2019)
- ACC Better Rules Collaboration report summary (July 2019)
- Rules as Code – NSW Joins the Worldwide Movement to Make Better Rules (January 2019)
- OECD Global Trends in Public Sector Innovation 2019 (Feb 2019)
- Better Rules international forum (launched September 2018)
- New Zealand explores machine-readable laws to transform government (May 2018)
- Better Rules Hack - Wellington (June 2018)
- Better Rules: a policy advisor’s perspective (April 2018)
- Better Rules Discovery Report (April 2018)
Work completed using Legislation as Code
Our rules can be viewed at https://www.rules.nz/
Birth of a Child (or welcoming a child into your whanau). Encoding entitlements related to the birth of a child (or welcoming a child into your whanau) into re-usable open legislation as code. This component was then used within Smart Start - financial help. Child related entitlements encoded
Social Security Act 2018
- Accommodation Supplement
- Childcare Subsidy
- Child Disability Allowance
- Community Services Card
- Home Help
- Job Seeker Support
- Orphan’s Benefit
- Sole Parent Support
- Supported Living Payment
- Unsupported Child
- Young Parent Payment
New Zealand Superannuation and Retirement Income Act 2001
Income Tax Act 2007
- Working for Families (various)
- Best Start
Parental Leave and Employment Protection Act 1987
- Paid Parental Leave
Citizenship by Grant
A complex formula from within the Citizenship Act, used to calculate if an applicant has been in the country enough days to satisfy a clause. This was encoded into a rules engine called OpenFisca, along with some related sections of Immigration Act.
With ACC and MBIE we explored the entitlement clauses in the Accident Compensation Act to see where discretion is applied, then looked to see how these could be encoded. The sections related to Loss of Potential Earnings, and Rehabilitation were encoded into Open Fisca.
Conference talk at Pycon 2019 in Sydney Australia
Brenda Wallace describes Legislation as code.