PolicyEngine / openfisca-tools

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

Work (or fail gracefully) when using `deriv` on a variable defined at an entity that sim lacks #46

Closed MaxGhenis closed 2 years ago

MaxGhenis commented 2 years ago

See https://github.com/PolicyEngine/openfisca-us/issues/693, which shows that an openfisca-us IndividualSim deriv call fails when calculating the derivative of a variable defined at an entity absent from the sim. In that example, snap is at the SPM unit level, but the sim only has a person.

This gets into the broader issue we've discussed, that it would be nice if individuals in an IndividualSim were automatically combined to higher-level entities. I think that'd fix the case where only the sim only has a person. I'm not sure what would work in the household case.

In the meantime, a more informative error message would help.