Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add examples for both numerical/boolean formulas #245

Open
bonjourmauko opened this issue Jul 17, 2021 · 0 comments
Open

Add examples for both numerical/boolean formulas #245

bonjourmauko opened this issue Jul 17, 2021 · 0 comments

Comments

@bonjourmauko
Copy link
Member

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants