We're EnActivity.

What if law worked like open-source software?

About

Law as Code

As part of the Better Rules Hackathon, we wanted to help make legislation easier to use, track, and improve.

The Goal

We wanted to build a proof-of-concept, to show that it is both feasible and beneficial to make legislation easier to work with.

The Approach

We wanted to use simple, familiar tools, to make the most of our limited time over the weekend. We chose to push our output to GitHub, a popular platform for sharing and working with code, to avoid any need to manage our own web hosting.

We chose to turn the XML law into AsciiDoc text files. AsciiDoc is a format that works well for both people and computers.

The Source

We started with raw XML files from the official legislation website.

Legislation.govt.nz offers enactments in XML format

The Outcome

We created automated tools to:

  1. Read legislation from the official XML source
  2. Transform the XML into readable .adoc files
  3. Upload the .adoc files to GitHub for sharing and re-use

What can our tools do?

Our proof-of-concept worked with legislation from 1993, but is already capable of working on all legislation provided through the official XML source. That includes law going all the way back to the Statute of Marlborough from 1267.

Proof-of-Concept: The Privacy Act 1993

We demonstrated our tools working with the Privacy Act 1993. This is a topical bit of law, with a Privacy Bill to update it before Parliament. Below you can see how the automated comparison in GitHub helps to see the specifics of a law change.

GitHub also makes it easy to link to a specific change - try it out!

Progress on process

As we honed our tools, the process got substantially faster. It took us:

  • Just under 30 hours to process our first enactment
  • 15 minutes to do the second (and solve a bug)
  • 15 minutes to do the remaining 47 Acts from 1993

The remaining bottleneck is download speed. With all the enactments on one machine, we could do this much quicker from here.



Contact

The Code

Our code is in a GitHub repository here

My current local time is .