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
create_emergency_alert()- Trigger new emergencycancel_emergency_alert()- Cancel active emergencyget_all_emergencies()- Retrieve all emergenciesbroadcast_emergency()- Broadcast to all userssend_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
-
Parse Emergency Data
Location:emergency_on_controller.py:77 -
Add Emergency Remark
Location:emergency_on_controller.py:69 -
Filter by Distance
Location:emergency_on_controller.py:114 - Broadcast to Recipients
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
Retrieving Emergencies
Method:get_all_emergencies()Location:
emergency_facade.py:118
Broadcasting Emergencies
Method:broadcast_emergency()Location:
emergency_facade.py:127
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
- Remark Addition: Automatically adds “CALL 911 NOW” to alerts
- Distance Filtering: Limits recipients to those within range
- Validation: Validates user permissions and locations
- 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 configurationEMERGENCY_ALERT- Alert configurationBASE_OBJECT_NAME- Base object type (“Event”)ACTION_MAPPING_PATH- External action mappingsINTERNAL_ACTION_MAPPING_PATH- Internal action mappings
Best Practices
- Geographic Filtering: Configure appropriate distance thresholds
- Validation: Validate user locations before filtering
- Logging: Log all emergency events for audit trail
- Testing: Test emergency workflows regularly
- Cancellation: Always cancel resolved emergencies
- 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
Related Components
- Mission - Emergency context in missions
- CoT Manager - CoT message routing
- Track Manager - User location tracking