Aidbox User Docs
Run Aidbox locallyRun Aidbox in SandboxTalk to us Ask community
  • Aidbox FHIR platform documentation
    • Features
    • Architecture
  • Getting Started
    • Run Aidbox in Sandbox
    • Run Aidbox locally
    • Run Aidbox on AWS
    • Upload Sample Data
  • Tutorials
    • CRUD, Search Tutorials
      • Delete data
      • Set up uniqueness in Resource
      • Search Tutorials
        • Custom SearchParameter tutorial
        • Create custom Aidbox Search resource
        • Multilingual search tutorial
        • Migrate from Aidbox SearchParameter to FHIR SearchParameter
        • Change sort order by locale collation
    • Bulk API Tutorials
      • 🎓Synthea by Bulk API
      • 🎓$dump-sql tutorial
    • Security & Access Control Tutorials
      • Allow patients to see their own data
      • Restrict operations on resource type
      • Relationship-based access control
      • Creating user & set up full user access
      • Restricting Access to Patient Data
      • Create and test access control
      • RBAC
        • Flexible RBAC built-in to Aidbox
        • RBAC with JWT containing role
        • RBAC with ACL
      • Set-up token introspection
      • Prohibit user to login
      • Debug access control
      • Managing Admin Access to the Aidbox UI Using Okta Groups
      • Run Multibox locally
      • How to enable labels-based access control
      • How to enable patient data access API
      • How to enable SMART on FHIR on Patient Access API
      • How to enable hierarchical access control
      • How to configure Audit Log
    • Terminology Tutorials
      • Load ICD-10 terminology into Aidbox
      • Uploading IG terminology content to external FHIR terminology server
    • Validation Tutorials
      • Upload FHIR Implementation Guide
        • Environment Variable
        • Aidbox UI
          • IG Package from Aidbox Registry
          • Public URL to IG Package
          • Local IG Package
        • Aidbox FHIR API
        • UploadFIG Tool
      • ISiK
      • Carin BB
      • US Core
      • Davinci Pdex
      • mCode
    • Integration Toolkit Tutorials
      • Postmark integration tutorial
      • Mailgun integration tutorial
    • Subscriptions Tutorials
      • AidboxTopicSubscription NATS tutorial
    • Other tutorials
      • Run Aidbox with FHIR R6
      • Migrate from Multibox to Aidbox
      • SDC with Custom Resources
      • How to create FHIR NPM package
      • Migrate from legacy licence portal to Aidbox portal
      • How to run Aidbox in GCP Cloud Run
  • Overview
    • Licensing and Support
    • Aidbox user portal
      • Projects
      • Licenses
      • Members
    • Aidbox UI
      • Aidbox Notebooks
      • REST Console
      • Database Console
      • Attrs stats
      • DB Tables
      • DB Queries
    • Versioning
    • Release Notes
    • Contact us
  • Configuration
    • Settings
    • Configure Aidbox and Multibox
    • Init Bundle
  • API
    • REST API
      • CRUD
        • Create
        • Read
        • Update
        • Patch
        • Delete
      • FHIR Search
        • SearchParameter
        • Include and Revinclude
        • Chaining
      • Aidbox Search
      • Bundle
      • History
      • $everything on Patient
      • Other
        • Aidbox & FHIR formats
        • Capability Statement
        • $document
        • Observation/$lastn
        • $validate
        • SQL endpoints
        • $matcho
        • $to-format
        • Aidbox version
        • Health check
    • Bulk API
      • Configure Access Policies for Bulk API
      • $dump
      • $dump-sql
      • $dump-csv
      • $export
      • $load & /fhir/$load
      • $import & /fhir/$import
      • aidbox.bulk data import
      • Bulk import from an S3 bucket
    • Batch/Transaction
    • GraphQL API
    • Other APIs
      • Plan API
        • Provider Directory API
          • Practitioner
          • PractitionerRole
          • Organization
          • OrganizationAffiliation
        • Plan API Overview
      • Archive/Restore API
        • create-archive
        • restore-archive
        • prune-archived-data
        • delete-archive
      • ETAG support
      • Cache
      • Changes API
      • RPC API
      • Sequence API
      • Encryption API
      • Batch Upsert
  • Modules
    • Profiling and validation
      • FHIR Schema Validator
        • Aidbox FHIR IGs Registry
        • Setup Aidbox with FHIR Schema validation engine
      • Skip validation of references in resource using request header
      • Asynchronous resource validation
    • Security & Access Control
      • Authentication Flows
        • Basic Auth
        • Client Credentials Grant
        • Resource Owner Grant
        • Authorization Code Grant
        • Implicit Grant
        • Two Factor Authentication
        • External OAuth 2.0 Providers
        • Token Exchange
      • External identity providers
        • Aidbox
        • Okta
        • Azure AD
        • Azure AD with certificate authentication
        • Keycloak
        • GitHub
        • Microsoft AD FS
        • Apple
      • Access Control
        • AccessPolicy
        • Evaluation engines
        • Role-Based Access Control (/RBAC)
        • Attribute-based Access Control (/ABAC)
        • Multitenancy
        • Access control lists (/ACL)
        • Access policy dev tool
        • AccessPolicy best practices
      • Audit
        • Audit Log
    • Observability
      • Getting started
        • Run Aidbox with OpenTelemetry locally
        • How to export telemetry to the OTEL collector
      • Logs
        • How-to guides
          • OpenTelemetry logs
          • Elastic Logs and Monitoring Integration
          • Datadog Log management integration
          • Loki Log management integration
        • Tutorials
          • Log analysis and visualization tutorial
          • Export logs to Datadog tutorial
        • Extending Aidbox Logs
        • Technical reference
          • Log appenders
          • Log transformations
          • Log Schema
          • OTEL logs exporter parameters
      • Metrics
        • How-to guides
          • How to export metrics to the OTEL collector
          • Use Aidbox Metrics Server
          • Set-up Grafana integration
        • Technical reference
          • OpenTelemetry Metrics
          • OTEL metrics exporter parameters
      • Traces
        • How to use tracing
        • OTEL traces exporter parameters
    • Subscriptions
      • Aidbox topic-based subscriptions
        • Kafka AidboxTopicDestination
        • Webhook AidboxTopicDestination
        • GCP Pub/Sub AidboxTopicDestination
        • Tutorial: produce QuestionnaireResponse to Kafka topic
      • Aidbox SubSubscriptions
    • Aidbox Forms
      • Getting started
      • Aidbox Forms Interface
      • Aidbox UI Builder
        • UI Builder Interface
        • Form creation
          • Form Settings
          • Widgets
          • Components
          • Versioning
          • Form customisation in Theme Editor
          • Form signature
          • How-to guides
            • How to: populate forms with data
            • How to extract data from forms
            • How to calculate form filling percentage
          • Multilingual forms
          • FHIRPath Editor
        • Import Questionnaire
        • Form sharing
        • Printing forms
          • Template-based PDF generation
        • FHIR versions
        • Offline forms
        • Embedding
          • Request Interception
        • Configuration
        • Forms multitenancy
        • Building reports using SQL on FHIR
        • Integration with external terminology servers
        • External FHIR servers as a data backend
        • Store attachments in S3-like storages
      • Access Control in Forms
      • Audit Logging in Forms
      • Aidbox Form Gallery
    • Define extensions
      • Extensions using StructureDefinition
      • Extensions using FHIRSchema
    • Custom Resources
      • Custom resources using FHIR Schema
      • Custom resources using StructureDefinition
      • Migrate to FHIR Schema
        • Migrate custom resources defined with Entity & Attributes to FHIR Schema
        • Migrate custom resources defined with Zen to FHIR Schema
    • Aidbox terminology module
      • Concept
        • $translate-concepts
        • Handling hierarchies using ancestors
      • ValueSet
        • ValueSet Expansion
        • ValueSet Code Validation
        • Create a ValueSet
      • CodeSystem
        • CodeSystem Concept Lookup
        • CodeSystem Subsumption testing
        • CodeSystem Code Composition
      • Import external terminologies
        • Import flat file (/CSV)
        • $import operation
        • Ready-to-use terminologies
      • $translate on ConceptMap
    • SQL on FHIR
      • Defining flat views with View Definitions
      • Query data from flat views
      • Reference
    • Integration toolkit
      • C-CDA / FHIR Converter
        • List of supported templates
          • Admission Diagnosis Section (/V3)
          • Advance Directives Section (/entries optional) (/V3)
          • Advance Directives Section (/entries required) (/V3)
          • Allergies and Intolerances Section (/entries optional) (/V3)
          • Allergies and Intolerances Section (/entries required) (/V3)
          • Assessment Section
          • Chief Complaint Section
          • Chief Complaint and Reason for Visit Section
          • Complications Section (/V3)
          • Course of Care Section
          • DICOM Object Catalog Section - DCM 121181
          • Default Section Rules
          • Discharge Diagnosis Section (/V3)
          • Document Header
          • Encounters Section (/entries optional) (/V3)
          • Encounters Section (/entries required) (/V3)
          • Family History Section (/V3)
          • Functional Status Section (/V2)
          • General Status Section
          • Goals Section
          • Health Concerns Section (/V2)
          • History of Present Illness Section
          • Hospital Consultations Section
          • Hospital Course Section
          • Hospital Discharge Instructions Section
          • Hospital Discharge Physical Section
          • Hospital Discharge Studies Summary Section
          • Immunizations Section (/entries optional) (/V3)
          • Immunizations Section (/entries required) (/V3)
          • Medical (/General) History Section
          • Medical Equipment Section (/V2)
          • Medications Administered Section (/V2)
          • Medications Section (/entries optional) (/V2)
          • Medications Section (/entries required) (/V2)
          • Mental Status Section (/V2)
          • Notes
          • Nutrition Section
          • Objective Section
          • Operative Note Fluids Section
          • Operative Note Surgical Procedure Section
          • Past Medical History (/V3)
          • Payers Section (/V3)
          • Plan of Treatment Section (/V2)
          • Postprocedure Diagnosis Section (/V3)
          • Preoperative Diagnosis Section (/V3)
          • Problem Section (/entries optional) (/V3)
          • Problem Section (/entries required) (/V3)
          • Procedure Description Section
          • Procedure Disposition Section
          • Procedure Estimated Blood Loss Section
          • Procedure Implants Section
          • Procedure Specimens Taken Section
          • Procedures Section (/entries optional) (/V2)
          • Procedures Section (/entries required) (/V2)
          • Reason for Visit Section
          • Results Section (/entries optional) (/V3)
          • Results Section (/entries required) (/V3)
          • Review of Systems Section
          • Social History Section (/V3)
          • Vital Signs Section (/entries optional) (/V3)
          • Vital Signs Section (/entries required) (/V3)
        • How to deploy the service
        • Producing C-CDA documents
        • How to customize conversion rules
      • HL7 v2 Integration
        • HL7 v2 integration with Aidbox Project
        • Mappings with lisp/mapping
      • X12 message converter
      • Analytics
        • Power BI
      • Mappings
      • Email Providers integration
        • Setup SMTP provider
    • SMARTbox | FHIR API for EHRs
      • Get started
        • Set up Smartbox locally
        • Deploy Smartbox with Kubernetes
      • (/g)(/10) Standardized API for patient and population services
      • The B11 Decision Support Interventions
        • Source attributes
        • Feedback Sections
      • How-to guides
        • Pass Inferno tests with Smartbox
        • Perform EHR launch
        • Pass Inferno Visual Inspection and Attestation
        • Revoke granted access
        • Set up EHR-level customization
        • Check email templates
        • Setup email provider
        • Register users
        • Set up SSO with Auth0
        • Publish Terms of Use link onto the documentation page
        • Find out what resources were exported during the $export operation
        • Find documentation endpoint
      • Background information
        • Considerations for Testing with Inferno ONC
        • Adding Clients for Inferno tests
        • Multitenancy approach
        • What is Tenant
        • Email templating
    • ePrescription
      • Getting started
      • Authentication with mTLS
      • Pharmacies synchronization
      • Prescribing
        • NewRx Message
        • CancelRx Message
        • How to test Callback
      • Directory
        • DirectoryDownload Message
        • GetProviderLocation Message
        • AddProviderLocation Message
        • UpdateProviderLocation Message
        • DisableProviderLocation Message
      • Medications
        • FDB
      • References
        • Environment Variables
      • Frequently Asked Questions
    • Other modules
      • MDM
        • Train model
        • Configure MDM module
        • Find duplicates: $match
        • Mathematical details
      • MCP
  • Database
    • Overview
    • Database schema
    • PostgreSQL Extensions
    • AidboxDB
      • HA AidboxDB
    • Tutorials
      • Migrate to AidboxDB 16
      • Working with pgAgent
  • File storage
    • AWS S3
    • GCP Cloud Storage
    • Azure Blob Storage
    • Oracle Cloud Storage
  • Deployment and maintenance
    • Deploy Aidbox
      • Run Aidbox on Kubernetes
        • Deploy Production-ready Aidbox to Kubernetes
        • Deploy Aidbox with Helm Charts
        • Highly Available Aidbox
        • Self-signed SSL certificates
      • Run Aidbox on managed PostgreSQL
      • How to inject env variables into Init Bundle
    • Backup and Restore
      • Crunchy Operator (/pgBackRest)
      • pg_dump
      • pg_basebackup
      • WAL-G
    • Indexes
      • Get suggested indexes
      • Create indexes manually
  • App development
    • Use Aidbox with React
    • Aidbox SDK
      • Aidbox JavaScript SDK
      • Apps
      • NodeJs SDK
      • Python SDK
    • Examples
  • Reference
    • FHIR Schema reference
    • Settings reference
      • General
      • FHIR
      • Security & Access Control
      • Modules
      • Database
      • Web Server
      • Observability
      • Zen Project
    • Environment variables
      • Aidbox required environment variables
      • Optional environment variables
      • AidboxDB environment variables
    • System resources reference
      • IAM Module Resources
      • SDC Module Resources
      • Base Module Resources
      • Bulk Module Resources
      • AWF Module Resources
      • Cloud Module Resources
      • HL7v2 Module Resources
      • SQL on FHIR Module Resources
    • Email Providers reference
      • Notification resource reference
      • Mailgun environment variables
      • Postmark environment variables
    • Aidbox Forms reference
      • FHIR SDC API
      • Aidbox SDC API
      • Generating Questionnaire from PDF API
    • Aidbox SQL functions
  • Deprecated
    • Deprecated
      • Zen-related
        • RPC reference
          • aidbox
            • mdm
              • aidbox.mdm/update-mdm-tables
              • aidbox.mdm/match
        • FTR
        • Aidbox configuration project
          • Run Aidbox locally using Aidbox Configuraiton project
          • Aidbox configuration project structure
          • Set up and use configuration projects
          • Enable IGs
          • Repository
          • Seed Import
          • Manage Indexes in Zen Project
          • Seed v2
          • 🎓Migrate to git Aidbox Configuration Projects
          • Aidbox Configuration project reference
            • Zen Configuration
            • Aidbox project RPC reference
            • aidbox.config/config
          • Custom resources using Aidbox Project
          • First-Class Extensions using Zen
          • Zen Indexes
        • US Core IG
          • US Core IG support reference
        • Workflow Engine
          • Task
            • Aidbox Built-in Tasks
            • Task Executor API
            • Task User API
          • Workflow
            • Workflow User API
          • Services
          • Monitoring
        • FHIR conformance Deprecated guides
          • Touchstone FHIR 4.0.1 basic server
          • Touchstone FHIR USCore ClinData
          • How to enable US Core IG
            • Start Aidbox locally with US Core IG enabled
            • Add US Core IG to a running Aidbox instance
          • HL7 FHIR Da Vinci PDex Plan Net IG
        • Terminology Deprecated Tutorials
          • Inferno Test-Suite US Core 3.1.1
        • API constructor (/beta)
        • zen-lang validator
          • Write a custom zen profile
          • Load zen profiles into Aidbox
        • FHIR topic-based subscriptions
          • Set up SubscriptionTopic
          • Tutorial: Subscribe to Topic (/R4B)
          • API Reference
            • Subscription API
        • 🏗️FHIR Terminology Repository
          • FTR Specification
          • Create an FTR instance
            • FTR from CSV
            • FTR from FHIR IG
            • FTR from FTR — Direct Dependency
            • FTR from FTR — Supplement
          • FTR Manifest
          • Load SNOMED CT into Aidbox
          • Load LOINC into Aidbox
          • Load ICD-10-CM into Aidbox
          • Load RxNorm into Aidbox
          • Load US VSAC Package to Aidbox
          • Import via FTR
        • Zen Search Parameters
      • Entity / Attribute
        • Entities & Attributes
        • First-Class Extensions using Attribute
        • Custom Resources using Entity
        • Working with Extensions
        • Aidbox Search Parameters
      • Forms
      • Other
        • Custom Search
        • SearchQuery
        • Subscribe to new Patient resource
        • App Development Deprecated Tutorials
          • Receive logs from your app
            • X-Audit header
          • Working with Aidbox from .NET
          • Patient Encounter notification Application
        • Other Deprecated Tutorials
          • Resource generation with map-to-fhir-bundle-task and subscription triggers
          • APM Aidbox
          • Automatically archive AuditEvent resources in GCP storage guide
          • HL7 v2 pipeline with Patient mapping
          • How to migrate to Apline Linux
          • How to migrate transaction id to bigint
          • How to fix broken dates
          • Configure multi-tenancy
        • AidboxProfile
        • GCP Pub/Sub
