Basic configuration

The standard Manufacturing Data Engine (MDE) deployment doesn't apply any configuration settings by default, which are needed to start ingesting data.

This guide walks you through a basic MDE setup. For example, for testing that the system works end to end. With this guide you can create Message Classes, Types and Parsers for all three Archetypes.

If you intend to use Manufacturing Connect edge (MCe) to ingest data, deploy the default configuration package instead.

You can use either the MDE API or the web interface to complete this configuration.

Message Classes

This section provides examples of the message classes available in MDE.

Message class for numeric

The following is an example of a basic-numeric message class:

REST

POST /configuration/v1/message-classes

{
   "name": "basic-numeric",
   "priority": 2000,
   "expression": "#root.event['value'] instanceof T(Number) && #root.event['timestamp'] != null && #root.event['tagName'] != null"
}

Web interface

Message Class Name: basic-numeric

  1. On the MDE web interface, click Message Classes.
  2. Click Add new Message Class.
  3. Fill in the Message Class name as basic-numeric.
  4. Copy the following expression and paste it on the Expression box:

       #root.event['value'] instanceof T(Number) && #root.event['timestamp'] != null && #root.event['tagName'] != null
    
  5. Change the priority to 2000.

  6. Click Create.

    Basic-numeric MC

Message class for discrete

The following is an example of a basic-discrete message class:

REST

POST /configuration/v1/message-classes

   {
      "name": "basic-discrete",
      "priority": 1975,
      "expression": "#root.event['value'] != null && !(#root.event['value'] instanceof T(Number)) && #root.event['timestamp'] != null && #root.event['tagName'] != null"
   }

Web interface

Message Class Name: basic-discrete

  1. On the MDE web interface, click Message Classes.
  2. Click Add new Message Class.
  3. Fill in the Message Class name as basic-discrete.
  4. Copy the following expression and paste it on the Expression box:

       #root.event['value'] != null && !(#root.event['value'] instanceof T(Number)) && #root.event['timestamp'] != null  && #root.event['tagName'] != null
    
  5. Change the priority to 1975.

  6. Click Create.

    Basic-discrete MC

Message class for continuous

The following is an example of a basic-continuous message class:

REST

POST /configuration/v1/message-classes

   {
      "name": "basic-continuous",
      "priority": 1950,
      "expression": "#root.event['value'] != null && !(#root.event['value'] instanceof T(Number)) && #root.event['startTimestamp'] != null && #root.event['endTimestamp'] != null && #root.event['tagName'] != null"
   }

Web interface

Message Class Name: basic-continuous

  1. On the MDE web interface, click Message Classes.
  2. Click Add new Message Class.
  3. Fill in the Message Class name as basic-continuous.
  4. Copy the following expression and paste it on the Expression box:

    #root.event['value'] != null && !(#root.event['value'] instanceof T(Number)) && #root.event['startTimestamp'] != null && #root.event['endTimestamp'] != null && #root.event['tagName'] != null
    
  5. Change the priority to 1950.

  6. Click Create.

    Basic-continuous MC

Types

This section provides an overview of the Types available in MDE.

Type for numeric

The following is an example of a basic-numeric Type:

REST

POST /configuration/v1/types

{
   "archetype": "NUMERIC_DATA_SERIES",
   "name": "basic-numeric"
}

Web interface

Name: basic-numeric

  1. On the MDE web interface, click Types.
  2. Click Add new Type.
  3. Fill in the Type name as basic-numeric.
  4. Select NUMERIC_DATA_SERIES in the drop-down for Archetype:

    Basic-numeric Type

  5. Open the Storage Settings section.

  6. Toggle the Send to BigQuery option.

  7. Click Create.

Type for discrete

The following is an example of a basic-discrete Type:

REST

POST /configuration/v1/types

{
   "archetype": "DISCRETE_DATA_SERIES",
   "name": "basic-discrete"
}

Web interface

Name: basic-discrete

  1. On the MDE web interface, click Types.
  2. Click Add new Type.
  3. Fill in the Type name as basic-discrete.
  4. Select `DISCRETE_DATA_SERIES in the drop-down for Archetype:

    Basic-discrete Type

  5. Open the Storage Settings section.

  6. Toggle the Send to BigQuery option.

  7. Click Create.

Type for continuous

The following is an example of a basic-continuous Type:

REST

POST /configuration/v1/types

{
   "archetype": "CONTINUOUS_DATA_SERIES",
   "name": "basic-continuous"
}

Web interface

Name: basic-continuous

  1. On the MDE web interface, click Types.
  2. Click Add new Type.
  3. Fill in the Type name as basic-continuous.
  4. Select `CONTINUOUS_DATA_SERIES in the drop-down for Archetype:

    Basic-continuous Type

  5. Open the Storage Settings section.

  6. Toggle the Send to BigQuery option.

  7. Click Create.

Parsers

This section provides an overview of the various Parses available in MDE. Make sure that the Types are fully provisioned and active before creating the parsers. This process can take up to three minutes.

Parser for numeric

The following is an example of a basic-numeric Parser:

REST

POST /configuration/v1/parsers

