observation.py 1.94 KB
Newer Older
1
"""
2 3
    schema: Observation Message sent by platforms when points of
    interest are found.
4 5
"""

6 7 8 9 10
hits_schema = {
    "type": "object",
    "properties": {
        "latitude": {
            "type": "number",
11
            "format": "float",
12
            "description": "Identified y-coordinate of point of interest",
13 14 15 16
            "example": 178.2,
        },
        "longitude": {
            "type": "number",
17
            "format": "float",
18
            "description": "Identified x-coordinate of point of interest",
19 20 21 22
            "example": -10.122,
        },
        "quality_of_point": {
            "type": "number",
23
            "format": "float",
24
            "description": "Quality/strength of points from features of"
25
            + " interest identified by platform.",  # TODO: DEFINE FORMAT.
26 27 28
            "example": 0.98,
        },
    },
29
    "required": ["latitude", "longitude"],
30 31
}

32 33 34
observation_schema = {
    "type": "object",
    "properties": {
35 36 37 38
        "message_type": {
            "type": "string",
            "description": "Type of message",
            "example": "observation",
39
            "enum": ["observation"],
40 41
        },
        "platform_ID": {
42 43 44
            "type": "string",
            "description": "Unique identifier for this platform",
            "example": "reav-x-1",
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
        },
        "points_of_interest": {
            "type": "array",
            "items": hits_schema,
            "description": "Points from features of interest identified by"
            + " platform if any found.",  # TODO: DEFINE FORMAT.
        },
        "region_surveyed": {
            "nullable": True,
            "description": "Region surveyed by given platform."
            + " GEOJSON",  # TODO: DEFINE FORMAT.
            "example": "",
        },
        "additional_data": {
            "description": "Placeholder field for any additional data",
            "example": {"sensor_payload": False},
61
        },
62
    },
63
    "required": ["message_type", "platform_ID"],
64
}