PolicyEngine / openfisca-tools

Python tools for enhancing OpenFisca country packages.
1 stars 1 forks source link

Function to simplify categorical eligibility-checking pattern #22

Closed MaxGhenis closed 2 years ago

MaxGhenis commented 2 years ago

For example, from the US CVRP PR:

p = parameters(period).states.ca.calepa.carb.cvrp.increased_rebate
categorically_eligible = np.any(
    [
        person.spm_unit(program, period)
        for program in p.categorical_eligibility
    ],
    axis=0,
)

Could we just use add(person.spm_unit, period, p.categorical_eligibility) > 0?

any_(entity, period, variables) would be useful nonetheless.