Powered by GitBook
On this page
  • awf.task/subscribe
  • Params
  • Result
  • Example
  • awf.task/wait
  • Params
  • Result
  • Example
  • awf.workflow/decision-task
  • Params
  • Event types
  • Result
  • Action types
  • Import resource task
  • Params
  • Example
  • ingestion/map-to-fhir-bundle-task
  • Params
  • Example
  • awf.task/clean-up-activities
  • Params
  • aidbox.task/run-sql
  • Params
  • aidbox.task/run-rpc
  • Params
  • aidbox.validation/resource-types-bath-validation-workflow

Was this helpful?

Edit on GitHub
  1. Deprecated
  2. Deprecated
  3. Zen-related
  4. Workflow Engine
  5. Task

Aidbox Built-in Tasks

PreviousTaskNextTask Executor API

Last updated 5 days ago

Was this helpful?

Workflow engine is configured by zen. We do not support it and do not recommend to use it anymore. Please, use any other workflow engine e.g. .

Since the 2405 release, using Aidbox in FHIR schema validation engine is recommended, which is incompatible with zen or Entity/Attribute options.

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

Result

Parameter
Type
Description

resource

object

The resource that triggered the task completion.

Example

POST /rpc
content-type: text/yaml
accept: text/yaml

method: awf.task/create-and-execute
params:
  definition: awf.task/subscribe
  params:
    select-by: 
      - get-in: 
        - resourceType
        comparator: eq
        value: Patient
