Skip to main content

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:

  1. Receives an alert event
  2. Looks up subscribed users from the user repository
  3. Creates notification records for each user, grouped by their delivery preference (email, SMS, or both)

SendNotificationMessage​

Sends the actual notifications:

  1. HTTP-triggered with API key validation (not JWT β€” designed for machine-to-machine calls)
  2. Looks up user contact details
  3. Renders the email template with dynamic data
  4. Sends via IEmailService (email), ISmsService (SMS), and/or IPhoneCallService (phone call)

PollCondorApi​

Polls the Condor AI detection API on a 1-minute timer for smoke and fire detections:

  1. Requests recent detections from the Condor API (smoke and fire categories)
  2. Groups results by camera and queues them for processing
  3. Matches camera events to devices via DeviceId or StreamId
  4. Creates or updates Condor event documents in Cosmos DB
  5. Upserts CondorCameraEvent records in SQL Server
  6. Bulk-inserts COCO detections and COCO annotations linked to each event
  7. Updates camera operational flags (HasAiDetectionHit, HasRecent60DetectionHit, HasRecentPanoDetectionHit)
  8. Broadcasts the latest detection to connected frontend clients via SignalR

ProcessCameraEventsDequeue​

Processes camera events from the ai-detection-processor queue:

  1. Deserializes queued camera events
  2. Delegates to the same processing pipeline as PollCondorApi

PhoneCallbackFunction​

Handles phone call lifecycle events from Azure Communication Services:

  1. Receives CloudEvent[] callbacks per alert type (Anomaly, Point of Interest, Report of Fire, Confirmed Fire, Burn Job, Custom)
  2. On CallConnected β€” plays a text-to-speech notification message 3 times
  3. On PlayCompleted or PlayFailed β€” 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:

TableSource DTOKey Fields
COCODetectionCocoDetectionDTOCondorCameraEventId, CategoryId, Score, BBox
COCOAnnotationCocoAnnotationDTOCondorCameraEventId, CategoryId, Score, BBox, Segmentation, Area

Documentation Sections​