Skip to content

feat(CP-26): reference data management service#15

Merged
ncamaa merged 1 commit intomainfrom
feat/CP-26-reference-data-service
Apr 12, 2026
Merged

feat(CP-26): reference data management service#15
ncamaa merged 1 commit intomainfrom
feat/CP-26-reference-data-service

Conversation

@ncamaa
Copy link
Copy Markdown
Collaborator

@ncamaa ncamaa commented Apr 12, 2026

Summary

  • Adds a new src/api/reference/ module with cached service layer and REST endpoints for all reference data tables (tax brackets, pension coefficients, CBS expense standards, system constants)
  • Service functions fall back to the latest available year when the requested year has no data, and pension coefficients interpolate between the two nearest entries for birth years not in the table
  • In-memory cache (load once, cache forever) keeps repeated reads fast since reference data only changes annually

Endpoints

Method Path Description
GET /api/reference/tax-brackets?year=2025 Tax brackets for a year
GET /api/reference/pension-coefficients?birthYear=1985&gender=MALE Pension coefficient (interpolates)
GET /api/reference/cbs-expenses?householdSize=5 CBS per-capita monthly expense
GET /api/reference/constants?year=2025 System constants as key-value map
GET /api/reference/all?year=2025 Bundled reference data for the engine

Test plan

  • 16 unit tests covering all service methods, fallback logic, interpolation, caching, and null cases
  • pnpm test passes (227 tests)
  • pnpm build passes (tsc + tsup)
  • Curl verification against running dev server with seeded data

Provides cached, read-only access to tax brackets, pension coefficients,
CBS expense standards, and system constants for both the engine and frontend.
@ncamaa ncamaa merged commit 1e38e72 into main Apr 12, 2026
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