Skip to content

feat: Phase 4a — Lazy parameter tree & model version endpoints#89

Merged
anth-volk merged 5 commits intoapp-v2-migrationfrom
feat/sim-report-migration/phase-4a
Feb 23, 2026
Merged

feat: Phase 4a — Lazy parameter tree & model version endpoints#89
anth-volk merged 5 commits intoapp-v2-migrationfrom
feat/sim-report-migration/phase-4a

Conversation

@anth-volk
Copy link
Contributor

Summary

  • GET /parameters/children — returns immediate children of a parameter tree node, enabling lazy expansion in the policy parameter selector menu
  • POST /parameters/by-name — batch-fetches full parameter metadata by dotted names, used by policy pages to resolve only the parameters they need
  • POST /variables/by-name — batch-fetches variable metadata by name, supporting on-demand variable resolution
  • GET /tax-benefit-models/by-country/{country_id} — returns the model + latest version for a country, used by useModelVersion to detect stale caches
  • Refactored analysis module — extracted composable computation modules from monolithic functions, added GET /analysis/options and POST /analysis/economy-custom endpoints with a module registry pattern

Test plan

  • test_parameters_children.py (404 lines) — children endpoint: root, nested, leaf, invalid path, empty results
  • test_parameters_by_name.py (196 lines) — by-name endpoint: single/multiple params, unknown names, empty input
  • test_variables_by_name.py (229 lines) — by-name endpoint: single/multiple vars, unknown names, empty input
  • test_models_by_country.py (149 lines) — by-country endpoint: valid/invalid country, response shape
  • test_module_registry.py (280 lines) — registry pattern: register, lookup, list, duplicate detection
  • test_computation_modules.py (282 lines) — extracted computation modules
  • test_analysis_options.py (129 lines) — options endpoint
  • test_economy_custom.py (317 lines) — economy-custom endpoint
  • Manual: verify endpoints against live tax-benefit-model data

🤖 Generated with Claude Code

anth-volk and others added 5 commits February 23, 2026 12:19
Allows looking up parameters by their exact names for a given model,
returning ParameterRead[] for matches. Enables the app to fetch metadata
for specific parameters (e.g. those in a saved policy) without loading
the entire parameter catalog.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Accepts country_id and parent_path, returns direct children as nodes
(with child_count) or leaf parameters (with full metadata). Adds
COUNTRY_MODEL_NAMES mapping to constants for country_id resolution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Accepts a list of variable names and country_id, returns matching
VariableRead objects. Mirrors the parameters/by-name pattern for
targeted variable fetching without bulk loading.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Returns the model and its latest version in a single response, keyed
by country_id (us/uk). Used on page load for model version checking
and cache invalidation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ers/by-name

Aligns the POST /parameters/by-name endpoint with GET /parameters/children
by accepting country_id ("us" or "uk") and resolving the model name
internally via COUNTRY_MODEL_NAMES.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@anth-volk anth-volk marked this pull request as ready for review February 23, 2026 15:23
@anth-volk anth-volk merged commit d0c5843 into app-v2-migration Feb 23, 2026
1 check passed
@anth-volk anth-volk deleted the feat/sim-report-migration/phase-4a branch February 23, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant