PolicyEngine / openfisca-tools

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

`defined_for` doesn't work for simulation-defining formulas #74

Open nikhilwoodruff opened 1 year ago

nikhilwoodruff commented 1 year ago

This is a pretty complex edge case I didn't consider when writing the defined_for logic. The way that defined_for works is by intercepting the entity(variable, period) calls inside a subsetted variable's formula and pre-subsetting them, so normal operations on them return the subsetted population results. But no interception happens when a formula creates a new simulation and uses outputs from simulation.calculate.