Services
Scheduler
The Scheduler is a task-related service. It provides the ability to execute tasks and workflows at defined time intervals. The scheduler is managed by rules that have to determine which and when the activity will be executed, whether it should be forbidden if the same activity is already in progress, and the time for which it should be executed before the execution time comes.
To use the scheduler, you need to describe your rules in zen format and list them in the scheduler service definition.
Rule params
Parameter | Type | Required | Description |
---|---|---|---|
schedule | string | A string in cron format that describes how often an activity is executed.
Example: | |
execute-on-setup | boolean | If | |
concurrency-policy | string | Prohibits the scheduler to start an activity if a similar activity already started has not yet ended when value is | |
start-deadline-seconds | number | The period of time in which the task can be started after the assigned time in seconds.
Default: | |
task-request | map | Definition of the task-request to be performed. Exclusive with workflow-request. | |
workflow-request | map | Definition of the workflow-request to be performed. Exclusive with task-request. |
Rule definition
This rule describes how to run the audit-events archiving task every day at 14:10. For a full example of how to use the scheduler, see the tutorialAutomatically archive AuditEvent resources in GCP storage guide
Another example of rule definition is automatically delete AidboxTask, AidboxTaskLog and AidboxWrokflow resources with awf.task/clean-up-activities
task.
Cleanup rule definition
This rule describes how to run the cleanup task that deletes all AidboxTask, AidboxTaskLog, and AidboxWorkflow resources that are older than 1 day every day at 14:10.
Subscription trigger
Subscription trigger is a service that allows you to subscribe to changes in the Aidbox database and perform tasks or workflows described in the rule when the conditions are met.
To use the subscription trigger, you need to describe your rules in zen format and list them in the subscription trigger service definition.
Subscription trigger rule DSL
Subscription trigger rules
Subscription trigger rules use their own DSL to describe subscriptions. A select-by part of the rule may include several expressions and will be considered fulfilled if all expressions are true.
In general every expression is divided into three parts with specified keys:
:get-in - describes the path in the modified resource where the left-hand operation argument will be taken. The value must be a vector and contain the path to the value in the nested structure. Example:
:get-in [:name :given]
:comparator - the logical operation performed on the arguments. Possible values:
:eq
,:gt
,:lt
,:ge
,:le
:value - the right-hand argument of the expression. Should be the same type with left argument.
Rule params
Parameter | Type | Required | Description |
---|---|---|---|
select-by | vector | Vector of instructions written in the subscription trigger rule DSL. Example: | |
task-request | map | Definition of the task-request to be performed. Exclusive with workflow-request. | |
workflow-request | map | Definition of the workflow-request to be performed. Exclusive with task-request. |
Rule definition
This example uses a subscription trigger with ingestion/map-to-fhir-bundle-task. It means that every time an Observation resource is updated with status registered
, an Encounter resource is created with the same subject
and performer
as the participant
.
Last updated