feat: Add adds/subtracts to Variable with parameter path resolution#248
feat: Add adds/subtracts to Variable with parameter path resolution#248
Conversation
…tion Variables using declarative aggregation (adds/subtracts) now have these fields populated on the Variable model. Parameter path strings are resolved to list[str] at init time so downstream consumers always get arrays. Closes #247 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
nwoodruff-co
left a comment
There was a problem hiding this comment.
Why is this needed- and if so, should probably be proper references to other rows in the Variable table
|
This is needed to build the results tree we use for nested household outputs. You make a fair point about row references, though I'll need to think through implementation. I wonder what the time and complexity costs of creating them would be, considering that you'd need to create rows that are within a given var's adds or subtracts first, then create the "consumers", so to speak. |
|
I did some looking into this and I can't envision an implementation where we don't have to algorithmically determine which params to load in first based on where they sit in the adds/subtracts tree, especially since they can nest pretty deeply in |
Fixes #247
Summary
addsandsubtractsfields (list[str] | None) to theVariablePydantic model"gov.hhs.tanf.cash.income.sources.earned") tolist[str]so downstream consumers always get arraysTest plan
TestVariableAddsSubtracts::test_us_variable_with_list_adds_has_list— direct list adds (e.g.,employment_income)TestVariableAddsSubtracts::test_us_variable_with_parameter_path_adds_resolves_to_list— parameter path resolution (e.g.,household_state_benefits)TestVariableAddsSubtracts::test_us_variable_without_adds_has_none— variables without addsTestVariableAddsSubtracts::test_us_variable_without_subtracts_has_none— variables without subtractsTestVariableAddsSubtracts::test_us_some_variables_have_adds— at least 50 US variables have addsTestVariableAddsSubtracts::test_uk_variable_with_adds_has_list— UK variable with addsTestVariableAddsSubtracts::test_uk_variable_without_adds_has_none— UK variable without addsTestVariableAddsSubtracts::test_us_variable_with_subtracts_has_list— US variable with subtractsTestVariableAddsSubtracts::test_adds_entries_are_valid_variable_names— adds entries reference real variables🤖 Generated with Claude Code