Skip to main content

Automation Basics

Automations in OpenDataDSL are event-driven data flows: when something happens in the platform, such as data being updated, a process failing or a dataset becoming late, an automation runs an action automatically.

What are automations?​

An automation watches one or more items and listens for specific actions on them. When a matching action happens, the automation sends the item's data to an automation target, which does the work: send an email, publish to a queue, run a process, build a curve and so on.

This makes automations the main way to build reactive data pipelines without polling or extra scheduling.

You can create and manage automations in three ways:

Triggering events​

Every automation is triggered by an action on an item in a service. The table below lists the services you will use most and the actions each one raises.

ServiceActions
alertraised, closed, reopened, agent, severity, comment
curvecreate, update, delete, build, success, warning, failed
datacreate, update, delete, validated, invalid
datasetupdate, late, complete, missing, correction
extensioncreate, update, delete, late, complete, missing, install, upgrade, uninstall
groupcreate, update, delete, itemadded, itemremoved, itemupdated
processcreate, update, delete, rollback, promote, tag, untag, rename, run, success, warning, failed
queuecreate, update, delete, message
reportcreate, update, delete, run, success, warning, failed
scriptcreate, update, delete, rollback, promote, tag, untag, rename, run, success, warning, failed
scriptlogcreate
validationcreate, update, delete, success, warning, failed

Other services, for example object, calendar, type, action, workflow, extractor, transformer, reportconfig, dashboard, documentation and policy, raise create, update and delete.

A few points to know:

  • Timeseries, curves and event lists are all in the data service. An event list is a data item with the id OBJECT:EVENTLIST, so automations on events use the data service.
  • validated and invalid are only raised for curves and timeseries, by the Validation extension.
  • Dataset actions are raised by dataset monitoring with source private, using the dataset id (provider.feed.product) as the item id.
  • A create condition always uses the id *, because the item does not exist yet.

Anatomy of an automation​

An automation is stored as a JSON document in the automation service. Here is an example that emails the operations team when a dataset is late:

{
"target": "odsl.email",
"template": "When 'ICE.NDEX.NLB' is late, send an email to [to] with subject [subject]",
"icon": "envelope-at text-outlook",
"enabled": true,
"conditions": [
{
"service": "dataset",
"action": "late",
"id": "ICE.NDEX.NLB",
"source": "private"
}
],
"properties": {
"to": "ops-team@mycompany.com",
"subject": "ICE Endex NLB settlement prices are late",
"attachment": false
}
}

Fields​

target​

The id of the automation target that receives the data and acts on it, for example odsl.email, odsl.queue or odsl.process. Target ids are publisher.code; all the targets provided by OpenDataDSL start with odsl..

template​

The sentence that describes the automation. It is required. The platform creates the automation's name from it by replacing each [property] with that property's value, so the example above is named:

When 'ICE.NDEX.NLB' is late, send an email to 'ops-team@mycompany.com' with subject 'ICE Endex NLB settlement prices are late'

The portal's Automations panel offers a fixed set of templates for each item, made from the action and the target's own template (see Templates below). Use exactly one of those texts, otherwise the automation still runs but is not shown in the item's Automations panel.

icon​

The Bootstrap Icons name shown next to the automation in the portal, usually the target's icon. You can add a colour class, for example envelope-at text-outlook.

enabled​

Set to false to pause the automation without deleting it. The default is true.

conditions​

A list of trigger conditions. The automation runs when any condition matches. Each condition has:

FieldRequiredDescription
serviceYesThe service to watch, for example dataset
actionYesThe action that triggers the automation, for example late
idYesThe id of the item to watch, or * for any item
sourceYesThe source of the item: private, public or common
didNoA dependent id. When set, the target is sent the dependent item instead of the item that triggered it. The platform uses this to build an event curve when its event list is updated

properties​

The values the target needs, named after the inputs in the target's template, for example to and subject for an email. Some targets also need fixed properties: an email needs attachment set to false (or true to attach the data). Each target's page lists what it needs.

When the automation runs, the platform also adds these properties for the target:

PropertyDescription
idThe id of the item that triggered the automation
ondateThe curve date of a curve, or the delivery date of a dataset
rangeThe range of observations of a timeseries update

Properties starting with @ change when and how the automation runs, see Advanced features.

name, owner​

These are set by the platform when the automation is saved. The owner is whoever saved the automation last: the automation runs with the owner's security policies, so the owner needs access to the item and to whatever the target does.

Templates​

The templates offered for an item are made like this:

KindTemplate
StandardWhen '<id>' <action text>, <target template>
With a transformerWhen '<id>' <action text>, transform the data using [@transformer], then <target template>
Property change (update)When property [@propertyName] on '<id>' is set to [@propertyValue], <target template>
Property set (create, delete)When 'anything' is created with property [@propertyName] set to [@propertyValue], <target template>
AlertsWhen an alert <action text> for '<id>', <target template>

<id> is the item id, or anything for *. The action text is:

ActionTextActionText
createis createdcompleteis complete
updateis updatedcorrectionhas a correction
deleteis deletedsuccessis successful
renameis renamedwarninghas a warning
rollbackis rolled backfailedhas failed
promoteis promotedvalidatedpasses validation (or its failure is overridden)
tagis version taggedinvalidfails validation
untagis version un-taggeditemaddedhas an item added
lateis lateitemremovedhas an item removed
missingis missingitemupdatedhas an item updated

For alerts: raised (is raised), closed (is closed), reopened (is reopened), agent (is handed to a different agent), severity (changes severity) and comment (has a comment added, edited or deleted).

The transformer form is only offered for targets that allow transformation, and the property change form only for targets that allow property checks. The targets page lists both for every target.

Get the exact text from the platform

The listAutomations special function returns the offers for an item, with the exact template, target, icon, conditions and default properties:

GET https://api.opendatadsl.com/api/dataset/v1/private/ICE.NDEX.NLB?_function=listAutomations

Automations created for you​

Some automations are created and kept up to date by the platform or by extensions, and you do not normally create them yourself:

  • Build automations: saving a Smart Curve, Event Curve, Smart TimeSeries or Event TimeSeries creates the automation that rebuilds it when its inputs change, and deleting the item removes it
  • Validation checks: the Validation extension keeps an odsl.validation automation for each validation configuration
  • Compositions: Composer keeps an odsl.composition automation for each composition

Next steps​