Difference between revisions of "Observation enrichment"

From AMTech WikiDocs
Jump to: navigation, search
(Placeholders substitution)
(Geolocation substitution)
Line 19: Line 19:
 
=== Geolocation substitution ===
 
=== Geolocation substitution ===
  
This is about doing placeholder substitution of a group of geolocation attributes than can be determined by using the <code>location</code> field of an observation. Based on the [[WKT]] that is given in the <code>location</code> field, a process of reverse geolocation is run and the address is determined when possible. These fields are then replaced if they appear in the <code>topic</code>, <code>producer</code> or <code>targetthings</code> fields of the original observation JSON.
+
This is about doing placeholder substitution of a group of geolocation attributes than can be determined by using the <code>[[location]]</code> field of an observation. Based on the [[location|WKT]] that is given in the <code>location</code> field, a process of reverse geolocation is run and the address is determined when possible. These fields are then replaced if they appear in the <code>topic</code>, <code>producer</code> or <code>targetthings</code> fields of the original observation JSON.
  
 
* <code>#{country}</code> or <code>#{country_code}</code>
 
* <code>#{country}</code> or <code>#{country_code}</code>

Revision as of 10:42, 14 March 2016

The enrichment of observations is a group of actions and/or replacements that take place over an observation in the process of delivering it ot its final destination or topic. They are placeholder substitutions, geolocation substitutions, proximity updates.

Placeholders substitution

A placeholder is a string with format #{placeholder_name} than can be used in certain fields of an observation where the placeholders substitution takes place. Actually there are three fields where this kind of substitution is considered:

  • topic
  • producer
  • targetthings

Some substitutions occur in the process of building the observation in applications in the edge like the M2M Bridge and others occur after the observation is sent to the AMTech's platform. This is mostly geolocation fields substitutions which is a special kind of placeholder substitution.

These are a couple of placeholders substitution that run in the M2MBridge:

  • Access control placeholders
    • #{tenantId}
    • #{userId}

Geolocation substitution

This is about doing placeholder substitution of a group of geolocation attributes than can be determined by using the location field of an observation. Based on the WKT that is given in the location field, a process of reverse geolocation is run and the address is determined when possible. These fields are then replaced if they appear in the topic, producer or targetthings fields of the original observation JSON.

  • #{country} or #{country_code}
  • #{state} or </code>#{province}</code>
  • #{postcode} or #{postal code} or #{zip code}
  • #{city} or #{town}
  • #{suburb} or #{residential} or #{city_district} or #{municipality} or #{neighbourhood}

Proximity updates

A proximity update is executed when an observation arrives to the system containing information about proximity in its targetthings field. For instance:

{
  ...
  "targetthings": "[{
                      \"thingType\": \"/amtech/linkeddata/types/composite/entity/smartphone\", 
                      \"thingsId\": [\"main_phone_1\"],
                      \"proximityarea\": \"/some/uri/for/proximity/thing\"
                    }]",
  ...
}

Using this information, the field proximityarea of the thing /amtech/things/entities/smartphone/main_phone_1 is updated with the given proximityarea in the observation.