Service Layer medium complexity backend
0
Dependencies
0
Dependents
3
Entities
0
Integrations

Description

Evaluates configured notification scenarios against incoming domain events to determine when and to whom notifications should be sent. It applies organization-specific scenario rules covering assignment creation, activity approval, certification expiry, and inactivity thresholds. When a scenario matches, it triggers the appropriate delivery channels via the push and email/SMS notification integrations.

Feature: Notification Scenarios

notification-scenario-engine

Sources & reasoning

Line 116 explicitly calls for "scenariobaserte push-meldinger" to address HLF's follow-up gap. Blueprint marks notification-scenarios [v1.0]. Second phase ordinal = v1.0. The scenario engine is the mechanism that makes scenario-based delivery possible.

  • Oppfølging av likepersoner: 40 % var ikke fornøyd med oppfølgingen i spørreundersøkelse. Scenariobaserte push-meldinger og kalendersynkronisering.

Responsibilities

  • Receive domain events and evaluate them against all active scenarios for the relevant organization
  • Apply scenario matching logic including threshold checks, role filters, and event type conditions
  • Dispatch matched scenarios to the correct delivery channel integrations (push, email, SMS)
  • Manage scenario execution state to prevent duplicate or redundant notification delivery
  • Emit structured notification trigger events for audit and delivery tracking

Interfaces

evaluateEvent(event: DomainEvent, orgId: string): Promise<ScenarioMatch[]>
triggerNotifications(matches: ScenarioMatch[]): Promise<DeliveryResult[]>
getActiveScenarios(orgId: string): Promise<NotificationScenario[]>
validateScenarioConfig(config: ScenarioConfig): ValidationResult