Date:
28 June 2024
 
Phillipa Martin is Salsa's content writer and Rules as Code champion.

Exploring Rules as Code and Blawx: Jason Morris

While exploring Rules as Code (RaC) tech, Salsa came across Blawx. To get us up to speed on this open source tool, we've reviewed past presentations and also spoken to its inventor, Jason Morris.

One Blawx presentation that provides a great overview is from Calicon 2023External Link , a legal and tech education conference. At that conference, Jason delivered an insightful presentation on Rules as Code (RaC) and his innovative open source software, Blawx. As a database analyst, software developer, lawyer and researcher, Jason brings a unique perspective to the intersection of technology and law. Jason has dedicated years to developing Blawx and advancing the vision of RaC.

Introduction to Rules as Code

Rules as Code codifies rules and regulations into machine-readable formats. In his Calicon 2023 presentation, Jason demonstrated the importance of RaC with four compelling stories.

The New Zealand Holiday Pay Act

In New Zealand, the Holiday Pay Act failed to clearly define the "work week," leading HR software companies to make their own interpretations when they incorporated the new rules into their payroll software. These interpretations minimised pay obligations, resulting in widespread underpayment. In 2018, the NZ Courts ruled against these interpretations, leading to billions of dollars in backpay owed to employees. This incident underscores the need for clear and well-defined rules, highlighting how involving developers in the drafting process could have prevented such issues.

Read article: Auditor General callson Treasury to plug $2.1 billion Holiday Act holeExternal Link

PolicyEngine and OpenFisca

Next, Jason demonstrated PolicyEngineExternal Link , a tool built on OpenFiscaExternal Link that encodes laws and policies. In a matter of seconds, he showed the impact of abolishing two programs, showcasing the power of encoding rules for policy analysis. OpenFiscaExternal Link and PolicyEngineExternal Link are both open source, which allows anyone to run their own versions.

Singapore Management University experiment

While working at Singapore Management University, Jason worked on a project that encoded the professional rules that govern the legal profession in Singapore. This exercise revealed a drafting error that was previously unnoticed, demonstrating how encoding rules can help identify and correct issues in written law.

Growing complexity of compliance

Finally, Jason highlighted the increasing complexity and cost of compliance in a connected world. He gave a financial services example, citing a $10,000 spend per year per employee on compliance. By aligning rules and automated systems, organisations can reduce costs and improve efficiency.

Blawx: a revolutionary RaC tool

Blawx, developed by Jason, embodies his vision for a user-friendly RaC tool. Inspired by the simplicity and utility of spreadsheets, Blawx is designed to make legal reasoning accessible to non-programmers through a visual, drag-and-drop interface.

Key features of Blawx

  1. User-friendly interface: BlawxExternal Link uses BlocklyExternal Link , an open-source library by Google, to provide a visual programming environment. This interface makes it easy for users to encode rules without needing extensive programming knowledge.
  2. Declarative language: Blawx employs a declarative domain-specific programming language for legal reasoning. Users can create vocabularies and interpret rules in Blawx language, which translates into s(CASP)External Link , a Prolog-type language.
  3. Explainability and validation: Blawx enables users to run tests and scenarios, providing explanations linked back to the relevant sections of the law. This feature ensures that the encoded rules are accurate and maintainable.
  4. Integration and open source: Blawx is open source and provides an API that can be integrated with different frontend interfaces. Its open source nature aligns with the public sector's trend towards open-source and cloud-based software.

Demo: Rock Paper Scissors Act

Jason demonstrated Blawx using the fictitious "Rock Paper Scissors Act." He showed how to input laws into the rule editor and then move to the code editor, where the laws become the scaffolding for the code. By defining terms and rules, users can create tests to validate the rules. For example, creating a game scenario where Jane throws rock and Bob throws scissors, Blawx can determine the winner and explain the reasoning based on the encoded rules.

The future of RaC and Blawx

While RaC has made significant strides, there are still challenges to overcome. The tools generally used, such as OpenFisca, are more suited to programmers than policy drafters. Jason envisions a future where RaC tools like Blawx facilitate interdisciplinary collaboration, allowing lawyers to validate code while also ensuring maintainability.

The growing interest in RaC and recognition by organisations like the OECD highlight the potential of RaC. See Cracking the code: Rulemaking for humans and machinesExternal Link .

During our discussions with Jason, he’s currently working on using Large Language Models (LLMs) to help to write/code in Blawx. LLMs and AI is also an area that Salsa has been investigating — exploring how it can make different elements of the RaC process faster and easier.

Salsa and RaC technology

Through Salsa’s RaC work we also identified the need for a more user-friendly interface — and found Blawx. Having read up on Blawx and spoken to its creator, we’re keen to experiment with Blawx. Like Jason, we want to make legal reasoning accessible to non-programmers while also ensuring the accuracy and maintainability of encoded rules. We’re looking forward to exploring the power and benefits of Blawx, as well as other RaC tools…watch this space!