About OpenFisca
OpenFisca is the most widely adopted free and open-source engine for coding rules and legislation. It’s lightweight, modular, scalable, and built on Python. OpenFisca was originally developed by the French Government in 2011 to codify the French social security system.
At a high level, the OpenFisca coding workflow follows five stages:
- Write test scenarios
- Create entities
- Define parameters
- Create input variables
- Create output variables (using formulas)
Core Components
In an Assemblic project, these core components map directly to the folder structure inside the openfisca_rules/ directory:
- Test scenarios (
openfisca_rules/tests/): OpenFisca uses Test-Driven Development (TDD). Before writing a single line of rule code, you define YAML test scenarios that describe the expected outcome for a given situation. - Entities (
openfisca_rules/entities.py): Rules are defined for specific actors in your domain. Common entities includePerson,Household, orCompany. See Person, entities, role in the OpenFisca documentation. - Parameters (
openfisca_rules/parameters/): Properties of the tax and benefit system that change over time, such as tax rates, benefit amounts, or age thresholds. See Parameters. - Input Variables (
openfisca_rules/variables/): The raw data required by your rules (e.g.,salary,date_of_birth). Definition tags includevalue_type,entity,definition_period, andreference. See Variables and formulas (input variables). - Output Variables (
openfisca_rules/variables/): Calculated fields determined by formulas. These formulas take input variables and parameters to produce a result (e.g.,tax_payable). See Variables and formulas (formulas).
TIP
You can learn more by following the official OpenFisca tutorial.
Version Control and Security
OpenFisca features built-in legislative versioning, allowing you to create rules that take effect on specific dates. It maintains a full history of past rules and values while allowing you to define future legislation today.
Beyond legislative dates, Assemblic also gives you control over the OpenFisca execution engine itself. You still manage the specific versions of the OpenFisca Core and Country Templates your project uses, but you can do so directly via the Assemblic Web UI or by modifying the .assemblic/version.yaml file in your repository.
This approach provides greater security assurance by ensuring the OpenFisca core version we deploy on your behalf is a known good, allowlisted version, completely freeing you from manual Python environment configuration.
