OpenFisca in Google Colab

I blogged recently about the opportunity to use s(CASP) inside SWISH, the web-based development environment for SWI-Prolog.

Screenshot of a Google Colab notebook implementing OpenFisca code to calculate eligibility for a benefit

Today it is another web-based development environment for Rules as Code, OpenFisca inside Google Colab.

What is OpenFisca?

OpenFisca is probably the world’s most popular open source tool for Rules as Code. It is used extensively in France, and is spreading around the world.

What is Google Colab(oratory)?

Google Colab is a web-based implementation of Jupyter notebooks — a “literate programming” tool for the Python programming language — and Google’s cloud services. A Python development environment as a (free) service.

Less Memo, More Memo

I could explain how it works, here, but nah.

Just go try it yourself.

Trust me, you won’t regret the click.


I really like the result, because it provides a good literate programming environment to do encoding beside the text of legislation, in any approach that is implemented in Python.

It also democratizes access to OpenFisca, eliminating the need to know how to set up a development environment, or even the need for a computer on which Python can be installed. Interestingly, that makes it realistic for a wider variety of public servants to be able to explore, which in turn will make the technology more trustworthy, and more trusted.

OpenFisca is not my favourite approach for Rules as Code. Imperative programming is fundamentally limited for encoding rules, and OpenFisca’s design is focused on the quality of the outputs — high speed, high accuracy micro-simulations of the effects of legislation — not on the qualities of the inputs. But those concerns are academic, like preferring emacs to Word. OpenFisca is popular, open source, and feasible to deploy in places many of my preferred approaches are not. It also has a growing ecosystem of tools and extensions, as demonstrated at

Democratizing access to OpenFisca can only help the Rules as Code movement, and I am 100% here for that.

Adding Colab to the mix, in addition to democratizing access, gives OpenFisca a lot of great interface features. And with very little overhead for the developer. That means the distance between being able to encode a Law, and being able to demonstrate the usefulness of that encoding, has been reduced to nearly zero. And zero is where it should ideally be.




A sporadic diary by Jason Morris of Lexpedite Legal Technology Ltd.

Recommended from Medium

Create simple Python web API ‘s using Flask

Part 1 — The Database.

[Leet Code] Minimum Time to Type Word Using Special Typewriter

Milestone Reached: The New Cardstack Hub

Keeping Focus on Rails Feat. PKMN Nuzlocke challenge

Towards building an eBPF Based Network Data Plane

Use Google BigQuery with Laravel

Know How Tweets Were Analyzed By Twitter With The Help Of Pig

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jason Morris

Jason Morris

Rules as Code Director at Service Canada, CEO Previous: Lawyer; ABA Innovation Fellow; Sessional Instructor; Computational Law Researcher

More from Medium

Exploring “disinformation” at EUvsDisinfo

The Human Brain-Scale AI Supercomputer Is Coming

How good is Invisible’s AI, really?