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
- On the MDE web interface, click Message Classes.
- Click Add new Message Class.
- Fill in the Message Class name as
basic-numeric
. 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
Change the priority to
2000
.Click Create.
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
- On the MDE web interface, click Message Classes.
- Click Add new Message Class.
- Fill in the Message Class name as
basic-discrete
. 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
Change the priority to
1975
.Click Create.
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
- On the MDE web interface, click Message Classes.
- Click Add new Message Class.
- Fill in the Message Class name as
basic-continuous
. 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
Change the priority to
1950
.Click Create.
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
- On the MDE web interface, click Types.
- Click Add new Type.
- Fill in the Type name as
basic-numeric
. Select
NUMERIC_DATA_SERIES
in the drop-down for Archetype:Open the Storage Settings section.
Toggle the Send to BigQuery option.
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
- On the MDE web interface, click Types.
- Click Add new Type.
- Fill in the Type name as
basic-discrete
. Select `
DISCRETE_DATA_SERIES
in the drop-down for Archetype:Open the Storage Settings section.
Toggle the Send to BigQuery option.
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
- On the MDE web interface, click Types.
- Click Add new Type.
- Fill in the Type name as
basic-continuous
. Select `
CONTINUOUS_DATA_SERIES
in the drop-down for Archetype:Open the Storage Settings section.
Toggle the Send to BigQuery option.
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
- On the MDE web interface, click Parsers.
- Click Add new Parser.
- Fill in the Parser name as
basic-numeric-to-basic-numeric
. - Select
basic-numeric
in the drop-down for Message Class Name. 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; }
Select
basic-numeric | version: 1
in the drop-down for Type.Click Create.
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
- On the MDE web interface, click Parsers.
- Click Add new Parser.
- Fill in the Parser name as
basic-numeric-to-basic-discrete
. - Select
basic-discrete
in the drop-down for Message Class Name. 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; }
Select
basic-discrete | version: 1
in the drop-down for Type.Click Create.
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
- On the MDE web interface, click Parsers.
- Click Add new Parser.
- Fill in the Parser name as
basic-numeric-to-basic-continuous
. - Select
basic-continuous
in the drop-down for Message Class Name. 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; }
Select
basic-continuous | version: 1
in the drop-down for Type.Click Create.