Safety Events & Alerts

Safety Events & Alert System

Real-time flight safety monitoring with intelligent alerting - Detect emergencies, TCAS events, and custom conditions as they happen.


Overview

SkysPy provides a powerful dual-layer alert and monitoring system:

FeatureDescription
Automated Safety MonitoringReal-time detection of dangerous flight conditions, TCAS events, and emergency squawks
Custom Alert RulesUser-defined rules with flexible conditions, scheduling, and multi-channel notifications

Both systems integrate with Socket.IO streaming for real-time notifications and support enterprise features including role-based access control, notification channels, and audit history.


Safety Events

What Are Safety Events?

Safety events are automatically detected anomalies in aircraft behavior that may indicate dangerous situations. The SafetyMonitor service continuously analyzes incoming ADS-B data to identify potential safety concerns.

flowchart LR
    A[📡 ADS-B Data] --> B{Safety Monitor}
    B --> C[🔴 Emergency Squawk]
    B --> D[⚡ TCAS RA]
    B --> E[📉 Extreme VS]
    B --> F[✈️ Proximity Conflict]
    C & D & E & F --> G[🔔 Alert Dispatch]
    G --> H[📱 Socket.IO]
    G --> I[📧 Notifications]

Types of Safety Events

Event TypeIconDescriptionSeverity
squawk_hijackSOSAircraft squawking 7500 (hijack code)Critical
squawk_radio_failureRadioAircraft squawking 7600 (radio failure)Warning
squawk_emergencyAlertAircraft squawking 7700 (general emergency)Critical
tcas_raLightningSuspected TCAS Resolution Advisory - rapid VS reversal indicating collision avoidanceCritical
vs_reversalChartSignificant vertical speed reversal without TCAS-level magnitudeWarning / Low
extreme_vsDownVertical speed exceeding 6,000 fpm (configurable)Low - Critical
proximity_conflictPlanesTwo aircraft within dangerous proximity (< 1nm horizontal, < 1000ft vertical)Warning - Critical

Severity Levels

Critical

Immediate attention required

  • Emergency squawks (7500, 7700)
  • TCAS Resolution Advisories
  • Very close proximity conflicts
  • Extreme vertical rates

Critical events trigger immediate notifications and are highlighted prominently in the UI.

Warning

Notable events requiring awareness

  • Radio failure squawks (7600)
  • Moderate proximity conflicts
  • Significant VS reversals

Warning events are logged and displayed but may not require immediate action.

Low

Informational events for logging

  • Minor anomalies
  • Informational VS changes
  • Events filtered by smart detection

Low severity events are primarily for record-keeping and analysis.


Detection Thresholds

Quick Setup - Configure these thresholds in your Django settings.py to tune sensitivity.

# Django settings.py
SAFETY_MONITORING_ENABLED = True
SAFETY_VS_CHANGE_THRESHOLD = 3000      # fpm - triggers VS reversal detection
SAFETY_VS_EXTREME_THRESHOLD = 6000     # fpm - triggers extreme VS event
SAFETY_PROXIMITY_NM = 1.0              # nautical miles - horizontal proximity
SAFETY_ALTITUDE_DIFF_FT = 1000         # feet - vertical separation
SAFETY_CLOSURE_RATE_KT = 100           # knots - minimum closure rate
SAFETY_TCAS_VS_THRESHOLD = 1500        # fpm - magnitude for TCAS RA detection
SettingDefaultDescription
SAFETY_VS_CHANGE_THRESHOLD3000 fpmMinimum VS change to trigger reversal detection
SAFETY_VS_EXTREME_THRESHOLD6000 fpmThreshold for extreme vertical speed events
SAFETY_PROXIMITY_NM1.0 nmHorizontal separation for proximity alerts
SAFETY_ALTITUDE_DIFF_FT1000 ftVertical separation for proximity alerts
SAFETY_TCAS_VS_THRESHOLD1500 fpmVS magnitude indicating TCAS RA

Safety Event Data Structure

View Complete Event Schema

Each safety event contains comprehensive data:

{
  "id": "tcas_ra:ABC123",
  "event_type": "tcas_ra",
  "severity": "critical",
  "icao_hex": "ABC123",
  "icao_hex_2": "DEF456",
  "callsign": "UAL123",
  "callsign_2": "DAL456",
  "message": "TCAS RA suspected: UAL123 VS reversed from -2500 to +2500 fpm",
  "timestamp": "2024-01-15T10:30:00Z",
  "acknowledged": false,
  "details": {
    "previous_vs": -2500,
    "current_vs": 2500,
    "vs_change": 5000,
    "altitude": 35000,
    "lat": 47.5,
    "lon": -122.3,
    "distance_nm": 0.8,
    "altitude_diff_ft": 400
  },
  "aircraft_snapshot": {
    "hex": "ABC123",
    "flight": "UAL123",
    "lat": 47.5,
    "lon": -122.3,
    "alt_baro": 35000,
    "gs": 450,
    "track": 180,
    "baro_rate": 2500,
    "squawk": "1200"
  }
}

Smart Filtering

Pro Tip - The safety monitor includes intelligent filtering to reduce false positives.

FilterDescription
Airport Proximity FilterIgnores low-altitude proximity events near major airports (takeoff/landing pairs)
Diverging Aircraft FilterSkips proximity alerts when aircraft are moving apart from each other
Takeoff VS FilterIgnores VS reversals during initial climb phase

Alert Rule System

Overview

Custom alert rules allow users to define specific conditions for notification:

flowchart TB
    subgraph Rule["📋 Alert Rule"]
        A[Conditions] --> B{Logic: AND/OR}
        B --> C[Group 1]
        B --> D[Group 2]
        C --> E[Condition 1]
        C --> F[Condition 2]
    end

    subgraph Evaluation["⚙️ Evaluation"]
        G[Aircraft Data] --> H{Rule Engine}
        Rule --> H
        H --> I{Match?}
    end

    I -->|Yes| J[🔔 Trigger Alert]
    I -->|No| K[Continue Monitoring]

    J --> L[Check Cooldown]
    L --> M[📤 Send Notifications]
FeatureDescription
Complex ConditionsAND/OR logic with multiple condition groups
SchedulingStart/expiration times and suppression windows
CooldownsPrevent alert spam for the same aircraft
Multi-ChannelDiscord, Slack, Telegram, Email, and more
Visibility ControlPrivate, shared, or public rules
Live PreviewTest rules against current aircraft before saving

Alert Rule Builder

Basic Rule Structure

Quick Start - Here's a simple rule to detect military aircraft.

Basic Rule

{
  "name": "Military Aircraft Alert",
  "description": "Alert when military aircraft are detected",
  "priority": "warning",
  "enabled": true,
  "cooldown": 300,
  "conditions": {
    "logic": "AND",
    "groups": [
      {
        "logic": "AND",
        "conditions": [
          {
            "type": "military",
            "operator": "eq",
            "value": "true"
          }
        ]
      }
    ]
  }
}

Complex Multi-Condition

{
  "name": "Low Flying Helicopter Near Me",
  "description": "Alert when helicopters fly low within 5nm",
  "priority": "info",
  "enabled": true,
  "cooldown": 300,
  "conditions": {
    "logic": "AND",
    "groups": [
      {
        "logic": "AND",
        "conditions": [
          { "type": "helicopter", "operator": "eq", "value": "true" },
          { "type": "altitude_below", "operator": "lt", "value": "2000" },
          { "type": "distance_within", "operator": "lte", "value": "5" }
        ]
      }
    ]
  }
}

OR Logic Example

{
  "name": "Track N12345 or UAL Flights",
  "priority": "info",
  "conditions": {
    "logic": "OR",
    "groups": [
      {
        "logic": "AND",
        "conditions": [
          { "type": "registration", "operator": "eq", "value": "N12345" }
        ]
      },
      {
        "logic": "AND",
        "conditions": [
          { "type": "callsign", "operator": "startswith", "value": "UAL" }
        ]
      }
    ]
  }
}

Condition Types

Aircraft Identity

TypeDescriptionExample ValueOperators
icao / hexAircraft ICAO hex codeA12345eq, neq, contains, startswith, endswith
callsignFlight callsignUAL123eq, neq, contains, startswith, endswith
registrationAircraft registrationN12345eq, neq, contains, startswith, endswith
type / aircraft_typeAircraft type codeB738eq, neq, contains, startswith, endswith
categoryADS-B categoryA3eq, neq

Flight Data

TypeDescriptionExample ValueOperators
altitude_aboveAltitude floor (ft)10000N/A (implicit >)
altitude_belowAltitude ceiling (ft)5000N/A (implicit <)
altitudeExact altitude comparison35000eq, lt, gt, lte, gte
speed_aboveGround speed floor (kts)300N/A (implicit >)
speed_belowGround speed ceiling (kts)100N/A (implicit <)
speedExact speed comparison250eq, lt, gt, lte, gte
vertical_rateVertical rate (fpm)-2000eq, lt, gt, lte, gte

Location

TypeDescriptionExample ValueOperators
distance_withinDistance from feeder (nm)10N/A (implicit <=)
distance_from_mobileDistance from mobile GPS (nm)5N/A (implicit <=)

Classifications

TypeDescriptionExample ValueOperators
militaryMilitary aircraft flagtrueeq (boolean)
emergencyEmergency squawk activetrueeq (boolean)
law_enforcementLaw enforcement aircrafttrueeq (boolean)
helicopterRotorcraft categorytrueeq (boolean)
squawkTransponder squawk code7700eq, neq

Available Operators

String Operators

OperatorLabelExampleDescription
eqequalscallsign eq "UAL123"Exact match (case-insensitive)
neqnot equalstype neq "B738"Does not match
containscontainscallsign contains "UAL"Value contains substring
startswithstarts withcallsign startswith "DAL"Value starts with string
endswithends withregistration endswith "AB"Value ends with string
regexregex matchcallsign regex "^[A-Z]{3}\d+"Regular expression match

Numeric Operators

OperatorSymbolExampleDescription
eq=altitude eq 35000Equal to
lt<altitude lt 10000Less than
gt>speed gt 500Greater than
lte<=distance_within lte 5Less than or equal
gte>=altitude gte 20000Greater than or equal

Rule Templates

Quick Start - Use these pre-built templates for common use cases.

TemplateDescriptionPriority
Military AircraftDetect military aircraft in your airspaceWarning
Emergency SquawkEmergency codes 7500/7600/7700Critical
Low Flying AircraftAircraft below 2,000 ftInfo
Nearby AircraftAircraft within 5nm of your locationInfo
Helicopter ActivityAny helicopter detectionInfo
Law EnforcementPolice/government aircraftWarning

Scheduling & Suppression

Time-Based Scheduling

Rules can have start and expiration times:

{
  "name": "Air Show Alert",
  "starts_at": "2024-07-04T10:00:00Z",
  "expires_at": "2024-07-04T18:00:00Z",
  "conditions": { }
}

Suppression Windows

Prevent alerts during specific times:

{
  "name": "Night Alert",
  "suppression_windows": [
    {
      "day": "saturday",
      "start": "22:00",
      "end": "08:00"
    },
    {
      "day": "sunday",
      "start": "22:00",
      "end": "08:00"
    }
  ]
}

Cooldowns

Best Practice - Use cooldowns to prevent alert fatigue.

The cooldown system prevents alert spam:

FeatureDescription
Per-Aircraft CooldownSame aircraft won't trigger the same rule within the cooldown period
Distributed CooldownsRedis-backed cooldowns work across multiple workers
Default5 minutes (300 seconds)

Notification Channels

Supported Channel Types

ChannelDescriptionConfiguration
DiscordRich embeds with colors and fieldswebhook_id, webhook_token
SlackRich message attachmentstoken_a, token_b, token_c
TelegramInstant mobile notificationsbot_token, chat_id
EmailSMTP email deliveryuser, password, smtp_host, recipient
PushoverPush notificationsuser_key, api_token
ntfy.shSimple pub/sub notificationstopic
Home AssistantSmart home integrationhost, access_token
WebhookGeneric JSON webhookwebhook_url
Twilio SMSSMS text messagesaccount_sid, auth_token, from_phone, to_phone
CustomCustom Apprise URLapprise_url

Channel Configuration

Creating a Notification Channel

POST /api/v1/notifications/channels/

{
  "name": "My Discord Server",
  "channel_type": "discord",
  "apprise_url": "discord://webhook_id/webhook_token",
  "enabled": true,
  "is_global": false
}

Assigning Channels to Rules

{
  "name": "Emergency Alert",
  "notification_channel_ids": [1, 2, 5],
  "use_global_notifications": true,
  "conditions": { }
}

Global vs Rule-Specific Notifications

TypeDescriptionConfiguration
Global NotificationsApply to all rules by defaultAPPRISE_URLS environment variable (semicolon-separated)
Rule-SpecificChannels attached directly to rulesnotification_channel_ids in rule
use_global_notificationsWhen true, rule also sends to global configDefault: true

Alert History & Management

Viewing Alert History

Alert history is accessible via API and Socket.IO, with filtering by:

  • Time range (hours)
  • Severity/priority
  • Rule ID
  • ICAO hex
  • Acknowledged status

Acknowledgment Workflow

flowchart LR
    A[📥 Incoming Alerts] --> B[📋 View Unacknowledged]
    B --> C{Review Alert}
    C --> D[✅ Acknowledge Single]
    C --> E[✅ Acknowledge All]
    C --> F[📤 Export CSV]
    D & E --> G[📁 Archived]

Aggregation

For high-volume rules, alerts are aggregated into time windows to reduce noise:

{
  "rule_name": "Military Aircraft",
  "window_start": "2024-01-15T10:00:00Z",
  "window_end": "2024-01-15T11:00:00Z",
  "trigger_count": 45,
  "unique_aircraft": 12,
  "sample_aircraft": [
    {"icao_hex": "AE1234", "callsign": "RCH123"},
    {"icao_hex": "AE5678", "callsign": "RCH456"}
  ]
}

API Reference

Alert Rules

List & Get

List Rules

GET /api/v1/alerts/rules/

Query parameters:

  • enabled: Filter by enabled status
  • priority: Filter by priority (info/warning/critical)
  • visibility: Filter by visibility (private/shared/public)

Get Rule

GET /api/v1/alerts/rules/{id}/

Create & Update

Create Rule

POST /api/v1/alerts/rules/

Update Rule

PATCH /api/v1/alerts/rules/{id}/

Delete Rule

DELETE /api/v1/alerts/rules/{id}/

Actions

Toggle Rule

POST /api/v1/alerts/rules/{id}/toggle/

Test Rule

POST /api/v1/alerts/rules/test/

{
  "rule": {
    "type": "military",
    "operator": "eq",
    "value": "true"
  },
  "aircraft": [
    {"hex": "AE1234", "military": true},
    {"hex": "A12345", "military": false}
  ]
}

Response:

{
  "would_match": 1,
  "matched_aircraft": [{"hex": "AE1234", "military": true}],
  "rule_valid": true,
  "aircraft_tested": 2
}

Bulk Operations

Bulk Create

POST /api/v1/alerts/rules/bulk_create/

{
  "rules": [{ }, { }]
}

Bulk Delete

POST /api/v1/alerts/rules/bulk_delete/

{
  "rule_ids": [1, 2, 3]
}

Bulk Toggle

POST /api/v1/alerts/rules/bulk_toggle/

{
  "rule_ids": [1, 2, 3],
  "enabled": true
}

Export/Import

Export

GET /api/v1/alerts/rules/export/

Import

POST /api/v1/alerts/rules/import/

{
  "rules": [{ }],
  "replace_all": false
}

Alert History

EndpointMethodDescription
/api/v1/alerts/history/GETList history with filters
/api/v1/alerts/history/{id}/acknowledge/POSTAcknowledge single alert
/api/v1/alerts/history/acknowledge-all/POSTAcknowledge all alerts
/api/v1/alerts/history/clear/DELETEClear history
/api/v1/alerts/history/aggregated/GETGet aggregated history

Query Parameters for List:

  • hours: Time range (default: 24)
  • rule_id: Filter by rule
  • icao_hex: Filter by aircraft
  • priority: Filter by priority
  • acknowledged: Filter by acknowledged status
  • limit: Pagination limit
  • offset: Pagination offset

Subscriptions

EndpointMethodDescription
/api/v1/alerts/subscriptions/GETList subscriptions
/api/v1/alerts/subscriptions/POSTSubscribe to rule
/api/v1/alerts/subscriptions/{rule_id}/DELETEUnsubscribe
{
  "rule_id": 123,
  "notify_on_trigger": true
}

Safety Events

EndpointMethodDescription
/api/v1/safety/events/GETList events
/api/v1/safety/events/stats/GETGet statistics
/api/v1/safety/events/{id}/acknowledge/POSTAcknowledge event
Statistics Response Example
{
  "monitoring_enabled": true,
  "thresholds": {
    "vs_change_threshold": 3000,
    "vs_extreme_threshold": 6000,
    "proximity_nm": 1.0,
    "altitude_diff_ft": 1000
  },
  "time_range_hours": 24,
  "events_by_type": {
    "tcas_ra": 5,
    "proximity_conflict": 12,
    "extreme_vs": 8
  },
  "events_by_severity": {
    "critical": 7,
    "warning": 10,
    "low": 8
  },
  "total_events": 25,
  "unique_aircraft": 18,
  "event_rate_per_hour": 1.04
}

Notification Channels

