Skip to content

Monitor sensors & alerts (Operator workflow)

This page is for operators who monitor occupancy sensors and respond to alerts.

Your goals

  • Ensure sensors are online and reporting accurate data.
  • Respond to capacity alerts and sensor issues.
  • Maintain data quality for public dashboards.

1) Sensor status monitoring

Viewing sensor status

  1. Navigate to Occupancy → Sensor Equipment in Django Admin.
  2. Check the sensor list for status indicators:
  3. Active + recent last_seen: Sensor is working
  4. ⚠️ Active + stale last_seen: May be offline
  5. Inactive: Sensor is disabled

Key fields to monitor

Field What it tells you
Device ID Unique sensor identifier
Sensor Type AI Camera or Infrared Counter
Is Active Whether sensor is enabled
Last Seen When sensor last reported data
Location Geographic position

Identifying offline sensors

Check for sensors where: - last_seen is more than 30 minutes old (threshold may vary) - Status is Active but no recent readings exist

2) Alert management

Types of alerts

Alert Type Severity Meaning
Capacity Warning Medium Occupancy approaching limit (e.g., 80%)
Capacity Critical High Occupancy at or exceeding limit
Sensor Offline Medium Sensor stopped reporting data
Data Anomaly Low Unusual patterns detected

Responding to alerts

  1. Navigate to Occupancy → Alerts in Django Admin.
  2. Review unresolved alerts (filter by is_resolved = False).
  3. Investigate the issue:
  4. For capacity alerts: Verify on-site conditions
  5. For sensor alerts: Check physical device or network
  6. For anomalies: Review raw data for patterns

  7. Take action:

  8. Dispatch staff if needed
  9. Contact technical support for sensor issues
  10. Adjust thresholds if alerts are too frequent

  11. Mark resolved:

  12. Set is_resolved = True
  13. Add resolution notes

Alert context

Each alert includes context data:

{
  "current_occupancy": 95,
  "capacity": 100,
  "percentage": 95.0,
  "threshold": 90
}

Use this to understand the severity and specifics.

3) Data quality checks

Verifying sensor readings

Periodically check that readings make sense:

  1. Navigate to Occupancy → Sensor Readings (if accessible).
  2. Filter by sensor and recent time range.
  3. Look for:
  4. Consistent data flow (no large gaps)
  5. Reasonable counts (not negative, not impossibly high)
  6. Correct object types being detected

Common data issues

Issue Possible cause Action
Negative occupancy Exit counted without entry Check gate configuration
Stuck at zero Sensor offline or misconfigured Verify sensor status
Unrealistic spikes Detection errors or vandalism Review camera footage
Missing data gaps Network or power issues Check infrastructure

4) Sensor maintenance coordination

When equipment module is enabled

If sensors are linked to Equipment records: - View maintenance history for each sensor - Schedule preventive maintenance - Track repair costs

Without equipment module

Keep manual records of: - Cleaning schedules (camera lenses) - Battery replacements (if applicable) - Firmware updates - Physical inspections

5) Ingestion error monitoring

Viewing ingestion errors

  1. Navigate to Occupancy → Ingestion Errors in Django Admin.
  2. Review recent errors by type:
  3. Connection errors: Network/database issues
  4. Parsing errors: Malformed data from sensors
  5. Validation errors: Data fails business rules
  6. Sensor not found: Unknown device ID
  7. Duplicate messages: Already processed

Handling errors

For each error: 1. Review the raw_data to understand what was received 2. Check error_message for specific failure reason 3. Determine if it's: - A transient issue (retry may work) - A configuration problem (needs fix) - A data quality issue (sensor misconfigured)

  1. Mark for retry or resolution as appropriate

6) Real-time monitoring

Using WebSocket feeds

The system supports real-time updates via WebSocket: - Dashboard shows live occupancy changes - Alerts appear immediately when triggered - No need to refresh pages

Monitoring during events

During high-traffic periods: - Monitor dashboards more frequently - Be ready to respond to capacity alerts - Coordinate with on-site staff

Behind the scenes (grounded in code)

  • Sensor model: apps/occupancy/models.pySensorEquipment
  • Alert model: apps/occupancy/models.pyOccupancyAlert
  • Ingestion errors: apps/occupancy/models.pyIngestionError
  • WebSocket: apps/occupancy/consumers.py
  • Alert checking: Background tasks in apps/occupancy/tasks.py