Industry Analytics Kit - Metadata Development Guide


"@AnalyticDefinition"s are metadata used by the Analytic builder to determine the structure of an analytic.
Generally @AnalyticsDefinitions are compiled into a single metadata.json file and loaded all at once. This is how the built-in analytics are loaded.
They can also be loaded individually via an upload option in the Analytic Builder.


Structure of an @AnalyticDefinition

The structure of an @AnalyticDefintion is a comment with a special annotation and then json. For example:
Important Note: Json cannot contain comments so the '//' comments should be removed

/* @AnalyticDefinition // A comment with an @AnalyticDefinition marks the start
{ // The start of the json
"name": "MyFirstAnalytic",
"description": "Brief description of the analytic",
"group": "AGroupName", // Optional: A grouping for the analytic in the UI
"documentation": "<p>Some html documentation</p>", // Optional: Some html to show in the documentation tab. Note: The built in analytics use a relative path which gets compiled into html, this option is not available to custom analytics
"inputChannels": [ // Optional: An array of input channels
{
"name": "InChanName",
"description": "A brief description of what the channel is for",
"optional": false, // Optional: Whether the channel is optional
"repeated": false, // Optional: Whether multiple channels can be connected
"dataProperties": ["dValue"] // Optional: An array of any required properties of the incoming Data event. Valid values: "dValue", "sValue", "xValue", "yValue", "zValue", "params"
}
],
"outputChannels": [ // Optional: An array of output channels
{
"name": "OutChanName",
"description": "A brief description of what the channel is for",
"optional": false, // Optional: Whether the channel is optional
"repeated": false, // Optional: Whether multiple channels can be connected
"prefix": "movingAverage:" // Optional: A prefix to be added to a channel name
"dataProperties": ["+dValue", "-sValue", "-xValue", "-yValue", "-zValue", "-params"] // Optional: Expected properties on an outgoing Data event.
// By default all properties are assumed to be copied from the incoming Data event.
// '+dValue' means that the dValue has been added or modified from the incoming event
// '-sValue' means that the sValue has been removed from the incoming event
}
],
"properties": [
{
"name": "param1", // The name of the analytic's param
"description": "A brief description of what the param is for",
"type": "integer", // The apama type of the param. (ignoring the fact that it will be stringified), valid values: "string" (eg. "Seconds"), "decimal" (eg. "1.23d"), "float" (eg. "1.23f"), "integer" (eg. "3"), "boolean" (eg. "true")
"defaultValue": 1, // Optional: A label to display if the param is optional and a value is not defined by the user
// Can also be a stringified javascript function, eg:
// example1: "function(value, analytic) { return analytic.getProperty('param2').value }"
"optional": false, // Optional: Whether this param is optional
"repeated": false, // Optional: Whether this param is a placeholder for lots of params each named by the user
"validValues": [1, 2, 3, 4] // Optional: An array of values that will be selectable from a drop-down
"validator": "function(value) { return value >=1 || 'must be >= 1' }" // Optional: A javascript validator for the property.
// The validation function should return true if the value is valid. If a string is returned then it will be displayed as the error text
// Example: "function(value, analytic) { return analytic.getProperty('param2').value === undefined || 'cannot set both param1 and param2'}"
}
]
}
*/