Aidbox Built-in Tasks
awf.task/subscribe
Task that will be in progress until a resource with the specified attributes would be persisted in the database. It is used for some workflow cases when the workflow should wait for resource creation.
Params
Parameter | Type | Required | Description |
---|---|---|---|
select-by | string | Rule written on subscription trigger rule DSL. |
Result
Parameter | Type | Description |
---|---|---|
resource | object | The resource that triggered the task completion. |
Example
awf.task/wait
Task that will wait for the indicated duration or until the indicated datetime. Used in workflow when need to be paused for some purposes.
Either duration or until parameter SHOULD be specified.
Params
Parameter | Type | Required | Description |
---|---|---|---|
duration | object | The task will wait for this duration | |
duration.hours | integer | duration value in hours | |
duration.minutes | integer | duration value in minutes | |
duration.seconds | integer | duration value in seconds | |
until | datetime | The task will wait for until this datetime. Need to indicate in string of valid FHIR datetime -
Example: "1905-08-23", "2015-02-07T13:28:17-05:00" or "2017-01-01T00:00:00.000Z" |
Result
No result
Example
awf.workflow/decision-task
Decision tasks - special tasks that form the body of the workflow and partially execute it in certain iterations. Decision tasks are created when a workflow is started or as a response on another event to decide what action should be taken. Actions are predefined in task execution operations that are used as a response to a completed decision task. Actions are used in certain cases, such as starting a new task.
Decision tasks should also include an event that should represent the purpose of that task as a parameter.
Params
Parameter | Type | Required | Description |
---|---|---|---|
event | string | Type of event.
Example: | |
workflow-id | string | Id of completed workflow instance. Required only if event type is | |
task-id | string | Id of completed task instance. Required only if event type is |
Event types
Event type | Description |
---|---|
| First task execution in the context of the current workflow instance. The decision task contains this event if it was started using the |
| Reaction to a completed task started by the current workflow. Includes the ID of the completed task instance in the decision task parameters. |
| Reaction to a completed workflow started by the current workflow. Includes the ID of the completed workflow instance in the decision task parameters. |
Result
Parameter | Type | Required | Description |
---|---|---|---|
action | string | Type of action.
Example: | |
task-request | object | Object with task execution request. Required only if action type is
| |
task-request. definition | string | Definition of predefined task or
custom-defined task.
Example: | |
task-request. label | string | Human- or machine-readable description of task instance. Should be unique in the context of single workflow.
Example: | |
task-request. params | object | The input parameters described in the task or workflow definition. |
Action types
Action type | Description |
---|---|
| Used to schedule the execution of a new task from current workflow. Requires task request object in the response. |
| Used to schedule the execution of a new workflow from current workflow. Requires workflow request object in the response. |
| Used to wait until the next event occurs when multiple tasks have been started in parallel, but when some tasks are completed, other tasks are still in progress. |
| Used when all tasks have been completed to change the status of the workflow instance to |
| Used when some tasks have failed to change the status of the workflow instance to |
| Used when some tasks have failed to change the status of the workflow instance to |
Import resource task
Loading resource in specified format (.gzip or .ndjson) from specified url and persists it into Aidbox database.
Params
Parameter | Type | Required | Description |
---|---|---|---|
id | string | Identifier of the import.
If you don't provide this, the id will be auto-generated. You can check it on | |
contentEncoding | string | Supports | |
input | object | Resource to import | |
input.url | string | URL from which load resources | |
input.resourceType | string | Resource type to be loaded | |
type | string | Type of persisted resource
Possible values: |
Example
ingestion/map-to-fhir-bundle-task
Task that applies lisp/mapping to the given context and applies the result to the database as a bundle in either fhir or aidbox formats.
Params
Parameter | Type | Required | Description |
---|---|---|---|
mapping | string | Reference to a defined lisp/mapping. | |
context | object | Initial data. | |
format | string | Bundle format.
Possible values: |
Example
awf.task/clean-up-activities
Deletes AidboxTask
, AidboxTaskLog
and AidboxWorkflow
resources that are in done
state according to specified rules.
When the workflow is matched by the rule, all activities requested by that workflow as AidboxTask and AidboxWorkflow would also be deleted. If task is matched by the rule, all it's AidboxTaskLog resources would also be deleted.
When includeDefinitions is specified, only activities with listed definitions will be deleted.
When excludeDefinitions is specified, all activities are deleted except for activities with the listed definitions.
If both includeDefinitions and excludeDefinitions are not specified, deletes all resources that match retentionPolicy.
If multiple rules are listed, all rules are applied. Can be used with the Scheduler service to automatically clean up old tasks and workflows.
Params
Parameter | Type | Required | Description |
---|---|---|---|
rules | object[] | Array of cleanup rules. At least 1 rule is required. | |
rules[].retentionPolicy | object | Policy that manages the length of time resources are kept. Resources that are not within this time period will be deleted. Example: | |
rules[].retentionPolicy.unit | string | Time units.
Possible values: | |
rules[].retentionPolicy.value | integer | Number of time units. | |
rules[].includeDefinitions | string[] | List of task/workflow definitions that would be affected by this rule. Example: Exclusive with rules.excludeDefinitions | |
rules[].excludeDefinitions | string[] | List of task/workflow definitions that would be ignored by this rule. In this case, the rule would be applied to all AidboxTask, AidboxTaskLog and AidboxWorkflow resources except the listed definitions. Example: Exclusive with rules.includeDefinitions |
aidbox.task/run-sql
Executes the given SQL query. If given is array, executes given as prepared statement. If the query result is greater than 1000 rows, an error is returned.
Params
Parameter | Type | Required | Description |
---|---|---|---|
sql | string or string[] | SQL query or prepared statement. |
aidbox.task/run-rpc
Executes the given Aidbox RPC-method with params.
Params
Parameter | Type | Required | Description |
---|---|---|---|
method | string | Definition of the RPC-method. | |
params | object | Params of the RPC-method. |