result:
  resource:
    params:
      select-by:
        - value: Patient
          get-in:
            - resourceType
          comparator: eq
    status: in-progress
    definition: awf.task/subscribe
    retryCount: 1
    id: >-
      ce39265f-3ab0-40c4-b407-b75a45dc2f26
    resourceType: AidboxTask
    meta:
      lastUpdated: '2023-05-24T13:54:04.444841Z'
      createdAt: '2023-05-24T13:54:04.444841Z'
      versionId: '38277'
result:
  resource:
    definition: awf.task/subscribe
    meta:
      lastUpdated: '2023-05-24T13:55:21.134679Z'
      createdAt: '2023-05-24T13:54:04.444841Z'
      versionId: '38406'
    params:
      select-by:
        - value: Patient
          get-in:
            - resourceType
          comparator: eq
    retryCount: 1
    outcome: succeeded
    resourceType: AidboxTask
    status: done
    result:
      resource:
        id: >-
          asdasd
        meta:
          createdAt: '2023-05-24T13:55:21.131777Z'
          versionId: '38405'
          lastUpdated: '2023-05-24T13:55:21.131777Z'
        resourceType: Patient
    id: >-
      ce39265f-3ab0-40c4-b407-b75a45dc2f26

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 - YYYY-MM-DD or

