Standardize all endpoints on country_id with latest-version defaulting#109
Draft
Standardize all endpoints on country_id with latest-version defaulting#109
Conversation
…model_name
All API endpoints now accept country_id ('us' or 'uk') instead of various
tax_benefit_model_name formats. Adds shared model_resolver service, converts
Convention B (raw model name) and Convention C (Literal with underscore-to-hyphen
conversion) endpoints, renames Household DB column via Alembic migration, and
removes the old _get_model_version() resolver.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… pinning All metadata endpoints (parameters, variables, parameter-values) now resolve country_id to the latest model version by default, preventing duplicate results when multiple versions exist. Adds optional tax_benefit_model_version_id param for pinning to a specific version. Supersedes #99 by combining version resolution with the country_id standardization. Closes #98 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6 tasks
Replace single policy_id with baseline_policy_id + reform_policy_id on all analysis endpoints. Add PolicyIdInput sentinel type (UUID, "current_law", or None) with _resolve_policy_input() converter. Add run=True parameter to defer computation — when run=False, report status is set to EXECUTION_DEFERRED instead of triggering simulation. Includes Alembic migration to add EXECUTION_DEFERRED to reportstatus enum. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…lable Three enum columns (region_type, report_type, decile_type) were stored as VARCHAR but needed native PG enum types for proper SQLAlchemy deserialization. Adds values_callable to store lowercase values and includes Alembic migration that drops pre-existing uppercase enum types before recreating with lowercase. Also fixes seed_regions.py to pass RegionType enum members instead of raw strings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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 #108
Summary
country_id("us" or "uk") instead of varioustax_benefit_model_nameformatstax_benefit_model_version_idparam added for pinning to a specific versionmodel_resolverservice withresolve_model_name(),resolve_country_model(), andresolve_version_id()Household.tax_benefit_model_namecolumn renamed tocountry_id(Alembic migration included)_get_model_version()function from analysis.pyTest plan
/parameters/?country_id=usreturns only latest-version parameters (no duplicates)/parameters/?country_id=us&tax_benefit_model_version_id=<uuid>pins to that version/variables/?country_id=ukreturns only latest-version variables/parameter-values/?country_id=us¤t=truefilters by latest version/parameters/children?country_id=usreturns tree for latest version/parameters/by-namewithcountry_idin body works correctly/households/CRUD usescountry_idfield instead oftax_benefit_model_name/datasets/?country_id=usand/regions/?country_id=usstill work🤖 Generated with Claude Code