0

I would like to be able to modelize OBD devices measurements (gps data, speed) and events (hard acceleration, deceleration, violent turn, ...) by journey. It's important to be able to retrieve this measurements/events or compute aggregation by journey.

How can I manage that? Currently events and measurements are directly linked to managedObject and it not possible to query the API on custom properties (I thought I could add the journeyId as custom property of each measurements but even with this workaround I can't filter on this field).

Maybe I can manage journey as childDevice? Is it the best way to modelize?

1 Answers1

0

One way to do it would be to include the journeyId as a custom property but as the key.

E.g.

{ 
  "source": "...",
  "type": "...",
  "c8y_SpeedMeasurement": { "speed": { "value": 90, "unit": "km/h"}},
  "journey12345": {}
}

12345 would be the journeyId.

That way you can query /measurement/measurements?fragmentType=journey12345

Of course you should think about storage because measurements are what you will have a lot of.

Managing the journeys as own managedObjects and create the measurements with the journey object as source is a valid option. But in this case the measurement would not be assigned to the device and therefore also not be visible in the default UI as device measurements. Instead of childDevices childAssets would probably be more fitting for the journeys (they are not really devices). The source of a measurement does not have to be a "device". It can be any managedObject.

TyrManuZ
  • 2,039
  • 1
  • 14
  • 23
  • I don't need to be able to visualize the measurements in the default UI so I think it's more efficient to manage journeys as childAssets. In this way I can link measurements but also events to the journey. Thanks a lot for your reply. – Thomas Lallement May 23 '16 at 12:57