Conversation
7ae64c8 to
76b7262
Compare
|
Thinking that we will need to at least adjust the Illinois program which was dependent on the number of pregnancies |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7719 +/- ##
===========================================
- Coverage 100.00% 93.33% -6.67%
===========================================
Files 5 2 -3
Lines 69 15 -54
Branches 2 0 -2
===========================================
- Hits 69 14 -55
- Misses 0 1 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
76b7262 to
b47bed7
Compare
There was a problem hiding this comment.
These tests take current_pregnancies as inputs and outputs, I dont think they are effective but our convention is to not write unit tests for variables without formulas
Make is_pregnant a pure input variable by removing adds = ["current_pregnancies"]. Add defined_for = "is_pregnant" to current_pregnancies so it is scoped to pregnant persons. Add tests for current_pregnancies with defined_for behavior. Closes PolicyEngine/policyengine-us-data#576 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
b47bed7 to
70cc92d
Compare
|
@PavelMakarchuk Hopefully we're just logically switching the order here. |
|
@hua7450 can you take a look to make sure we dont break any partner programs here |
|
I will write some test cases to verify. Just to make sure our api partners don't need to adjust anything. |
Add a formula to current_pregnancies that returns 1, gated by defined_for = "is_pregnant". This means setting is_pregnant = True automatically gives current_pregnancies = 1 without needing to specify it explicitly. Users can still override (e.g., twins = 2). Update tax_unit_medicaid_income_level tests to add is_pregnant: true for pregnant persons and add a triplets test case. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Why
|
Simpler equivalent: is_pregnant (bool) maps directly to current_pregnancies (1 for pregnant, 0 for not). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
adds = ["current_pregnancies"]fromis_pregnant, making it a pure input variable rather than one derived fromcurrent_pregnanciesis_pregnantdirectly as input instead of relying on theaddsderivation fromcurrent_pregnanciesis_pregnant: truealongsidecurrent_pregnanciesfor pregnant personsContext
is_pregnantis a direct demographic input ("are you pregnant?"), not something derived fromcurrent_pregnancies("how many babies are you expecting?"). Theaddsline causedpolicyengine-us-data's_drop_formula_variablesto drop stochastically imputedis_pregnantvalues during CPS enhancement.Closes PolicyEngine/policyengine-us-data#576
Test plan
tax_unit_medicaid_income_leveltests pass (4/4)🤖 Generated with Claude Code