Encapsulated entities do not preserve Enums within formulas
nikhilwoodruff opened this issue · 1 comments
nikhilwoodruff commented
Hi there!
I really enjoy OpenFisca, but I recently encountered an issue.
Here is what I did:
Inside a formula, with defined encapsulated entities, decode an Enum variable:
str_enum = family.household("enum_variable", period).decode_to_str()
Here is what I expected to happen:
The string decodes in an array to be returned, just like what happens when I run:
simulation.calculate("family_enum_variable_returning_households_enum", period).decode_to_str()
Here is what actually happened:
AttributeError: 'numpy.ndarray' object has no attribute 'decode_to_str'
Here is data (or links to it) that can help you reproduce this issue:
Happy to add this as a test case to test_projectors
and find a fix.
Context
I identify more as a:
- Developer (I create tools that use the existing OpenFisca code).
Thanks!
nikhilwoodruff commented
On further inspection, I think the root cause of this is that GroupPopulation.value_nth_person
does not preserve Enum status, returning only integer arrays.