Recommended solution to store historical dates

Hi there,
I’m looking for some recommendations on how to deal with historical events such as past maintenance tasks.
My goal is to store all historical services performed on the machines my IoTs are connected to. This information is used to establish a predictive maintenance schedule.

My first idea is to use the Data Tables where I could store the dates as a number. I understand this is not recommended for time series data, hence my interrogation.

My second idea is to use a device attribute, but I would need to manipulate the timestamp of the device state (service history comes from a manual user entry). Also, the values would be lost after 30 days, which doesn’t work for me since I want to keep the entire service history.

Any recommendations?

Hello @Jules_Huguenin,

Welcome to the Losant Forums, we’re happy to have you here!

Also, the values would be lost after 30 days, which doesn’t work for me since I want to keep the entire service history.

Is the 30 day limit you mention here referring to Data Retention limits? If so, that is correct for Sandbox customers. This limit is more flexible for Losant Enterprise Customers.

The second idea you presented, using Device Attributes, is our recommended best practice when dealing with Time Series data. Historical Device State is able to be updated, but only up to 30 days in the past.

There are some more advanced options that you can leverage to accomplish this. They include using a Notebook to generate a file, or using an external database (like SQL) to add that information when events occur.

I’d be happy to discuss these options in more detail, so please let me know if you would like to!

Thank you,
Heath

1 Like

Hi @Heath,
Thanks for your reply, yes I’d like to know more about the Notebook option.
Cheers
Jules

@Jules_Huguenin,

This solution requires knowledge of writing Jupyter Notebooks.

Using Losant Notebooks would require you to store the events in an attribute as you have mentioned. Using a Timer Node and then a Notebook: Execution node to execute a Notebook on an interval. Then, in another workflow, using a Notebook Trigger and the Notebook Custom File Output, the workflow will receive a link to download the file that the Notebook created.

There is some information about a similar process in this post, and this post.

Please let me know if you have any more questions!

Thank you,
Heath

Thanks @Heath, I’ll dive into this now