YYYY-MM-DDThh:mm:ss+zz:zz

Example: "1905-08-23", "2015-02-07T13:28:17-05:00" or "2017-01-01T00:00:00.000Z"

Result

No result

Example

POST /rpc
content-type: text/yaml
accept: text/yaml

method: awf.task/create-and-execute
params:
  definition: awf.task/wait
  params:
    duration:
      hours: 4
      minutes: 30
result:
  resource:
    params:
      duration:
        hours: 4
        minutes: 30
    status: in-progress
    definition: awf.task/wait
    retryCount: 1
    id: >-
      41ab6e83-fa01-4a25-be56-beafd3ee5744
    resourceType: AidboxTask
    meta:
      lastUpdated: '2023-06-15T12:44:02.740779Z'
      createdAt: '2023-06-15T12:44:02.740779Z'
      versionId: '400'

awf.workflow/decision-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

workflow-id

string

Id of completed workflow instance. Required only if event type is awf.workflow.event/workflow-completed

task-id

string

Id of completed task instance. Required only if event type is awf.workflow.event/task-completed

Event types

Event type
Description

awf.workflow.event/workflow-init

First task execution in the context of the current workflow instance. The decision task contains this event if it was started using the awf.workflow/create-and-execute method.

awf.workflow.event/task-completed

Reaction to a completed task started by the current workflow. Includes the ID of the completed task instance in the decision task parameters.

awf.workflow.event/workflow-completed

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

task-request

object

Object with task execution request. Required only if action type is awf.workflow.action/schedule-task or

awf.workflow.action/schedule-workflow

task-request.

definition

string

task-request. label

string

Human- or machine-readable description of task instance. Should be unique in the context of single workflow. Example: Import Patient resources

task-request. params

object

The input parameters described in the task or workflow definition.

Action types

Action type
Description

awf.workflow.action/schedule-task

Used to schedule the execution of a new task from current workflow. Requires task request object in the response.

awf.workflow.action/schedule-workflow

Used to schedule the execution of a new workflow from current workflow. Requires workflow request object in the response.

awf.workflow.action/do-nothing

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.

awf.workflow.action/complete-workflow

awf.workflow.action/fail

Used when some tasks have failed to change the status of the workflow instance to done with outcome failed with handled error.

awf.workflow.action/unknown-error

Used when some tasks have failed to change the status of the workflow instance to done with outcome failed with unknown error.

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 Content-Location header in the response

contentEncoding

string

Supports gzip or plain (non-gzipped .ndjson files)

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: fhir, aidbox

Example

POST /rpc
content-type: text/yaml
accept: text/yaml

