If public services are available online, why aren’t the policies and laws that govern them made digitally too?

This is the thought behind an approach emerging in governments across the world, called Rules as Code. Estonia’s Government CIO Siim Sikkut has called it a “transformative idea” and Australia’s Prime Minister has floated the thought. “When [legislation] is written in code then that makes for its very rapid implementation and application to the various practices it is seeking to regulate,” he said.

We look at what the approach is, how it could speed up service delivery, why it should matter to governments, and what has been done so far.

1. What it is

Rules as Code is an approach to create and publish regulations, legislation and policies as machine and human readable. “The long term vision from my perspective is that all legislation is coded and is owned by the appropriate organisations and governments,” says Nadia Webster from the New Zealand Government.

The approach involves creating rules in government that are better suited for digital service delivery, creating software tools to write the rules into code, and then using that code as a basis for service delivery and decisions.

Coded rules can automate certain decision-making in government. They are particularly well-suited to yes/no and if-this-then-that decisions, such as eligibility for benefits or obligations to pay tax, Webster says.

Making rules machine readable helps both civil servants and citizens clearly understand their intent, and execute them. “We should be able to offer up tools that help people to model and understand what legislation might mean for them,” Webster adds.

2. Why it matters

With governments coming up against large tech companies in courtrooms, it’s clear that neither policies nor processes have kept up with tech. “Law predates software, we know that, but the legal industry of the future ought to be compatible with a world that is increasingly being run on software and code,” says Meng Weng Wong, a Singaporean computer scientist and co-founder of startup Legalese.

Pia Andrews, an Australian civil servant and an early spokesperson for this approach, says that there are problems with how rules are currently created, shared and interpreted. “The rules of gov are increasingly complex, so change often introduces conflicts with unintended consequences,” she writes.

And these complex and ambiguous rules are being coded into software when governments build digital services, opening up inconsistencies in what benefits and services citizens get access to.

Software developers have to implement rules that weren’t necessarily developed for the world we live in today, Webster says, and they don’t have any way to influence how the rules are developed.

3. How it could affect government

Rules as Code holds three big promises to change government, Wong says.

First, it could speed up digital service delivery. Today, projects can be significantly delayed as teams seek to clarify policy or interpret legislation. “A Rules as Code/Legislation as Code approach forces the policy drafters to confront these questions early, to the benefit not just of the government software team, but of the public as well.” When rules are made to be machine readable, their logic is clearly structured and exceptions spelt out – the hard work is done early on.

The ongoing COVID-19 pandemic is certainly testing the speed of government response. As countries announce new policies and economic support to tide people and businesses over, with the Rules as Code approach, they could launch apps concurrent to the policies taking effect, making them more effective, Wong explains.

Second, Rules as Code can make the job of policy makers and legislative drafters easier. Software could point out potential errors in laws and contracts. “What Word can do with red squiggly lines for spelling and grammar, future software can do for the semantics of legal obligations, deadlines and definitions,” he says.

Third, it will improve the clarity of written laws. Tools that currently help programmers find bugs in their code as they’re written are being brought to the legal domain. “These tools promise to help find loopholes in laws and contracts as they are drafted, before they take effect,” Wong says. Other tools can run simulations as laws are updated to see real world consequences on a “digital twin” before they are implemented.

4. What is happening on this

France was one of the earliest adopters of this approach. They created an open source tool called OpenFisca to convert benefits and tax legislation into code. Their openness has allowed others like New Zealand to trial this new approach quicker.

Webster was then part of New Zealand’s Service Innovation Lab and led its discovery project into the Better Rules approach. “Our approach speaks very much to making the rules as human understandable and machine understandable, but also transparent and available for all,” she says.

Her work found that multidisciplinary teams of policy analyst, legislative drafters, service designers and software developers are an effective way of creating rules suitable for the digital age. “It’s recognising that there is value in bringing together these other people who are thinking further down the chain from them about how it is going to be implemented.”

Webster now works at the Wellington City Council, which is doing a proof of concept to convert district planning rules into software code, without having to get developers involved. “What many legislative drafters would like to see is a magical tool that converts the logic straight into software code. And that’s a toolset that we’re starting to explore in the Wellington City Council at the moment.”

In Singapore, Wong and his startup are working on the technology behind this. “We’re building what we hope will be the foundational programming language for legislation as code – a domain-specific language for law,” he says.

The Singapore Government has been supportive and progressive in their approach on this, Wong says. “We said, ‘what could be more smart-nation than having truly digital laws?’ That resonated with government leaders here; the idea that we could start building an entire deep-tech infrastructure to make law forward-compatible with the software-driven world.” His startup is weeks away from launching what they’ve been working on.

The Rules as Code movement aligns with Singapore’s Smart Nation vision, but goes further, he adds. “If laws in an open society are openly published, then why shouldn’t the software embodiments of those laws also be published, as open source?”

Canada is working on their first Rules as Code discovery project. In Australia, New South Wales has continued the work Andrews started, and is looking to code rules to help charities and non-profits understand how regulations apply to them and make them reusable.

The Rules as Code movement is not about bots making policies and laws. It’s about how laws can be easily accessed and used in the digital world.

Image by Southbanksteve – CC BY-SA 2.0