Skip to main content

Overview

The Emergency component provides comprehensive emergency alert management for FreeTAKServer. It handles the creation, broadcasting, and cancellation of emergency alerts, enabling rapid response coordination across the TAK ecosystem. The component includes geographic filtering, automated notifications, and integration with other FreeTAKServer components.

Architecture

Component Structure

Key Classes

Emergency Facade

Location: FreeTAKServer/components/extended/emergency/emergency_facade.py:32
Public Methods:
  • create_emergency_alert() - Trigger new emergency
  • cancel_emergency_alert() - Cancel active emergency
  • get_all_emergencies() - Retrieve all emergencies
  • broadcast_emergency() - Broadcast to all users
  • send_emergencies_to_client() - Send to specific client

EmergencyOnController

Location: FreeTAKServer/components/extended/emergency/controllers/emergency_on_controller.py:28 Handles emergency activation logic:

Core Functionality

Creating Emergency Alerts

Method: create_emergency_alert()
Location: emergency_facade.py:113
The emergency creation process:
  1. Parse Emergency Data
    Location: emergency_on_controller.py:77
  2. Add Emergency Remark
    Location: emergency_on_controller.py:69
  3. Filter by Distance
    Location: emergency_on_controller.py:114
  4. Broadcast to Recipients
Usage Example:

Geographic Filtering

The Emergency component includes distance-based filtering to notify only nearby users:

Canceling Emergency Alerts

Method: cancel_emergency_alert()
Location: emergency_facade.py:123
Usage Example:

Retrieving Emergencies

Method: get_all_emergencies()
Location: emergency_facade.py:118

Broadcasting Emergencies

Method: broadcast_emergency()
Location: emergency_facade.py:127
Method: send_emergencies_to_client()
Location: emergency_facade.py:131

Emergency Types

The component supports standard TAK emergency types:
  • 911 Alert: General emergency requiring immediate response
  • Ring The Bell: Alert without specific emergency type
  • Troops In Contact: Combat emergency
  • Custom: User-defined emergency types

Emergency CoT Structure

Emergency alerts are represented as CoT events:

Business Rules

The Emergency component uses business rules for: Configuration: EMERGENCY_ON_BUSINESS_RULES_PATH
  1. Remark Addition: Automatically adds “CALL 911 NOW” to alerts
  2. Distance Filtering: Limits recipients to those within range
  3. Validation: Validates user permissions and locations
  4. Routing: Determines appropriate distribution channels

Persistence

Controller: EmergencyPersistence Stores emergency records for:
  • Audit trail
  • Historical analysis
  • After-action review
  • Legal documentation

Integration with Services

Service Manager Integration

Emergencies are routed through the Service Manager:

CoT Integration

Emergency alerts are CoT messages with:
  • Event type: b-a-o-tbl (emergency beacon)
  • How: h-g-i-g-o (user generated)
  • Emergency detail element

Complete Workflow Example

Configuration

File: emergency_constants.py Key constants:
  • EMERGENCY_ON_BUSINESS_RULES_PATH - Business rules configuration
  • EMERGENCY_ALERT - Alert configuration
  • BASE_OBJECT_NAME - Base object type (“Event”)
  • ACTION_MAPPING_PATH - External action mappings
  • INTERNAL_ACTION_MAPPING_PATH - Internal action mappings

Best Practices

  1. Geographic Filtering: Configure appropriate distance thresholds
  2. Validation: Validate user locations before filtering
  3. Logging: Log all emergency events for audit trail
  4. Testing: Test emergency workflows regularly
  5. Cancellation: Always cancel resolved emergencies
  6. Remarks: Use clear, actionable remarks in emergency messages

Error Handling

Monitoring and Analytics

Track emergency metrics:
  • Emergency frequency by type
  • Response times
  • Geographic distribution
  • User response patterns