-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
All metadata endpoints currently return data from all model versions when tax_benefit_model_name is provided. They should default to the latest TaxBenefitModelVersion (by created_at DESC) and accept an optional tax_benefit_model_version_id for pinning to a specific older version.
Additionally, the by-name and children endpoints currently accept country_id instead of tax_benefit_model_name, which is inconsistent with the other endpoints. This should be unified.
Changes required
New service helper
src/policyengine_api/services/tax_benefit_models.pywithresolve_model_version_id()— resolves an optional model name + optional version ID into the correctTaxBenefitModelVersionUUID
Endpoint changes
| Endpoint | Change |
|---|---|
GET /parameters/ |
Add optional tax_benefit_model_version_id. Default to latest version when tax_benefit_model_name provided. |
POST /parameters/by-name |
Replace country_id with tax_benefit_model_name. Add optional tax_benefit_model_version_id. |
GET /parameters/children |
Replace country_id with tax_benefit_model_name. Add optional tax_benefit_model_version_id. |
GET /variables/ |
Add optional tax_benefit_model_version_id. Default to latest version. |
POST /variables/by-name |
Replace country_id with tax_benefit_model_name. Add optional tax_benefit_model_version_id. |
GET /parameter-values/ |
Add optional tax_benefit_model_name and tax_benefit_model_version_id. Filter via join through Parameter. |
No schema/migration changes needed
The tax_benefit_model_version_id FK already exists on Parameter and Variable models.
Supersedes
This supersedes PR #72 (fix/allow-filtering-by-version-id), which took a similar approach but removed the by-name and children endpoints.
Target branch
app-v2-migration
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels