Calculation Model Config Service
Component Detail
Service Layer
medium complexity
backend
0
Dependencies
0
Dependents
0
Entities
0
Integrations
Description
Service responsible for reading, writing, and caching the organization-level calculation model parameters (hourly value rates, professional-hour cost benchmarks, social-value multipliers). Provides the Real-Time Impact Calculation Service with tenant-appropriate values without requiring code changes per organization.
calculation-model-config-service
Responsibilities
- Fetch calculation model configuration for a given tenant from the database
- Cache model config in memory per tenant with TTL invalidation
- Expose admin API endpoints for Org Admins to update their tenant's calculation parameters
- Validate parameter ranges (e.g. non-negative rates) before persisting
Interfaces
getModelForTenant(tenantId) → CalculationModel
updateModel(tenantId, params: Partial<CalculationModel>) → CalculationModel
GET /api/v1/admin/impact-config → CalculationModel
PATCH /api/v1/admin/impact-config → CalculationModel