Workflow#
Application ID
eot_workflow
Application Aliases
workflow.app eot/workflow.app
Description#
The Workflow application enables you to automate your pipelines by applying actions defined in rules that are triggered when certain conditions are met. The application works as follows:
Custom variables are resolved sequentially
Variables are given a
User-defined name, which can be referenced in the user-defined rules
JSON path expression into the Document from which the variable gets its data. The result of this expression, if it resolves, is always an array of matches
By default, a special variable representing the document is available as
document
. For example, the document’s ID can be referenced asdocument.id
Rules are considered sequentially
Conditions are evaluated
Any explicitly listed variables are looked up
If the variables are found to be resolved (see previous step), the rule triggers
If any variable is unresolved, the rule is skipped
Any implicitly listed variables – referenced in the action’s configuration – are looked up
If the variables are found to be resolved (see previous step), the rule triggers
If any variable is unresolved, the rule is skipped
Actions are applied: if the rule triggers, the action is applied using the provided configuration
Note
The JSON path expression is standard compliant, including arithmetic and binary comparison operators and conforms toe the original JSONPath
proposal defined in to https://goessner.net/articles/JsonPath/
Configuration#
The configuration is an object defined as (bold = required, italic = optional):
variables (
array[Variable]
) – The list of variables accessible in the rulesrules (
array[Rule]
) – The list of rules to be considered
With Variable
defined as:
object
– The variablename (
string
) – The name of the variableexpression (
string
) – The JSON path expression pointing to the data that will be held by the variable
And Rule
defined as:
object
– The rule to be consideredaction (
string
) – The action to be applied if the rule triggersconfig (
object
) – The configuration for the action. This is anobject
with fields determined by the particular action. The configuration can use variables. In case referenced variables are not present, the rule is not triggeredrequires (
array[string]
) – An optional list of explicitly listed variables that must be present in order for the rule to be triggered. This list is in addition to the list of implicit variables found in the action’s configuration
Actions#
Name |
Description |
Configuration |
---|---|---|
|
Insert and run additional steps in the pipeline |
pipeline ( |
|
Perform a REST call to a web URL to hook into your pipeline |
url (
string ) – The web URL to callmethod (
string ) – Either GET or POST . In the latter case, the current document is passed as the body of an application/json content request and the response, if it contains a valid document is used further along the pipeline. This allows you to perform any custom operations on the document, including altering, adding or removing data |
Example#
To run a pipeline based on the language of the processed document, we can first run the Language Identifier app which will generate the information that the
Workflow app can then use to run a new pipeline. We define that pipeline as {language},entity
which - at runtime - translates to dutch,entity
:
wow -p 'lid.app,workflow(rules=[{"action":"Run","config":{"pipeline":"{language},entity"}}]).app' \
-i "John Smith werkt als dokter bij Omega Pharma."
yields:
app='eot_language_identifier'
{
"language": "dutch"
}
app='eot_analysis'
S:( 0, 45)
C:( 0, 45): Sentence
C:( 0, 10): Person,@(canonical='John Smith' family='Smith' gender='male' given='John' )
C:( 0, 4): PersonGiv
C:( 0, 4): GivenName,@(gender='male' standalone='Yes' )
T:( 0, 4): John,{+giv, +init-cap, +init-token},[John:Prop-Std]
C:( 5, 10): PersonFam
T:( 5, 10): Smith,{+fam, +init-cap},[Smith:Prop-Std]
T:( 11, 16): werkt,[werken:V-Pres]
T:( 17, 20): als,[als:Prep-Std]
C:( 21, 27): PersonMention
C:( 21, 27): Position,@(theme='healthcare' )
T:( 21, 27): dokter,[dokter:Nn-Sg]
T:( 28, 31): bij,{+prefix},[bij:Prep-Std]
C:( 32, 44): Company,@(country='Belgium' sector='pharma' )
T:( 32, 37): Omega,{+init-cap, +nf},[Omega:Prop-Std]
T:( 38, 44): Pharma,{+init-cap, +nf, +nf-lex},[Pharma:Prop-Std]
T:( 44, 45): .,[.:Punct-Sent]
app='eot_workflow'
null