method: awf.task/create-and-execute
params:
  definition: aidbox.bulk/import-resource-task
  params:
    type: aidbox
    input:
      url: https://storage.googleapis.com/aidbox-public/synthea/100/Organization.ndjson.gz
      resourceType: Organization
  
result:
  resource:
    params:
      type: aidbox
      input:
        url: >-
          https://storage.googleapis.com/aidbox-public/synthea/100/Organization.ndjson.gz
        resourceType: Organization
    status: ready
    definition: aidbox.bulk/import-resource-task
    id: >-
      102fe9a4-386e-4b66-a01a-7f6c2661e9bd
    resourceType: AidboxTask
    meta:
      lastUpdated: '2023-05-24T13:37:49.615506Z'
      createdAt: '2023-05-24T13:37:49.615506Z'
      versionId: '37424'
result:
  resource:
    definition: aidbox.bulk/import-resource-task
    meta:
      lastUpdated: '2023-05-24T13:37:49.828022Z'
      createdAt: '2023-05-24T13:37:49.615506Z'
      versionId: '37433'
    params:
      type: aidbox
      input:
        url: >-
          https://storage.googleapis.com/aidbox-public/synthea/100/Organization.ndjson.gz
        resourceType: Organization
    retryCount: 1
    outcome: succeeded
    resourceType: AidboxTask
    status: done
    result:
      imported-resources: 0
    execId: 2748c559-cd78-4005-abc8-b85e5e94b3a4
    id: >-
      102fe9a4-386e-4b66-a01a-7f6c2661e9bd

ingestion/map-to-fhir-bundle-task

Params

Parameter
Type
Required
Description

mapping

string

context

object

Initial data.

format

string

Bundle format. Possible values: fhir, aidbox

Example

{ns     my-mappings
 import #{lisp}
 
 my-mapping
 {:zen/tags #{lisp/mapping}
  :mapping  {:resourceType "Bundle"
             :type "transaction"
             :entry [{:resource {:resourceType "Patient"}
                      :request {:method "PUT"
                                :url "/Patient/zero"}}

                     {:resource {:resourceType "Observation"
                                 :status (get :status)
                                 :code {:coding [{:system "http://loinc.org"
                                                  :code "8867-4"
                                                  :display "Respiratory rate"}]
                                        :text "Breathing Rate"}
                                 :subject {:reference "Patient/zero"}
                                 :effectiveDateTime (get-in [:br 0 :dateTime]),
                                 :valueQuantity   {
                                                   :value (get-in [:br 0 :value :breathingRate]),
                                                   :unit "breaths/minute",
                                                   :system "http://unitsofmeasure.org",
                                                   :code "/min"}}
                      :request {:method "POST"
                                :url "/Observation"}}]}}}
POST /rpc
content-type: text/yaml
accept: text/yaml

method: awf.task/create-and-execute
params:
  definition: ingestion.core/map-to-fhir-bundle-task
  params:
    format: fhir
    mapping: my-mappings/my-mapping
    context: 
      br: 
        - value: 
            breathingRate: 17.8
        - dateTime: 2021-10-25
      status: final
result:
  resource:
    params:
      format: fhir
      context:
        br:
          - value:
              breathingRate: 17.8
          - dateTime: '2021-10-25T00:00:00Z'
        status: final
      mapping: aidbox-with-task/my-mapping
    status: ready
    definition: ingestion.core/map-to-fhir-bundle-task
    id: >-
      fd9808c9-29c5-409b-a10f-96d3e28d0039
    resourceType: AidboxTask
    meta:
      lastUpdated: '2023-05-24T12:17:32.528315Z'
      createdAt: '2023-05-24T12:17:32.528315Z'
      versionId: '33349'
