Internet of Things Analytics in 10 minutes

SlicingDice Team
SlicingDice.com Blog
6 min readApr 20, 2017

Go from zero to IoT analytics hero in less than 10 minutes, without managing any infrastructure or worrying about data modeling and size.

This guide will show how to use SlicingDice for IoT analytics, a Serverless Data Warehouse and Analytics Database as a Service.

Everyday SlicingDice receives more than 1.1 billion data inserts and millions of queries from multiple indie devs and companies, many of them doing analytics on top of Internet of Things data, such as sensors.

Scenario description

Let’s imagine you collect data from Internet-enabled devices (IoT) and want to use it to run analytics and make data-oriented decisions.

Example of IoT-related questions we want to answer:

  1. What is the average airplane fuel consumption per air route?
  2. What is the number of delivered packages in the last 48 hours?

Sending your IoT data to SlicingDice

Sending data to SlicingDice is very simple and fast. You can use our easy-to-use API or any of our clients available in Python, Ruby, JavaScript, Java, .NET/C#, PHP, Go and Arduino.

In order to send your data, first you simply need to:
1. Define what your entity is going to be. We consider an entity to be like a car, a sensor, a server and so on. That’s basically a way of saying: who owns the data? So looking the first question above, the data is clearly produced by airplanes, and on the second, each package would be an entity.

2. Once you know what is your entity, you simply need to specify the attributes (columns) and values you want to associate to your entities.

Check this data insertion example below

Pro Tip: Click here to generate a personal free demo API Key, so you can copy & paste all the cURL command examples below on your own terminal and play with it live using our /test endpoint.

In this example our entities are airplanes and we will be inserting the traveled routes and the airplane fuel consumption for each route traveled.

Looking this data insertion command above, we can clearly see that we have two airplane entities: airplane-01 and airplane-02.

For these two entities we associated two columns: latest-traveled-route and route-consumed-fuel.

As you can see, both entities airplane-01 and airplane-02 have the same columns latest-traveled-route and route-consumed-fuel, but each with different values.

What is happening here is that you are telling SlicingDice that the latest-traveled-route of the entity airplane-01 was “beijing-paris” and also that the route-consumed-fuel was “51230.1” for the date “2017–xx–xxT05:52:38Z”, “57680.3” on “2017–xx–xxT04:26:20Z” and so on.

The exactly same thing is happening for the entity airplane-02, but in a different route and with different dates and fuel consumption values.

Before starting to query this data, let’s see another insertion example:
Again: if you paste your personal demo API key on this cURL command below and execute it on your terminal, it will really work. Go ahead and try yourself.

In this example below our entities are packages and we will be inserting the delivery status for each of them.

Again, we can clearly see that we have three package entities: package-01, package-02 and package-03.

All entities are sharing the same column called package-status, although each entity has its own values and dates associated to the column.

What is happening here is that you are telling SlicingDice to store that the entity package-01 got a package-status as “received” on date “2017–xx–xxT03:35:20Z” and also as “delivered” on date “2017–xx–xxT03:56:52Z”. So package-01 was first “received” and then 21 minutes later “delivered”.

That’s it. Simple like that. As we now have some data stored, let’s answer the questions we defined in the beginning of this post:

  1. What is the average airplane fuel consumption per air route?
  2. What is the number of delivered packages in the last 48 hours?

Querying your data

Making queries on SlicingDice is simple and easy. It’s possible to do multiple types of analysis using our API and you can get to speed by seeing all the ready-to-use query examples we have on our Github clients repositories for Python, Ruby, JavaScript, Java, .NET/C#, PHP, and Go.

In order to answer the question What is the average airplane fuel consumption per air route? we will be making an aggregation analysis.

Aggregation is a powerful way to cross data in order to find insights and unexpected patterns. You can think about it like being an Excel Pivot Table.

What is happening on this aggregation query below is that we are asking SlicingDice to retrieve the Top 5 most common values from the “latest-traveled-route” and then for each value get the average of the “route-consumed-fuel” values that took place between “now” and “1 month ago”.

Based on the data we inserted before, if you run this query above on your own terminal, you should be able to see these results below:

As you can see, the results are basically showing the average fuel consumption per airplane route. You can answer a lot of questions using aggregations and more importantly, discover insights out of your data.

Now let’s answer the second question we have: What is the number of delivered packages in the 48 hours?. We can easily answer this question by using the count entities analysis.

Count entities is a simply and fast way to know how many unique entities (packages) you have that satisfies some set of conditions you define.

Let’s take as example our query below, what is happening here is that we want to know how many unique packages (entities) have the “package-status” as “delivered” between “now” and “48 hour ago”.

Note that we are putting a name for this query (number-of-delivered-packages) because our API accepts making multiple count queries in a single request.

Based on the data we inserted before, if you run this query above on your own terminal, you should be able to see these results below:

As you can see, the results are basically showing the quantity of packages that were delivered in the last 48 hours.

Now, if you want to know what package exactly was delivered, you can simply make this result data extraction query below:

As you can see below, it’s showing that package-01 and package-02 are the packages that were delivered.

What other questions and analysis can I make?

SlicingDice supports multiple types of data analysis, so you can basically answer any kind of question you may need for analytics purposes, for example:

  • What is the average temperature by day of week from sensors that are from NY or CA and that registered temperatures higher than 40º for the past 24 hours?
  • What is the min, max and average of gas consumption by road terrain, external temperature and truck size?

You nailed it, hero! — Next steps

That’s it. You are now ready to start making as much IoT analysis as you want.
If you are inclined to think that SlicingDice might work for you, we suggest you take a look on our documentation and at least follow our quickstart guide.

Please, don’t hesitate to contact our developer support team at any time, for any reason. We are here to support your needs.

Loved it… but, how much does it cost?

Our price is really innovative and cheap. We charge based on the quantity of columns you have, doesn’t matter how many rows you store for them.

So for example you can store unlimited data on SlicingDice for these two use cases presented above (airplanes and package data) for less $ 10.00 per month. It’s true. Check our website pricing page.

Why SlicingDice?

Developers want to store and query their data, but they hate having to manage complex data infrastructure, so we do it for them.
All they have to do is simply store and query billions of real-time and historical data, without managing any infrastructure.

High availability?
You don’t need to worry. We always replicate and backup your data on three different datacenters, located in France, Canada and Germany.

Query speed?
If any query takes longer than 10 seconds to complete, no matter the query complexity or data size, you receive a 10¢ discount for each query. We believe ensuring fast queries is our responsibility, not yours.

Not sure if we can support your IoT needs?

Click here and schedule a 15-minute talk with our developers, totally free of charge, so we can evaluate your case together.

Don’t know how to model your data in order to send it to SlicingDice?
No problem at all, schedule a time so we can talk or let’s chat online now.

--

--

SlicingDice Team
SlicingDice.com Blog

Dev team of SlicingDice — Serverless Data Warehouse and Analytics Database-as-a-service