EndpointMethodDescription
/api/v1/notifications/channels/GETList channels
/api/v1/notifications/channels/types/GETGet channel types
/api/v1/notifications/channels/POSTCreate channel
/api/v1/notifications/channels/{id}/test/POSTTest channel

Socket.IO Alert Streaming

Connection

Connect to the alerts Socket.IO namespace:

import { io } from 'socket.io-client';

const socket = io('https://your-skyspy-instance/alerts', {
  path: '/socket.io/',
  transports: ['websocket', 'polling']
});

Event Types

Subscribe

socket.emit('subscribe', { topic: 'alerts' });

Alert Triggered

socket.on('alert:triggered', (data) => {
  console.log(data);
  // {
  //   "rule_id": 123,
  //   "rule_name": "Military Aircraft",
  //   "icao": "AE1234",
  //   "callsign": "RCH123",
  //   "message": "Alert 'Military Aircraft' triggered for RCH123",
  //   "priority": "warning",
  //   "aircraft": { },
  //   "timestamp": "2024-01-15T10:30:00Z"
  // }
});

Safety Event

socket.on('safety_event', (data) => {
  console.log(data);
  // {
  //   "event_type": "tcas_ra",
  //   "severity": "critical",
  //   "icao_hex": "ABC123",
  //   "message": "TCAS RA suspected: ...",
  //   "timestamp": "2024-01-15T10:30:00Z"
  // }
});

Snapshot

socket.on('alert:snapshot', (data) => {
  console.log(data);
  // {
  //   "alerts": [],
  //   "count": 20,
  //   "timestamp": "2024-01-15T10:30:00Z"
  // }
});

Request/Response Pattern

Request:

socket.emit('request', {
  request_id: 'req-123',
  request_type: 'alerts',
  params: {
    hours: 24,
    limit: 50
  }
});

Response:

socket.on('response', (data) => {
  console.log(data);
  // {
  //   "request_id": "req-123",
  //   "request_type": "alerts",
  //   "data": []
  // }
});

Available Request Types

Request TypeDescriptionParameters
alertsGet alert historyhours, limit
alert-rulesGet active rules-
alert-statsGet statistics-
alert-countGet unacknowledged countacknowledged
my-subscriptionsGet user's subscriptions-
acknowledge-alertAcknowledge single alertid
acknowledge-all-alertsAcknowledge all-

User-Specific Channels

Authenticated users automatically join:

  • alerts_user_{user_id} - Private alerts for owned rules
  • alerts_session_{session_key} - Session-based alerts for anonymous users

Custom Rule Examples

