Threshold Tracking Service
Component Detail
Service Layer
high complexity
backend
2
Dependencies
3
Dependents
5
Entities
0
Integrations
Description
Core business logic service that maintains per-peer-mentor assignment counters, evaluates tier boundaries against per-association threshold configurations, and emits threshold-crossing events. Handles idempotency for assignment cancellations and ensures counter integrity across concurrent registrations.
threshold-tracking-service
Responsibilities
- Increment or decrement assignment counters on completion or cancellation events
- Evaluate counter values against honorarium_thresholds configuration for the peer mentor's local association
- Emit threshold-crossing notification events when tier boundaries are reached
- Provide current count and next-threshold distance for a given peer mentor
- Ensure idempotent counter updates to prevent double-counting
Interfaces
incrementAssignmentCount(peerMentorId, assignmentId)
decrementAssignmentCount(peerMentorId, assignmentId)
getCounterState(peerMentorId)
evaluateThresholds(peerMentorId, newCount)
getThresholdConfig(localAssociationId)
emitThresholdCrossedEvent(peerMentorId, tier)
getProgressToNextThreshold(peerMentorId)
recalculateCounterFromHistory(peerMentorId)
validateIdempotencyKey(assignmentId, operation)
Relationships
Dependencies (2)
Components this component depends on
Dependents (3)
Components that depend on this component
Related Data Entities (5)
Data entities managed by this component