Rewrite how to evaluate booleans in enum creation process #205
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
make format && make documentation
has been run.What's changed
Fixes #203. Following the merging of #188,
policyengine-uk
variables of typeenum
consistently produced strange behavior when loaded as part of a microsimulation, seemingly being weighted correctly, but against an array populated with default values, as opposed to the expected distribution.Manual testing found that, confusingly, the code introduced in #188 resulted in every
enum
being loaded twice - once as a string-type enum that was parsed into a single-element array of[0]
, and then again as an enum-type array that for some reason extended this array out to the same length as the weighting parameter. This contrasts with the previous behavior, whereby mostenum
s (e.g., the variablegender
inpolicyengine-uk
) would be read only as a string-type enum, creating an array of correct length with correct values at that time.Testing eventually demonstrated that the cause of this was the line from #188 that replaced the prior code's check of whether or not an
enum
's value array is Boolean-type to a different method of assessing this. When this line was replaced, without changing anything else, the code functioned correctly forpolicyengine-uk
, and appears to function correctly forpolicyengine-us
, as well, though my testing on this was less thorough.That said, being frank, I don't know why this is the solution. It took quite a while to even find it, considering how seemingly unrelated it is to the problem. I'm also at a bit of a loss as to how to test it more substantively. That said, the code does pass all existing tests. This PR also adds ".env" to the gitignore file.
Bug fix