Transformations

Manufacturing Data Engine (MDE) provides a straightforward way to do post-processing of messages during ingestion and generate new derived tags and records from the input messages. These post-processors are called transformations. They can be associated to a given type and generate new messages that are then re-ingested in MDE. transformations are built-in Dataflow pipelines and can be configured using certain specific transformation parameters.

MDE 1.3 and later versions provide two default transformations:

  • Group Event Change
  • Windowing

transformations are activated at the type level. This implies that all tags that belong to that type will be transformed. A type can be associated to none, one or more than one transformations. The association between the type and a specific transformation can be set up in the web interface and using the configuration API. A type can be associated to a transformation at any given time and that association can also be removed whenever is no longer needed.

A transformation might need transformation parameters to define its specific behavior. The transformation parameters are specific to each transformation type and can be different from one transformation to another.

The specific transformation parameter values for a given transformation are set at type level too. Different types can use different parameter values and use the same transformation differently.

Transformations receive all messages mapped to the type as input where the transformation is active. Each message is processed by the transformation processor in Dataflow.

The output of any transformation is a raw JSON message that is ingested in the initial landing topic. MDE provides a unique configuration package with each transformation. This configuration package needs to be applied to MDE if you are planning to use the transformation. The configuration package creates a set of a message class, parser, type and metadata bucket collection. These configuration entities allow MDE to identify and process the transformation output messages into a specific type. transformation-specific types store the information emitted by the transformation. They are also associated to specific transformation Metadata Buckets storing reference information about the original transformed tag or Record.

The two types provided to process the raw messages generated by each transformation are the following:

  • group-event-change-records: Destination type for the output messages of group event change transformation.
  • window-transformation-records: Destination type for the output messages of windowing transformation.

Group event change transformation

This transformation monitors any field in a tag or a group of tags and generates an event every time the monitored values changes in any of those tags. This transformation can be associated to a type of any archetype. The transformation appears in the web interface as eventChange.

This transformation emits a message that is parsed to a specific CONTINUOUS_DATA_SERIES type named group-event-change-records provided in its associated configuration package. The type contains the start time and end time of the period between value changes as well as the previous value, the current value and the name of the tag that triggered the change.

You can define a group of tags of the same type to be monitored together. You can chose a key criteria to define how to group tags. All tags where the key has the same value are monitored together. The value of the key can be any element of the tag proto, including any data field and any element of the metadata.

To make the transformation work for an individual tag the key is set to the TagName.

Parameters

The two transformation parameters required to configure this transformation are the following:

  1. Key Expression: It is displayed in the web interface as keyExpression. Defines the expression that will be used to group tags. All tags where key expression has the same value are monitored together. The transformation emits a value change event every time a change is detected in any of those tags. The values are compared to the previous values of the same tag, but an event is triggered when any of the tags changes. The key expression is defined as an SpEL expression and can use any of the available fields in the tag proto. For example, to only monitor a single tag based on the tag name, the SpEL expression would be defined as:

    #message['tagName']
    

    Alternatively, to group tags based on a common metadata field, like machine name (assuming an asset-hierarchy bucket exists with an attribute called machine-name in it), the expression can be set to:

    #message['metadata']['asset-hierarchy']['machine-name']
    
  2. Value Expression: It is displayed in the web interface as valueExpression. Defines the value field that the transformation monitors to emit a new change event. It is also defined as an SpEL expression. The expression can use any field of the tag proto structure. The output of the expression must be of type