Cannonball Statistics

Get aggregated statistics for Cannonball detections

GET /api/v1/cannonball/stats/

Returns aggregated statistics for Cannonball detections over time. Statistics are stored at different time granularities for trend analysis.

Query Parameters

ParameterTypeDescription
periodstringPeriod type: hourly, daily, weekly, monthly (default: hourly)
daysintegerNumber of days to include (default: 7)
user_onlybooleanOnly show user-specific stats (default: false)
period_typestringFilter by period type

Response

{
  "stats": [
    {
      "id": 1,
      "period_type": "hourly",
      "period_start": "2024-01-15T12:00:00Z",
      "period_end": "2024-01-15T13:00:00Z",
      "total_detections": 25,
      "unique_aircraft": 8,
      "critical_alerts": 2,
      "warning_alerts": 5,
      "info_alerts": 12,
      "circling_patterns": 4,
      "loitering_patterns": 2,
      "grid_search_patterns": 1,
      "speed_trap_patterns": 1,
      "top_aircraft": [
        {"icao_hex": "A12345", "count": 5},
        {"icao_hex": "A67890", "count": 3}
      ],
      "top_agencies": [
        {"agency": "LAPD", "count": 8},
        {"agency": "CHP", "count": 4}
      ],
      "created_at": "2024-01-15T13:00:00Z"
    }
  ],
  "count": 168,
  "summary": {
    "total_detections": 450,
    "total_alerts": 125
  }
}

Stats Object Fields

FieldTypeDescription
idintegerStats record ID
period_typestringTime period granularity
period_startstringPeriod start timestamp
period_endstringPeriod end timestamp
total_detectionsintegerTotal LE aircraft detections
unique_aircraftintegerUnique aircraft detected
critical_alertsintegerCritical alerts generated
warning_alertsintegerWarning alerts generated
info_alertsintegerInfo alerts generated
circling_patternsintegerCircling patterns detected
loitering_patternsintegerLoitering patterns detected
grid_search_patternsintegerGrid search patterns detected
speed_trap_patternsintegerSpeed trap patterns detected
top_aircraftarrayMost frequently detected aircraft
top_agenciesarrayMost frequently detected agencies
created_atstringStats record creation timestamp

Example Request

curl -X GET "https://api.skyspy.io/api/v1/cannonball/stats/?period=daily&days=30" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response Codes

CodeDescription
200Success
401Unauthorized - Invalid or missing authentication

Summary Endpoint

GET /api/v1/cannonball/stats/summary/

Get a current summary of Cannonball activity.

Response:

{
  "current": {
    "active_sessions": 3,
    "threats": 5
  },
  "today": {
    "alerts": 25,
    "patterns": 12
  },
  "week": {
    "sessions": 150,
    "alerts": 320
  },
  "timestamp": "2024-01-15T12:30:00Z"
}

Summary Fields

FieldTypeDescription
current.active_sessionsintegerCurrently active tracking sessions
current.threatsintegerCurrent cached threat count
today.alertsintegerAlerts generated today
today.patternsintegerPatterns detected today
week.sessionsintegerSessions started this week
week.alertsintegerAlerts generated this week
timestampstringCurrent server timestamp