Rules as Code

What is Rules as Code?

Our Rules as Code project is a collaboration with the DNA Lab and Code for Australia. We’re partnering with NSW Government agencies to experiment with translating prescriptive rules in legislation, regulation, and policy into machine consumable languages (code) so they can be used and applied by computers.

We’re using this experience to develop tools and guidance to help NSW Government agencies code their own rules.


We want to make the rules easier to create, understand, apply, and comply with for the people and businesses of NSW. We’re looking to enable rule makers to co-draft rules in text and machine consumable forms and release them together.

What do we mean by rules?

We’re working with prescriptive, deterministic rules in legislation and policy, not judgement or principle-based rules that involve discretion. For example, eligibility criteria that sets out who receives a subsidy or benefit, or conditions that must be met to obtain a permit or license.

Why code rules?

NSW has 1,100 Acts, 600 Regulations, over 300 environmental planning instruments, and many more rules and guidelines. These are set out –in prose –in over 22,000 pdf documents as well as in online Acts, statutes, instruments, policies and rules. In 2018, the NSW Parliament assented 95 bills.

If we can enable rules to be published in both text and code, it would open up a host of possibilities. For example:

  • We could support multiple digital services using a single set of rules. This would enable consistency and easier updates – if you amend the rules, all the linked services will be updated.
  • We could enable seamless and integrated customer 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 that parent is eligible for rebates and so use the information from the form to pre-fill the rebate application. 
  • We could reduce 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 . A regulator could code its rules 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.

What have we done?

Rules as Code Showcase (11 April 2019) 



What are we doing?

  • Continuing to experiment with rules platform OpenFisca.
  • Continuing to build and test our tools and guidance.
  • Working with the Better Regulation Division to code parts of the new Community Gaming Regulation. We’ll use these rules to build a tool to help charities, not-for-profits and other users understand how the regulation applies to them and make the rules available for reuse.


Last updated