Simple analytics

we have a real-time demo, eg. in this video

that we now want to add simple analytics:

  1. show speeding vehicles, eg. faster than 70 mph,
    eg. something in their icon

  2. show an alarm if any vehicle is stopped for more
    than a threshold time period, eg. 5 minutes. It means
    that either there’s bad traffic, or some break down.

Thanks for any pointers.

1 Like

Hi @gambitcomm

  1. I would recommend you to have the “location” parameter in the speed variable and use this variable on the map.
    So you need to end having something like this:
    “variable”: “speed”,
    “value”: 40,
    “speed”: “km’h”,
    “location”: { lat: , lng }

This way you have access to the “value” for each variable in the map. Today if you want to change the Icon or the color you would need to use the Payload Parser in the device or an Analysis to edit this variable and add the parameter “metadata”. You can use the snippet “Temperature Converter” in the Payload Parser to see how to edit data that is coming in.

TagoIO plan to release at 15th a feature in which you can setup the colors/icons based on the value using the map widget setup. So it should become must easier to do this simple logic.

  1. This seems like something you need to use an Analysis to do the job for you. Analysis can setup to run in interval times, like 1 run/minute. In each run you can collect the last speed variable from the device and compare the time with the current time to see the difference and send an alarm based.

TagoIO supports the “moment” library, which allow us to handler time in easier way. The “Device Offline Alert” snippet for Analysis uses it in lines 55 and 61, so it’s a good example of how to apply it to your use case.

Hope my answer helps you!

1 Like

For number 2, is it done thru Device Offline Alert snippet on Analysis?

Yes. It is the “Device Offline Alert” analysis snippet