openfisca_core.reforms.
Reform
(baseline)[source]¶A modified TaxBenefitSystem
All reforms must subclass Reform and implement a method apply().
In this method, the reform can add or replace variables and call modify_parameters
to modify the parameters of the legislation.
Example:
>>> from openfisca_core import reforms
>>> from openfisca_core.parameters import load_parameter_file
>>>
>>> def modify_my_parameters(parameters):
>>> # Add new parameters
>>> new_parameters = load_parameter_file(name='reform_name', file_path='path_to_yaml_file.yaml')
>>> parameters.add_child('reform_name', new_parameters)
>>>
>>> # Update a value
>>> parameters.taxes.some_tax.some_param.update(period=some_period, value=1000.0)
>>>
>>> return parameters
>>>
>>> class MyReform(reforms.Reform):
>>> def apply(self):
>>> self.add_variable(some_variable)
>>> self.update_variable(some_other_variable)
>>> self.modify_parameters(modifier_function = modify_my_parameters)
modify_parameters
(modifier_function)[source]¶Make modifications on the parameters of the legislation
Call this function in apply() if the reform asks for legislation parameter modifications.
Parameters: | modifier_function – A function that takes an object of type ParameterNode and should return an object of the same type. |
---|