PoseiDAT / schemas

The core schemas for the PoseiDAT data interchange formats
MIT License
1 stars 5 forks source link

feat(ais): added ais messages and ais entry #32

Closed Nielsien closed 3 days ago

Nielsien commented 3 years ago

In this pull request I created a new entry for AIS messages and the first schema for such a message.

But before I want to add all the other message schema's I wanted to discuss the preferred way of handling such an entry. So this pull request does not need to merged yet, since I'll add more message schema's after this.

The way I did it in this pr is that an AIS message has a AisMessageEntry which is very similar to the DeviceMeasurementEntry. In this case each entry has his message object which contains the required properties for each message with all the schemas in seperate objects.

So another way to do this is to implement the AIS messages in the device-measurement.json, since these have almost the same construct apart from the value.

Like so (in device-measurement.json):

"properties": {
    "entry_type": {
      "description": "The journal entry type identifer",
      "type": "string",
      "enum": [
        "device-measurement"
      ],
      "default": "device-measurement"
    },
    "device_id": {
      "type": "string",
      "description": "The unique identifier for the device"
    },
    "value": {
      "description": "The registered measurement for the device",
      "$ref": "https://poseidat.org/schema/core/measurement/measurement-value.json"
    },
    "ais_message": {
      "description": "The message send by the AIS device",
      "$ref": "https://poseidat.org/schema/core/ais-message/ais-message.json"
    }
  },
  "oneOf": [
    {  "required": [ "entry_type", "device_id", "value" ]},
    {  "required": [ "entry_type", "device_id", "ais_message"]}
  ],

In this case the ais gets sent like a measurement from a device.

Another way to do it is use the entry_type setup where we have a entry for each AIS message type. So for example entry-ais-position-report.ts where the entry_type decides which schema to use.

Qwerios commented 3 years ago

Looking at the structure and trying to understand it. What would make sense to me would be to:

So much like a measurement entry an AIS message entry can be added to the journal and the contents will further specify what type it is.

Nielsien commented 3 years ago

Thanks again! When I have time this week I'll finish the schemas

Nielsien commented 2 years ago

Found some time to finish this pr

Qwerios commented 3 days ago

Closing this PR due to age. Please re-open if needed