Track Specific Aircraft
{
  "name": "Track N12345",
  "priority": "info",
  "cooldown": 60,
  "conditions": {
    "logic": "OR",
    "groups": [
      {
        "logic": "AND",
        "conditions": [
          { "type": "registration", "operator": "eq", "value": "N12345" }
        ]
      },
      {
        "logic": "AND",
        "conditions": [
          { "type": "icao", "operator": "eq", "value": "A12345" }
        ]
      }
    ]
  }
}
Emergency Detection with Cooldown
{
  "name": "All Emergencies",
  "priority": "critical",
  "cooldown": 30,
  "conditions": {
    "logic": "AND",
    "groups": [
      {
        "logic": "AND",
        "conditions": [
          { "type": "emergency", "operator": "eq", "value": "true" }
        ]
      }
    ]
  },
  "notification_channel_ids": [1, 2],
  "use_global_notifications": true
}
Low-Flying Aircraft Near Location
{
  "name": "Low Flyers Near Home",
  "priority": "info",
  "cooldown": 300,
  "conditions": {
    "logic": "AND",
    "groups": [
      {
        "logic": "AND",
        "conditions": [
          { "type": "altitude_below", "operator": "lt", "value": "3000" },
          { "type": "distance_within", "operator": "lte", "value": "5" }
        ]
      }
    ]
  }
}
Police Helicopter Activity
{
  "name": "Police Helicopter Alert",
  "priority": "warning",
  "cooldown": 600,
  "conditions": {
    "logic": "AND",
    "groups": [
      {
        "logic": "AND",
        "conditions": [
          { "type": "law_enforcement", "operator": "eq", "value": "true" },
          { "type": "helicopter", "operator": "eq", "value": "true" },
          { "type": "distance_within", "operator": "lte", "value": "10" }
        ]
      }
    ]
  }
}
Fast-Moving Aircraft (Jets)
{
  "name": "Fast Movers",
  "priority": "info",
  "cooldown": 300,
  "conditions": {
    "logic": "AND",
    "groups": [
      {
        "logic": "AND",
        "conditions": [
          { "type": "speed_above", "operator": "gt", "value": "500" },
          { "type": "altitude_above", "operator": "gt", "value": "20000" }
        ]
      }
    ]
  }
}
Airline Prefix Match
{
  "name": "United Airlines",
  "priority": "info",
  "cooldown": 120,
  "conditions": {
    "logic": "AND",
    "groups": [
      {
        "logic": "AND",
        "conditions": [
          { "type": "callsign", "operator": "startswith", "value": "UAL" }
        ]
      }
    ]
  }
}
Multiple Aircraft Types
{
  "name": "Interesting Aircraft Types",
  "priority": "info",
  "cooldown": 300,
  "conditions": {
    "logic": "OR",
    "groups": [
      {
        "logic": "AND",
        "conditions": [
          { "type": "type", "operator": "eq", "value": "A380" }
        ]
      },
      {
        "logic": "AND",
        "conditions": [
          { "type": "type", "operator": "eq", "value": "B748" }
        ]
      },
      {
        "logic": "AND",
        "conditions": [
          { "type": "type", "operator": "eq", "value": "AN124" }
        ]
      }
    ]
  }
}
Mobile-Based Proximity Alert
{
  "name": "Aircraft Near Me (Mobile)",
  "description": "Alert when aircraft fly over my current GPS location",
  "priority": "info",
  "cooldown": 120,
  "conditions": {
    "logic": "AND",
    "groups": [
      {
        "logic": "AND",
        "conditions": [
          { "type": "distance_from_mobile", "operator": "lte", "value": "2" }
        ]
      }
    ]
  }
}
Scheduled Event Alert
{
  "name": "Air Show Weekend",
  "description": "Track military aircraft during air show",
  "priority": "info",
  "starts_at": "2024-07-04T09:00:00Z",
  "expires_at": "2024-07-06T18:00:00Z",
  "cooldown": 60,
  "conditions": {
    "logic": "AND",
    "groups": [
      {
        "logic": "AND",
        "conditions": [
          { "type": "military", "operator": "eq", "value": "true" },
          { "type": "distance_within", "operator": "lte", "value": "20" }
        ]
      }
    ]
  }
}

Access Control & Visibility

Rule Visibility Levels

LevelIconDescriptionWho Can SeeWho Can Edit
privateLockOwner onlyOwnerOwner
sharedGroupOwner + subscribersOwner, SubscribersOwner
publicGlobeEveryoneEveryoneOwner

Role-Based Permissions

PermissionDescription
alerts.manage_allFull access to all rules (admin)
alerts.viewView public/shared rules
alerts.createCreate new rules
alerts.subscribeSubscribe to shared rules

System Rules

System rules (is_system: true) are protected:

  • Cannot be deleted by regular users
  • Only superadmins can modify
  • Used for built-in safety monitoring

Best Practices

Rule Design

PracticeDescription
Start SpecificBegin with narrow conditions, expand if needed
Use CooldownsPrevent alert fatigue with appropriate cooldown periods
Test Before DeployUse the live preview and test endpoint
Layer PriorityReserve critical/warning for important events

Notification Strategy

Pro Tips

  1. Dedicated Channels - Create separate channels for different alert priorities
  2. Global + Specific - Use global config for critical alerts, rule-specific for others
  3. Test Channels - Always verify channels with test notifications

Performance

Important - Optimize for production environments.

TipDescription
Limit Active RulesMore rules = more CPU; disable unused rules
Use Efficient ConditionsICAO/callsign matches are faster than regex
Reasonable CooldownsShorter cooldowns increase processing load

Troubleshooting

Common Issues

Rule not triggering
  • Check if rule is enabled
  • Verify scheduling (starts_at/expires_at)
  • Check cooldown - may still be in cooldown period
  • Test rule against current aircraft
Notifications not sending
  • Test channel directly via API
  • Check Apprise URL format
  • Verify channel is enabled
  • Check use_global_notifications setting
Safety events missing
  • Verify SAFETY_MONITORING_ENABLED is true
  • Check thresholds aren't too restrictive
  • Ensure aircraft have required data (VS, altitude, position)

Debugging

Enable debug logging:

LOGGING = {
    'loggers': {
        'skyspy.services.alerts': {'level': 'DEBUG'},
        'skyspy.services.safety': {'level': 'DEBUG'},
    }
}

Check service status:

GET /api/v1/alerts/rules/metrics/

Related Documentation