Repository navigation
Conversation
GET /{country_id}/metadata now describes each variable's quantity type as
quantityType: "stock" for a balance or value at one point in time, "flow"
for an amount over a period. The value is core's Variable.quantity_type,
which a model sets or core defaults. The app's household builder needs it
to leave the "Annually" label off money stocks such as rental property
value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 of 7 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3987 +/- ##
===========================================
+ Coverage 46.17% 84.17% +38.00%
===========================================
Files 239 255 +16
Lines 13987 15364 +1377
Branches 2272 2557 +285
===========================================
+ Hits 6458 12933 +6475
+ Misses 6958 1676 -5282
- Partials 571 755 +184 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #3986
Summary
GET /{country_id}/metadatanow includesquantityTypein each variable's description:"stock"for a balance or value at one point in time,"flow"for an amount over a period.Variable.quantity_type. A model sets it explicitly (for examplehousehold_rental_property_valueandhousehold_vehicles_valuein the US,mortgage_debtin the UK), or core defaults it:"stock"for yes-or-no, whole-number, list, text and date variables and for rates (unit/1),"flow"otherwise.PolicyEngineCountry.build_variables(policyengine_api/country.py). The Flask route and the native FastAPI route both servecountry.metadata, so both return the new field. Existing fields are unchanged.python scripts/export_migration_contracts.pyproduced no changes.Testing
TestVariableQuantityTypeintests/unit/test_country.py, written first and failing before the change (KeyError: 'quantityType'):employment_incomeare"flow"; UShousehold_vehicles_valueand UKmortgage_debtare"stock"; USis_blindis"stock"(core's default for a yes-or-no variable);"stock"or"flow".make formatandruff checkon the changed files: clean.python scripts/run_quality_guards.py: passed.make testsuite (tests/to_refactor tests/unit tests/contract tests/integration/test_budget_window_in_flight_dedupe.py): 2,799 passed.quantityTypefrom this branch's US model, "Rental property value" shows no period label, while "Rent" and "Employment income" still show "Annually".🤖 Generated with Claude Code