{
   "name": "basic-numeric-to-basic-numeric",
   "messageClassName": "basic-numeric",
   "typeReference": {
         "name": "basic-numeric",
         "version": 1
   },
   "script": "package mde\n\n[{\ntagName: $root.tagName;\ntimestamps: MapTimestamp($root);\ndata: MapData($root);\nembeddedMetadata: $root[where ($.field != \"value\" and $.field != \"tagName\" and $.field != \"timestamp\" and $.field != \"messageId\")];\n}]\n\ndef MapTimestamp(input) {\n    eventTimestamp: input.timestamp;\n}\n\ndef MapData(input) {\n    numeric: input.value;\n}"
}

Web interface

Name: basic-numeric-to-basic-numeric

  1. On the MDE web interface, click Parsers.
  2. Click Add new Parser.
  3. Fill in the Parser name as basic-numeric-to-basic-numeric.
  4. Select basic-numeric in the drop-down for Message Class Name.
  5. Copy and paste the following Whistle code in the Parser box:

     package mde
    
     [{
     tagName: $root.tagName;
     timestamps: MapTimestamp($root);
     data: MapData($root);
     embeddedMetadata: $root[where ($.field != "value" and $.field != "tagName" and $.field != "timestamp" and $.field != "messageId")];
     }]
    
     def MapTimestamp(input) {
        eventTimestamp: input.timestamp;
     }
    
     def MapData(input) {
        numeric: input.value;
     }
    
  6. Select basic-numeric | version: 1 in the drop-down for Type.

  7. Click Create.

    Basic-numeric Parser

Parser for discrete

The following is an example of a basic-discrete Parser:

REST

POST /configuration/v1/parsers

{
   "name": "basic-discrete-to-basic-discrete",
   "messageClassName": "basic-discrete",
   "typeReference": {
         "name": "basic-discrete",
         "version": 1
   },
   "script": "package mde\n\n[{\ntagName: $root.tagName;\ntimestamps: MapTimestamp($root);\ndata: MapData($root);\nembeddedMetadata: $root[where ($.field != \"value\" and $.field != \"tagName\" and $.field != \"timestamp\" and $.field != \"messageId\")];\n}]\n\ndef MapTimestamp(input) {\n    eventTimestamp: input.timestamp;\n}\n\ndef MapData(input) {\n    complex: input.value;\n}\n"
}

Web interface

Name: basic-discrete-to-basic-discrete

  1. On the MDE web interface, click Parsers.
  2. Click Add new Parser.
  3. Fill in the Parser name as basic-numeric-to-basic-discrete.
  4. Select basic-discrete in the drop-down for Message Class Name.
  5. Copy and paste the following Whistle code in the Parser box:

     package mde
    
     [{
     tagName: $root.tagName;
     timestamps: MapTimestamp($root);
     data: MapData($root);
     embeddedMetadata: $root[where ($.field != "value" and $.field != "tagName" and $.field != "timestamp" and $.field != "messageId")];
     }]
    
     def MapTimestamp(input) {
        eventTimestamp: input.timestamp;
     }
    
     def MapData(input) {
        complex: input.value;
     }
    
  6. Select basic-discrete | version: 1 in the drop-down for Type.

  7. Click Create.

    Basic-discrete Parser

Parser for continuous

The following is an example of a basic-continuous Parser:

REST

POST /configuration/v1/parsers

{
   "name": "basic-continuous-to-basic-continuous",
   "messageClassName": "basic-continuous",
   "typeReference": {
         "name": "basic-continuous",
         "version": 1
   },
   "script": "package mde\n\n[{\ntagName: $root.tagName;\ntimestamps: MapTimestamp($root);\ndata: MapData($root);\nduration: $root.duration;\nembeddedMetadata: $root[where ($.field != \"value\" and $.field != \"tagName\" and $.field != \"startTimestamp\" and $.field != \"endTimestamp\" and $.field != \"messageId\")];\n}]\n\ndef MapTimestamp(input) {\n    continuousTimestamp: {\n        eventTimestampStart: input.startTimestamp;\n        eventTimestampEnd: input.endTimestamp;\n    };\n}\n\ndef MapData(input) {\n    complex: input.value;\n}\n"
}

Web interface

Name: basic-continuous-to-basic-continuous

  1. On the MDE web interface, click Parsers.
  2. Click Add new Parser.
  3. Fill in the Parser name as basic-numeric-to-basic-continuous.
  4. Select basic-continuous in the drop-down for Message Class Name.
  5. Copy and paste the following Whistle code in the Parser box:

     package mde
    
     [{
     tagName: $root.tagName;
     timestamps: MapTimestamp($root);
     data: MapData($root);
     duration: $root.duration;
     embeddedMetadata: $root[where ($.field != "value" and $.field != "tagName" and $.field != "startTimestamp" and $.field != "endTimestamp" and $.field != "messageId")];
     }]
    
     def MapTimestamp(input) {
        continuousTimestamp: {
           eventTimestampStart: input.startTimestamp;
           eventTimestampEnd: input.endTimestamp;
        };
     }
    
     def MapData(input) {
        complex: input.value;
     }
    
  6. Select basic-continuous | version: 1 in the drop-down for Type.

  7. Click Create.

    Basic-continuous Parser