result:
  resource:
    definition: ingestion.core/map-to-fhir-bundle-task
    meta:
      lastUpdated: '2023-05-24T12:20:45.742574Z'
      createdAt: '2023-05-24T12:20:45.072825Z'
      versionId: '33546'
    params:
      format: fhir
      context:
        br:
          - value:
              breathingRate: 17.8
          - dateTime: '2021-10-25T00:00:00Z'
        status: final
      mapping: my-mappings/my-mapping
    retryCount: 1
    outcome: succeeded
    resourceType: AidboxTask
    status: done
    result:
      id: >-
        33545
      type: transaction-response
      entry:
        - resource:
            id: >-
              zero
            meta:
              extension:
                - url: http://example.com/createdat
                  valueInstant: '2023-05-24T12:20:45.110149Z'
              versionId: '33542'
              lastUpdated: '2023-05-24T12:20:45.110149Z'
            resourceType: Patient
          response:
            etag: '33542'
            status: '201'
            location: /Patient/zero/_history/33542
            lastModified: '2023-05-24T12:20:45.110149Z'
        - resource:
            id: >-
              8f21674f-e03c-47b4-b952-1e237db99b04
            code:
              text: Breathing Rate
              coding:
                - code: 8867-4
                  system: http://loinc.org
                  display: Respiratory rate
            meta:
              extension:
                - url: http://example.com/createdat
                  valueInstant: '2023-05-24T12:20:45.110149Z'
              versionId: '33544'
              lastUpdated: '2023-05-24T12:20:45.110149Z'
            status: final
            subject:
              reference: Patient/zero
            resourceType: Observation
            valueQuantity:
              code: /min
              unit: breaths/minute
              value: 17.8
              system: http://unitsofmeasure.org
          response:
            etag: '33544'
            status: '201'
            location: /Observation/8f21674f-e03c-47b4-b952-1e237db99b04/_history/33544
            lastModified: '2023-05-24T12:20:45.110149Z'
      resourceType: Bundle
    execId: ae747dd9-6cda-477f-8a83-5f6b18cee94e
    id: >-
      fd9808c9-29c5-409b-a10f-96d3e28d0039

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.

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: {"unit": "hour", "value": 1} - means that any resource updated more than 1 hour ago will be deleted.

rules[].retentionPolicy.unit

string

Time units. Possible values: minute, hour, day, week, month, year

rules[].retentionPolicy.value

integer

Number of time units.

rules[].includeDefinitions

string[]

List of task/workflow definitions that would be affected by this rule.

Example: ["aidbox.bulk/import-resource-task"]

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: ["aidbox.bulk/import-resource-task"]

Exclusive with rules.includeDefinitions

POST /rpc
content-type: text/yaml
accept: text/yaml

method: awf.task/create-and-execute
params: 
  definition: awf.task/clean-up-activities
  params: 
    rules:
      - retentionPolicy:
          unit: minute
          value: 1
        includeDefinitions:
          - aidbox.bulk/import-resources-workflow
Status: 200

result:
  resource:
    params:
      rules:
        - retentionPolicy:
            unit: minute
            value: 1
          includeDefinitions:
            - aidbox.bulk/import-resources-workflow
    status: ready
    definition: awf.task/clean-up-activities
    id: >-
      e0f2d92d-92eb-4e12-9da8-ef619596fbb9
    resourceType: AidboxTask
    meta:
      lastUpdated: '2023-10-30T13:40:01.071987Z'
      createdAt: '2023-10-30T13:40:01.071987Z'
      versionId: '73542'
definition: awf.task/clean-up-activities
meta:
  lastUpdated: '2023-10-30T13:40:01.097386Z'
  createdAt: '2023-10-30T13:40:01.071987Z'
  versionId: '73549'
params:
  rules:
    - retentionPolicy:
        unit: minute
        value: 1
      includeDefinitions:
        - aidbox.bulk/import-resources-workflow
retryCount: 1
outcome: succeeded
resourceType: AidboxTask
status: done
result:
  deletedRowsCount:
    AidboxTask: 23
    AidboxTaskLog: 124
    AidboxWorkflow: 3
execId: 746092c9-aa5e-43b4-ba8c-baa9d8c288d2
id: >-
  e0f2d92d-92eb-4e12-9da8-ef619596fbb9

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.

