Difference between revisions of "V2/Concepts/Intro to Measurement"

From Senfi Docs
Jump to: navigation, search
 
(10 intermediate revisions by the same user not shown)
Line 6: Line 6:
  
 
All these records are kept in a dataset called a ''measurement''. A measurement has a ''name'' (for display) and ''code'' (for integration).
 
All these records are kept in a dataset called a ''measurement''. A measurement has a ''name'' (for display) and ''code'' (for integration).
 +
 +
A Measurement has the following components:
  
 
=== Measurement Code ===
 
=== Measurement Code ===
Line 18: Line 20:
  
 
Take note that timestamp refers to when the reading or measurement is taken, not when it is sent. There can be cases where readings are taken first, and sent in a batch later. In this case, the timestamp of the measurement will be older than the time of sending.
 
Take note that timestamp refers to when the reading or measurement is taken, not when it is sent. There can be cases where readings are taken first, and sent in a batch later. In this case, the timestamp of the measurement will be older than the time of sending.
 +
 +
=== [[V2/Concepts/Intro to Tag|Tags]] ===
 +
A tag is like an attribute of the measurement sample. There are 2 types of tags:
 +
; Required tags: You can think of required tags as the "composite key" to a row in a database table. That is, the combination of required tags will help you to identify the sensor that produced the measurement.
 +
; Non-required tags: Non-required tags act as a form of annotation, or label.
 +
 +
Tag names can be a combination of lowercase alphanumeric characters and underscore. Tag values should be sent as strings. Tag values can be empty ("") but '''not null'''.
 +
 +
=== [[V2/Concepts/Intro to Metric|Metric]] ===
 +
 +
These can be raw values from the sensing device (eg. <tt>rain_level</tt>), or derived values (eg. <tt>is_flooding</tt>). You can decide to compute the derived values before sending, or send the raw values to Senfi and make use of [[V2/Concepts/Intro_to_Computed_Measurement|computed measurement]] to calculate it.
 +
 +
Similar to measurement, each metric has a ''name'' (for display), and a ''code'' (for integration). You should also specify a valid type for the metric.
 +
; Name: Any valid text (eg. ''Rain level'')
 +
; Code: Combination of lowercase alphanumeric characters and underscore (eg. <tt>rain_level</tt>)
 +
; Type: One of the following: boolean, float, integer, string
 +
; Unit: Unit associated to metric (e.g. ''millimeters'')
 +
; Readable: Decides if Metric can be read
 +
; Writable: Decides if Metric can be written into
 +
; Brick Point Class: Decides the Brick point class(es) that the Metric belongs to (View [https://brickschema.org/ontology/1.2/classes/Point here] for more information on Brick Point Class)
 +
 +
There are also options to choose if a Measurement has lift or movable metrics. These are specialized metrics built for lift Measurement or Measurement with moving properties (e.g. robot, position tracking).
 +
 +
<div class="important">Metric type cannot be changed after creation</div>
 +
 +
=== Access Group ===
 +
Allows Admin Users to limit access of Measurement to certain groups of Users.
 +
 +
=== Data Retention ===
 +
Decides how long the data will be retained in Senfi before it is purged.
 +
 +
==== What's Next ====
 +
-----
 +
* [[V2/Concepts/Intro to Metric|What is a Metric]]

Latest revision as of 22:31, 22 October 2021

Measurement

Senfi deals with time seriesdata that can originate from a device or a complex system. Each record in this time series consists of:

  • a timestamp indicating when the data was sampled (in milliseconds)
  • a fixed set of tags
  • a fixed set of metrics

All these records are kept in a dataset called a measurement. A measurement has a name (for display) and code (for integration).

A Measurement has the following components:

Measurement Code

A measurement code is a unique identifier of this measurement. You can use a combination of lowercase alphanumeric characters and underscore.

  • The naming convention of a measurement code is as follows: <vendor>_<system>_<version>
  • For example: nest_thermostat_v1. If you need to make changes to the measurement (eg. adding or removing metrics), you should create a new measurement with an incremented version, eg. nest_thermostat_v2.
A measurement code cannot be changed after creation

Timestamp

When sending a measurement to Senfi, timestamp is represented as tm_source, milliseconds since epoch.

Take note that timestamp refers to when the reading or measurement is taken, not when it is sent. There can be cases where readings are taken first, and sent in a batch later. In this case, the timestamp of the measurement will be older than the time of sending.

Tags

A tag is like an attribute of the measurement sample. There are 2 types of tags:

Required tags
You can think of required tags as the "composite key" to a row in a database table. That is, the combination of required tags will help you to identify the sensor that produced the measurement.
Non-required tags
Non-required tags act as a form of annotation, or label.

Tag names can be a combination of lowercase alphanumeric characters and underscore. Tag values should be sent as strings. Tag values can be empty ("") but not null.

Metric

These can be raw values from the sensing device (eg. rain_level), or derived values (eg. is_flooding). You can decide to compute the derived values before sending, or send the raw values to Senfi and make use of computed measurement to calculate it.

Similar to measurement, each metric has a name (for display), and a code (for integration). You should also specify a valid type for the metric.

Name
Any valid text (eg. Rain level)
Code
Combination of lowercase alphanumeric characters and underscore (eg. rain_level)
Type
One of the following: boolean, float, integer, string
Unit
Unit associated to metric (e.g. millimeters)
Readable
Decides if Metric can be read
Writable
Decides if Metric can be written into
Brick Point Class
Decides the Brick point class(es) that the Metric belongs to (View here for more information on Brick Point Class)

There are also options to choose if a Measurement has lift or movable metrics. These are specialized metrics built for lift Measurement or Measurement with moving properties (e.g. robot, position tracking).

Metric type cannot be changed after creation

Access Group

Allows Admin Users to limit access of Measurement to certain groups of Users.

Data Retention

Decides how long the data will be retained in Senfi before it is purged.

What's Next