Skip to content

Add examples for both numerical/boolean formulas #245

@bonjourmauko

Description

@bonjourmauko

Newcomers may want to use OpenFisca for eligibility/condition checks.

This is supported, but unclear.

It'd be great to have at least one example of a numerical formula, and another of a boolean one.

Proposed example for the latter:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions