A variable of the legislation.
Main attributes:
- name¶
Name of the variable
- value_type¶
The value type of the variable. Possible value types in OpenFisca are
int
float
bool
str
date
andEnum
.
- definition_period¶
Period the variable is defined for. Possible value:
DateUnit.DAY
,DateUnit.MONTH
,DateUnit.YEAR
,DateUnit.ETERNITY
.
- formulas¶
Formulas used to calculate the variable
- label¶
Description of the variable
- reference¶
Legislative reference describing the variable.
- default_value¶
Default value of the variable.
Secondary attributes:
- baseline_variable¶
If the variable has been introduced in a reform to replace another variable, baseline_variable is the replaced variable.
- is_neutralized¶
True if the variable is neutralized. Neutralized variables never use their formula, and only return their default values when calculated.
- json_type¶
JSON type corresponding to the variable.
- max_length¶
If the value type of the variable is
str
, max length of the string allowed.None
if there is no limit.
- possible_values¶
If the value type of the variable is
Enum
, contains the values the variable can take.
- set_input¶
Function used to automatically process variable inputs defined for periods not matching the definition_period of the variable. See more on the documentation. Possible values are
set_input_dispatch_by_period
,set_input_divide_by_period
, or nothing.
- unit¶
Free text field describing the unit of the variable. Only used as metadata.
- documentation¶
Free multilines text field describing the variable context and usage.
Returns the formula to compute the variable at the given period.
If no period is given and the variable has several formulas, the method returns the oldest formula.
Returns the starting date of a formula based on its name.
Valid dated name formats are : ‘formula’, ‘formula_YYYY’, ‘formula_YYYY_MM’ and ‘formula_YYYY_MM_DD’ where YYYY, MM and DD are a year, month and day.
formula is 0001-01-01 (minimal date in Python)
formula_YYYY is YYYY-01-01
formula_YYYY_MM is YYYY-MM-01
Returns a clone of variable
that is annualized for the period annualization_period
.
When annualized, a variable’s formula is only called for a January calculation, and the results for other months are assumed to be identical.