Schedule Scenario Evaluations at Optimal Times to Minimize Disruption
The scenario prompt scheduler must support time-window constraints on both evaluation frequency and notification delivery. Coordinators configure a delivery schedule per scenario rule (e.g., 'evaluate daily at 07:00, deliver only Monday–Friday between 09:00–17:00'). The edge function scheduler respects these windows, queuing notifications that fall outside the allowed delivery period until the next valid window opens. This is especially important for organizations like NHF whose peer mentors include people with cognitive disabilities who may be overwhelmed by out-of-hours notifications. The scheduler configuration is stored per rule and applied at the infrastructure level via the edge function scheduling system.
User Story
Acceptance Criteria
- Given I am configuring a scenario rule, when I set an evaluation frequency (e.g., daily) and a delivery window (e.g., weekdays 09:00–17:00), then those constraints are saved and applied to the edge function schedule
- Given an evaluation runs and a condition is met outside the configured delivery window, when the delivery window opens, then the queued notification is sent at the start of the next valid window
- Given I configure a blackout period (e.g., holiday freeze), when the delivery window would normally open, then no notifications are sent during the blackout and they are discarded rather than queued
- Given two scenario rules have conflicting schedules for the same mentor, when both are evaluated in the same cycle, then both notifications are delivered but spaced at least 30 minutes apart to prevent notification flooding
- Given the edge function scheduler fails to run at the configured time, when it recovers, then it processes the missed evaluation within the next cycle without duplicating notifications already sent
Business Value
Notification timing significantly affects both open rates and user perception of the app. For a voluntary peer mentor workforce, intrusive out-of-hours notifications can damage engagement and cause opt-outs from the notification system entirely. By giving coordinators precise control over delivery windows, the system preserves the positive relationship between the organization and its volunteers while maintaining the effectiveness of automated follow-up.
Components
- Scenario Configuration Screen ui
- Scenario Prompt Scheduler Service service
- Scenario Edge Function Scheduler infrastructure
- Scenario Evaluation Edge Function infrastructure
- Scenario Configuration Manager service
- Scenario Rule Repository data
- Scenario Evaluation Configuration infrastructure
- Push Notification Dispatcher infrastructure