Notification
The Notification project (Alert.CA.Notification) is an Azure Functions v4 app that sends email, SMS, and phone call notifications to users when system alerts are triggered. It also polls the Condor AI detection API for smoke and fire events, persists detection data (including COCO detections and annotations), and broadcasts real-time updates to the frontend via SignalR.
Architectureβ
Functionsβ
CreateNotificationsβ
Converts alert events into notification records:
- Receives an alert event
- Looks up subscribed users from the user repository
- Creates notification records for each user, grouped by their delivery preference (email, SMS, or both)
SendNotificationMessageβ
Sends the actual notifications:
- HTTP-triggered with API key validation (not JWT β designed for machine-to-machine calls)
- Looks up user contact details
- Renders the email template with dynamic data
- Sends via
IEmailService(email),ISmsService(SMS), and/orIPhoneCallService(phone call)
PollCondorApiβ
Polls the Condor AI detection API on a 1-minute timer for smoke and fire detections:
- Requests recent detections from the Condor API (smoke and fire categories)
- Groups results by camera and queues them for processing
- Matches camera events to devices via
DeviceIdorStreamId - Creates or updates Condor event documents in Cosmos DB
- Upserts
CondorCameraEventrecords in SQL Server - Bulk-inserts COCO detections and COCO annotations linked to each event
- Updates camera operational flags (
HasAiDetectionHit,HasRecent60DetectionHit,HasRecentPanoDetectionHit) - Broadcasts the latest detection to connected frontend clients via SignalR
ProcessCameraEventsDequeueβ
Processes camera events from the ai-detection-processor queue:
- Deserializes queued camera events
- Delegates to the same processing pipeline as
PollCondorApi
PhoneCallbackFunctionβ
Handles phone call lifecycle events from Azure Communication Services:
- Receives
CloudEvent[]callbacks per alert type (Anomaly, Point of Interest, Report of Fire, Confirmed Fire, Burn Job, Custom) - On
CallConnectedβ plays a text-to-speech notification message 3 times - On
PlayCompletedorPlayFailedβ hangs up the call
Data Flow: COCO Detectionsβ
When a Condor detection event is processed, the COCO detection and annotation data from the payload is persisted:
| Table | Source DTO | Key Fields |
|---|---|---|
COCODetection | CocoDetectionDTO | CondorCameraEventId, CategoryId, Score, BBox |
COCOAnnotation | CocoAnnotationDTO | CondorCameraEventId, CategoryId, Score, BBox, Segmentation, Area |
Documentation Sectionsβ
- Notification Channels β Email, SMS, and phone call delivery
- API Key Authentication β HTTP function security model
- Email Templates β HTML template structure and variables
- Microsoft Graph Integration β User lookup via Graph API
- Condor AI Detection β Smoke/fire detection polling and COCO data persistence
- Phone Call Callbacks β Phone call lifecycle handling