title: Data Modelling in cassandra for IOT
body: <p>We are trying to use Apache Cassandra in an IoT based application. We are planning to create a device  abstraction.  Any user shall be able to define a device with a series of  attributes. For each attribute, the user shall be able to define a series of properties  like  <strong>name , data type , minimum value , maximum value etc.</strong></p>
  
  <p>Some examples of devices are given below</p>
  
  <p><strong>Vehicle</strong></p>
  
  <p>The vehicle can have the following attributes</p>
  
  <ol>
  <li>Speed [name :- speed , data type:- double , minimum value :- 0 , maximum value :-300]</li>
  <li>Latitude [name :- speed , data :- double , minimum :- -90 , maximum :-90] </li>
  <li>Longitude[name :- Longitude, data :- double , minimum :- -180 , maximum :- 180]</li>
  </ol>
  
  <p><strong>Temperature Sensor</strong></p>
  
  <p>The temperature sensor can have the following attributes</p>
  
  <ol>
  <li>Current Temperature[name :- Current Temperation, data type:- double , minimum value :- 0 , maximum value :-300]</li>
  <li>Unit  [name :- Unit , datatype:-string]</li>
  </ol>
  
  <p>In real time , each device will be sending data as key value pairs  . </p>
  
  <p>For ex:- A <strong>Vehicle</strong> can send the following data </p>
  
  <p>Time :- 6/4/2016 11:15:15.150 , Latitude : -1.256 , Longitude :- -180.75, Speed :- 50</p>
  
  <p>Time :- 6/4/2016 11:15:16.150 , Latitude : -1.257 , Longitude :- -181.75, Speed :- 51</p>
  
  <p>For ex:- A <strong>Temperature sensor</strong> can send the following data </p>
  
  <p>Time :- 6/4/2016 11:15:15.150 , Current Temperature: 100, Unit : farenheit</p>
  
  <p>Time :- 6/4/2016 11:15:16.150 , Latitude : 101 , Unit : farenheit</p>
  
  <p>Since the attributes of different devices can be different , we are confused on how the model the tables in cassandra... Some of the options that came to mind are <strong>creating a table for a device, or create a single table and store the values in Map data types... We are little confused on which approach should be taken...
  Any suggestions is appreciated</strong></p>