5 November 2021
Phillipa Martin

What is Rules As Code?

Rules As Code (RaC) is the process of taking legislation, regulations and policies and turning them into machine-readable code so they can be understood and interpreted by computers. The encoded legislation exists alongside the natural language version (it does not replace it) to facilitate digital service delivery.

Why Rules As Code?

Turning rules into machine-readable code provides many benefits for government, citizens and broader society. RaC helps to reduce ambiguity, reduces the difficulty of interpretation and therefore makes it easier for citizens and organisations to comply with the rules. Importantly, it also leads to greater transparency in rules.

Turning legislation into code can also identify gaps and inconsistencies in the original legislation.

For a full list of benefits, see the OECD’s Cracking the code: Rulemaking for humans and machinesExternal Link (p.39 includes a benefits table).

What type of legislation can be coded?

In general, rules (legislation, regulation or policy) that are prescriptive rather than discretionary are best suited for coding. However, it’s worth mentioning that the New Zealand Service Innovation lab foundExternal Link that discretionary rules can be written in code too.

In terms of focus, because the process of transforming existing legislation into code can be complex and time consuming, focusing on rules that can reduce the burden on citizens, create service efficiencies or automate processes will have the most immediate impact.

When to code rules?

While most rules will be coded after the legislation is written, writing RaC alongside the written legislation (i.e. at the same time) is the most efficient approach and can significantly improve the quality of the written legislation.

Who’s using Rules As Code?

Many governments around the world are exploring and implementing RaC — although it’s still definitely an emerging field.

France was an early adopter, creating the open source OpenFiscaExternal Link platform that can be used to support and create RaC. See our insight What is OpenFisca? for more information.

New Zealand and CanadaExternal Link are also active in this space. Rules As Code is part of NZ’s Better Rules programExternal Link , which brings a new approach to policy and legislation. RaC was also used in creating NZ’s SmartStartExternal Link , a portal for NZ parents that includes birth registration.

An example here in Australia is the NSW Government. NSW has created a digital version of the Community Gaming Regulation 2020External Link and has also produced assets on RaC, including:

Rules As Code and the Observatory of Public Sector Innovation (OPSI)

The OPSI has a dedicated emerging tech project focused on rules as codeExternal Link . One of the outcomes of that project was OPSI’s report Cracking the CodeExternal Link . The report provides an introduction to RaC, including benefits, use cases, the effort involved, and general advice and guidelines.

It’s an extensive report at over 100 pages, and the OPSI does provide a shorter 16-page report, Cracking the Code HighlightsExternal Link .

Case studies

RaC is an emerging field and it’s currently being used in several projects and jurisdictions. Case studies include:

  • GovZero Aotearoa (New Zealand)
  • Fair Trading New South Wales (Australia)
  • Mes Aides (My Helpers) — Entitlements eligibility simulator (France)
  • Lex Impact — Policy difference engine (France)
  • Les meves ajudes (My Aides) — Entitlements eligibility simulator (Spain)
  • Rapu Ture — Exploring the Rules (New Zealand)

For more information on these case studies, please see our insight, What is OpenFisca?