Is it possible to enrich or aggregate the telemetry sent using an external API?

Damian4 years ago

Hi, I have a device that reports the IMEI number, and I also have an API that for each IMEI retrieves additional info like device brand and model.

I was wondering if Traccar has some mechanism to enrich generic data, I've looked in the code but i didn't find something like that.

Otherwise I think I should handle this before POSTing the telemetry to Traccar.

Anton Tananaev4 years ago

Device brand and model doesn't sounds like telemetry data. It's part of the device model, which you can update via the API.

Damian4 years ago

Thanks for the quick response.

I've misused the term "telemetry". The current scenario is that the unique identifiers are the mobile numbers, and the IMEI may change for any device at some point in time. That's why I thought on saving the device model and brand as an attribute of the positition: to see the IMEI, brand and model on that specific point in time.

Anton Tananaev4 years ago

You can probably use computed attributes to inject additional data.

Damian4 years ago

I understand.

And regarding the automation of IMEI info enrichment, i was thinking on using the FORWARD_URL configuration to trigger the update.

Do you think it's a right approach?

Anton Tananaev4 years ago

I'm not sure I understand what you're trying to do. Are you trying to forward data to or from Traccar?

Damian4 years ago

Sorry i didn't expain myself correctly.

My end goal would be to have the device model, brand and some other attributes in Traccar. This process of enriching the IMEI should be automated because of the big amount of devices.

Based on what you are telling me and what I've looked in the code and documentation, I was thinking in forwarding the Position to my API, then enrich the data, and finally update the Position attributes via the Traccar API.

I was wondering if you think this is a good approach.

Anton Tananaev4 years ago

What I'm suggesting is to automatically create/link computed attributes through Traccar API.

Damian4 years ago

Yes, but I don't see how will I be able to make an HTTP request through the computed attributes.

The device sends IMEI, and my external API returns model, brand, and other info. I cannot infer all this data just by what the device is sending.

Anton Tananaev4 years ago

Maybe I'm missing something, but why do you need to check it on every request? Won't you just change values once physical device is replaced?

Damian4 years ago

You are right, it is a waste of resources doing it on every request. I think I will handle this enrichment stuff before sending the data to Traccar.

Thank you for your time Anton, very much appreciated.