observation.py 1.79 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 13 14 15 16
            "description": "Identified x-coordinate of point of interest",
            "example": 178.2,
        },
        "longitude": {
            "type": "number",
17
            "format": "float",
18 19 20 21 22
            "description": "Identified y-coordinate of point of interest",
            "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
observation_schema = {
33
    "allOf": [{"$ref": "#/components/schemas/Message"}],
34 35
    "type": "object",
    "properties": {
36 37 38
        "platform_ID": {
            "type": "integer",
            "description": "ID of platform to sending observations",
39
            "example": 2,
40 41
        },
        "points_of_interest": {
42 43
            "type": "array",
            "items": hits_schema,
44
            "description": "Points from features of interest identified by"
45
            + " platform if any found.",  # TODO: DEFINE FORMAT.
46 47
        },
        "region_surveyed": {
48 49 50
            "type": "null",
            "description": "Region surveyed by given platform."
            + " GEOJSON",  # TODO: DEFINE FORMAT.
51 52 53 54 55 56
            "example": "",
        },
        "additional_data": {
            "description": "Placeholder field for any additional data",
            "example": {"sensor_payload": False},
        },
57
    },
58
    "required": ["platform_ID"],
59
}