POST /rpc
content-type: text/yaml
accept: text/yaml

method: awf.task/create-and-execute
params: 
  definition: aidbox.task/run-sql
  params: 
    sql:
      - SELECT id FROM Patient WHERE id=? LIMIT 1;
      - 'pt-1'
result:
  resource:
    params:
      sql:
        - SELECT id FROM Patient WHERE id=? LIMIT 1;
        - pt-1
    status: ready
    definition: aidbox.task/run-sql
    id: >-
      ee56dfe3-5853-4da1-bbb2-2405b1d8b0a9
    resourceType: AidboxTask
    meta:
      lastUpdated: '2023-10-31T08:02:05.399463Z'
      createdAt: '2023-10-31T08:02:05.399463Z'
      versionId: '73560'
definition: aidbox.task/run-sql
meta:
  lastUpdated: '2023-10-31T08:02:05.449732Z'
  createdAt: '2023-10-31T08:02:05.399463Z'
  versionId: '73566'
params:
  sql:
    - SELECT id FROM Patient WHERE id=? LIMIT 1;
    - pt-1
retryCount: 1
outcome: succeeded
resourceType: AidboxTask
status: done
result:
  - id: pt-1
execId: 86cb0940-75a1-4d2f-89ca-0a5fe4cbf497
id: >-
  ee56dfe3-5853-4da1-bbb2-2405b1d8b0a9

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.

POST /rpc
content-type: text/yaml
accept: text/yaml

method: awf.task/create-and-execute
params: 
  definition: aidbox.task/run-rpc
  params: 
    method: aidbox.pg/vacuum-table
    params:
      table: patient
      analyze: true
result:
  resource:
    params:
      method: aidbox.pg/vacuum-table
      params:
        table: patient
        analyze: true
    status: ready
    definition: aidbox.task/run-rpc
    id: >-
      374a188d-3f71-4910-82db-c993f174c501
    resourceType: AidboxTask
    meta:
      lastUpdated: '2023-10-31T08:27:11.072779Z'
      createdAt: '2023-10-31T08:27:11.072779Z'
      versionId: '73604'
definition: aidbox.task/run-rpc
meta:
  lastUpdated: '2023-10-31T08:27:11.099924Z'
  createdAt: '2023-10-31T08:27:11.072779Z'
  versionId: '73610'
params:
  method: aidbox.pg/vacuum-table
  params:
    table: patient
    analyze: true
retryCount: 1
outcome: succeeded
resourceType: AidboxTask
status: done
result:
  res:
    - 0
execId: 3a9fdddb-17e2-49a7-ba95-0924cbf96cc6
id: >-
  374a188d-3f71-4910-82db-c993f174c501

aidbox.validation/resource-types-bath-validation-workflow

Executes validation on given table names. Creates a task for every table.

Note: for every broken target resource creates a BatchValidationError resource.

POST /rpc
content-type: text/yaml
accept: text/yaml

method: awf.workflow/create-and-execute
params: 
  definition: aidbox.validation/resource-types-batch-validation-workflow
  params: 
    tables: ['patient', 'observation']
result:
  resource:
    params:
      tables:
        - patient
        - observation
    status: in-progress
    definition: aidbox.validation/resource-types-batch-validation-workflow
    id: >-
      c36e0665-0fe2-4cec-972f-2112716f9233
    resourceType: AidboxWorkflow
result:
  resource:
    params:
      tables:
        - patient
        - observation
    result: Finished
    status: done
    outcome: succeeded
    definition: aidbox.validation/resource-types-batch-validation-workflow
    id: >-
      c36e0665-0fe2-4cec-972f-2112716f9233
    resourceType: AidboxWorkflow

Rule written on .

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 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 , such as starting a new task.

Example: awf.workflow.event/workflow-init

Example: awf.workflow.action/schedule-task

Definition of or custom-defined task. Example: aidbox.archive/create-archive

Used when all tasks have been completed to change the instance to done with outcome succeeded.

Task that applies to the given context and applies the result to the database as a bundle in either fhir or aidbox formats.

Reference to a defined .

If multiple rules are listed, all rules are applied. Can be used with the to automatically clean up old tasks and workflows.

Temporal
Setup Aidbox with FHIR Schema validation engine
lisp/mapping
another event
certain cases
lisp/mapping
Type of event.
Type of action.
predefined task
Scheduler service
subscription trigger rule DSL
status of the workflow