Emerging Technology Guide: Rules as Code

Also known as:  

Legislation as Code, Digital Legislation, RegTech, Regulation-as-a-Platform


Scale from New to Depreciated illustrating that Rules as Code is currently at the 'new' stage.


The process of translating rules in legislation, regulation, policy into code so they can be consumed and interpreted by computers.  

Why code rules? 

Our society runs on rules set out in legislation, regulation and policy. However, these rules are often complicated, and difficult for people to understand. 

If we enable software and systems to understand those rules – by coding them – we can make government easier for people and businesses. 

  • Coded rules could help users understand the rules (for example, by enabling eligibility checkers and calculators to help people understand what the rules mean for them) 
  • Coded rules could enable automated or semi-automated administrative decision-making processes (for example, application forms and processing of applications) 
  • Coding rules could make legal compliance easier (for example, by enabling regulated organisations to build business systems that draw on coded rules to automate compliance) 
  • Policy makers could use coded rules to quickly and effectively model the outcome of proposed legislative or policy reforms using data and automated scenario testing.  

Rules engine 

Many Rules as Code projects are based on the concept of a ‘rules engine’ or ‘logic engine’ – a piece of software that holds coded rules, and makes them available for use through an Application Programming Interface (API).  

This has several advantages. For example: 

  • Supports multiple services using a single set of rules. This enables consistency and ease of updates – if you amend the rules in the rules engine, all the linked services will be updated. 
  • Enable seamless and integrated services. For example, if rebate eligibility rules are coded and made available via an API, a digital application form to enable parents to enrol their children in school could check the rules to see if parents are eligible for rebates, and use the information from the form to pre-fill the rebate application.  
  • Reduced compliance costs. Deloitte Access Economics estimates that Australian federal, state and local government rules and regulations cost $27 billion a year to administer, and $67 billion a year to comply with (December 2018). A regulator could code its rules into its rules engine and use them to build a calculator to help people and businesses assess their compliance with the rules. A regulated organisation could also integrate the rules into its own business systems by connecting to the rules engine. 
    • Regulated organisations would not have to spend resources coding the rules themselves and would have the confidence that the rules they are using are correct.  
    • The regulator would be able to see the regulated organisation using its rules (and therefore complying with them).  
    • The business systems could document compliance, making audit and assurance easier.  
    • If the rules change, the linked systems would automatically update, improving compliance and saving on system update costs.  

Rule engine concept 

Illustration of how rules get turned into machine readable code that then re-usable by external agencies.

Current government use cases  

NSW: The NSW Department of Customer Service is currently experimenting with Rules as Code. This is a collaboration between the Policy Lab and the Digital NSW Accelerator. This project has been experimenting with OpenFisca, an open-source platform developed by the French government.  

Australia: CSIRO Data61 Australia is developing a logic system to turn human-readable text into machine-readable code. 

Australia: The Australasian Legal Information Institute (Austlii) has built a rule-base legal inferencing platform called DataLex. They have built a proof-of-concept chatbot that interprets s44 of Australia’s Constitution and can answer questions on whether a person is eligible to stand for Parliament.  

New Zealand: SmartStart – This website provides information about government and other services that new parents need when they have a baby, from the point of conception to 6 months after birth. Amongst other things, it combines the eligibility rules for 18 financial benefits for new parents. It is powered by a rules engine, built on OpenFisca.  Users can submit anonymised demographic information, and the site returns information about which rebates the subject is eligible for.​ 

Denmark: Denmark has developed seven principles for digital-ready legislation that forms part of their legislative drafting process 

USA: The US District of Columbia makes its legislation available in XML format and publicly available for software developers to use and comment on 

Do you need Rules as Code? 

A flowchart advising wether a set of rules would be useful as code

Last updated