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
- Test scenarios: OpenFisca uses Test-Driven Development (TDD). Before writing a single line of rule code, you define test scenarios that describe the expected outcome for a given situation.
- Entities: Rules are defined for specific actors in your domain. Common entities include
Person,Household, orCompany. - Parameters: Properties of the tax and benefit system that change over time, such as tax rates, benefit amounts, or age thresholds.
- Input Variables: The raw data required by your rules (e.g.,
salary,date_of_birth). Definition tags includevalue_type,entity,definition_period, andreference. - Output Variables: Calculated fields determined by formulas. These formulas take input variables and parameters to produce a result (e.g.,
tax_payable).
TIP
You can learn more by following the official OpenFisca tutorial.
Version Control
OpenFisca features built-in 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.
