At Service Canada I’m trying to establish that OpenFisca can do what we need it to do as a legal reasoning back-end for some user-facing tools that we are working on. The instructions that I was given was that it needs to be able to generate answers, or say when those answers are unknown, what additional questions could be put to the user to make them known, if any, and if none, whether they can be considered conditionally known, given certain assumptions.
The tool will be calculating eligibility and entitlement for four government benefits. The version I’m posting here, importantly, is NOT designed to answer those questions accurately. It’s just a proof of concept with place-holder logic in several places.
But it demonstrates that you can use an OpenFisca encoding, which is typically used for microsimulation, and not for interactive user applications, in a way that will support interactive applications by helping the application understand what questions to ask, and how to explain the results.
This Google Colab File provides a form you can use to input data to the web API, allows you to review the output of the web API in raw format, and then demonstrates how that raw data can be usefully converted into natural language explanations, a list of relevant input variables, and more.
That colab file is connected to a testing Web server, which is not guaranteed to stay up forever. The source code for OpenFisca package that is being used on that web server is at GitHub.
Here is a blog posts on how I wrote the OpenFisca code, and why I wrote it that way, and how it is being used.