high complexity extracted Notifications Confidence: 100%
8
Components
106
Shared
0
User Stories
Yes
Analyzed

Description

Notification Scenarios defines and manages the rule-based logic that determines when, to whom, and through which channel a notification is sent. The rule engine evaluates system events—such as an activity going 10 days without follow-up, an assignment threshold being reached, or a certification approaching expiry—and dispatches the appropriate notification payload. Rules are configured per event type and can be extended without modifying the notification delivery infrastructure. This component centralises all trigger logic to prevent fragmented notification calls scattered across the codebase.

User Flow

Notification Scenarios user flow
Click to expand

Analysis

Business Value

Ad-hoc push calls embedded in business logic become unmaintainable as the platform grows; a centralised rule engine is the architectural prerequisite for the scenario-driven follow-up that Hørselsforbundet explicitly requested. Scenarios such as 'no contact made 10 days after assignment' (Blindeforbundet requirement) or 'certification expires in 30 days' (HLF requirement) are high-value automations that directly reduce coordinator workload. Without a rule engine, each scenario requires bespoke implementation; with one, new scenarios are configuration changes rather than code changes, reducing time-to-deploy for org-specific requirements.

Implementation Notes

The Notification Rule Engine runs as a scheduled job (cron or Vercel Cron) that queries the database for entities matching trigger conditions. Each rule is defined as a TypeScript object with fields: event_type, condition (a query or predicate), recipient_resolver (maps entity to user IDs), channel (push, email, sms, or all), template_id, and cooldown_hours (prevents duplicate sends). Rules are registered in a central array; the engine iterates rules, evaluates conditions, resolves recipients, checks notification_settings for opt-outs, and enqueues delivery. A notifications table records each sent notification with status for deduplication and audit. The engine must be idempotent: re-running for the same time window must not produce duplicate sends.

Components (114)

Service Layer (4)

Data Layer (2)

Infrastructure (2)

Shared Components

These components are reused across multiple features

Service Layer (34)

Data Layer (22)

Infrastructure (38)

infrastructure Keychain/Keystore Adapter low Shared infrastructure JWT Claims Extractor low Shared infrastructure Organization Labels Adapter low Shared infrastructure Keychain/Keystore Adapter low Shared infrastructure Auth API Client medium Shared infrastructure REST API Client medium Shared infrastructure WCAG Accessibility Adapter low Shared infrastructure Registration API Client low Shared infrastructure Accounting API Client high Shared infrastructure PDF Renderer Adapter medium Shared infrastructure File Share Adapter low Shared infrastructure FCM/APNs Adapter high Shared infrastructure Share Sheet Adapter low Shared infrastructure Share Plus Adapter low Shared infrastructure Platform Accessibility Bridge medium Shared infrastructure Semantics Override Adapter high Shared infrastructure URL Launcher Adapter low Shared infrastructure Markdown Content Renderer low Shared infrastructure Network Connectivity Monitor low Shared infrastructure Expense Receipt Storage Adapter low Shared infrastructure Audit Log Writer low Shared infrastructure Feature Flag Checker low Shared infrastructure Logo Upload Adapter low Shared infrastructure Terminology Constants Registry low Shared infrastructure Feature Flag Cache Adapter low Shared infrastructure Org Scope JWT Resolver medium Shared infrastructure Association Audit Logger low Shared infrastructure Token Blocklist medium Shared infrastructure Analytics Tracker low Shared infrastructure SEO Metadata Config low Shared infrastructure Analytics Tracker low Shared infrastructure Analytics Tracker low Shared infrastructure Sales Analytics Tracker low Shared infrastructure Email Provider Adapter low Shared infrastructure Terms of Service Content Provider low Shared infrastructure Legal PDF Asset Provider low Shared infrastructure Consent-Gated Script Loader low Shared infrastructure Legal Page Layout low Shared

User Stories

No user stories have been generated for this feature yet.