User Tools

Site Tools


public:using_couchdb_for_temporal_data

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

public:using_couchdb_for_temporal_data [2018/02/19 17:41] (current)
admin created
Line 1: Line 1:
 +While I was not able to find a easy to understand and implement solution, I decided to use below approach that is simple and appropriate for my use case (that'​s pretty complicated),​ I will try to present simpler example bellow:
  
 +  * let's assume our use case implies a temperature reading sensor, a couchDB import script and a map function
 +  * each m minutes (more or less - it should not matter) info is read from server and saved into couchDB
 +  * each doc should have a metaData with two values: {validityStart:​ <​timestamp>,​ validityEnd:​ <​timestamp>​)
 +  * there are two kinds of DOCs:
 +    * current doc, using sensorId as key and {validityStart:​ <​timestamp>,​ validityEnd:​ 0)
 +    * archived doc, using uuid as key and {validityStart:​ <​timestamp>,​ validityEnd:​ <​timestamp>​)
 +  * each time a reading is done, 
 +    * if existing reading already existing for this sensor:
 +      * create new archived doc from current doc + updated validityEnd timestamp
 +    * update/​create current doc with new validityStart timestamp and new temperature
public/using_couchdb_for_temporal_data.txt ยท Last modified: 2018/02/19 17:41 by admin