Skip to content

Instantly share code, notes, and snippets.

@bonjourmauko
Created July 17, 2021 12:59
Show Gist options
  • Select an option

  • Save bonjourmauko/a4b229750ec6ba3bb677f18ba6a3eebc to your computer and use it in GitHub Desktop.

Select an option

Save bonjourmauko/a4b229750ec6ba3bb677f18ba6a3eebc to your computer and use it in GitHub Desktop.
Example condition check rule with OpenFisca
class basic_income_age_condition(Variable):
value_type = bool
entity = Person
definition_period = MONTH
label = "Age eligibility condition for basic income"
reference = "https://law.gov.example/basic_income/eligibility/age"
def formula(persons, period, parameters):
input_age = persons("age", period)
threshold = parameters(period).general.age_of_majority
return input_age >= threshold
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment