alert.py 1.76 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
"""
    schemas: Alert message sent on fault detection
"""
alert_schema = {
    "type": "object",
    "properties": {
        "message_type": {
            "type": "string",
            "description": "Type of message",
            "example": "alert",
            "enum": ["alert"],
        },
13
        "code": {
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
            "type": "integer",
            "description": "Alert code",
            "example": 345,
        },
        "platform_ID": {
            "type": "string",
            "description": "Unique identifier for this platform",
            "example": "usvdecibel",
        },
        "platform_timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp for onboard platform status message",
            "example": "2022-12-21T00:00:00Z",
        },
29
        "subsystem": {
30 31
            "type": "string",
            "description": "System that generated the alert",
Dan Jones's avatar
Dan Jones committed
32
            "example": "Onboard Fault Monitor",
33 34 35 36 37 38 39 40 41
        },
        "summary": {
            "type": "string",
            "description": "High level description of the alert",
            "example": "Steering Damage - Port Side",
        },
        "details": {
            "type": "string",
            "description": "Detailed reason for the alert ",
Dan Jones's avatar
Dan Jones committed
42 43
            "example": "Discrepancy between rudder and actuator positions"
            + " : Rudder Pos=10.31°, Steering Actuator Pos=28.65°, Discrepancy=18.33°",
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
        },
        "severity": {
            "type": "string",
            "description": "Severity level of alert",
            "example": "Alarm",
            "enum": ["Emergency", "Alarm", "Warning", "Caution"],
        },
    },
    "required": [
        "message_type",
        "platform_ID",
        "code",
        "severity",
    ],
}