Awell Health Developer Hub
Dev Hub

The careflowActivities query fetches activities for a specific orchestrated care flow, including system activities such as calculations or activations. It supports advanced server-side filtering by activity status, type, stakeholders, date range, and more.

We suggest reading the page on our domain model first to get an understanding of the activity model.

Request

01

Variables

Required variables

The pathway_id is a required input variable for this query.

01

Filters

All filters are optional. When no filters are provided, all activities in the care flow are returned.

01
FieldRequiredDescriptionType
pathway_idYesThe ID of the care flowstring
activity_statusNoFilter by activity status (e.g., ACTIVE, DONE, FAILED)array of strings
activity_typeNoFilter by activity type (e.g., FORM, MESSAGE, CALCULATION)array of strings
actionNoFilter by action type (e.g., ASSIGNED, ACTIVATE, COMPLETE)array of strings
stakeholdersNoFilter by stakeholder IDsarray of strings
hide_system_activitiesNoHide system activities (calculations, activations, etc.)boolean
reference_idNoFilter by reference ID (e.g., action definition ID)string
track_idNoFilter by track IDstring
date_rangeNoFilter activities within a date rangeobject with from/to ISO date strings
paginationNoPagination parameters (default: count=100, offset=0)PaginationParams
sortingNoSorting parameters (default: field="date", direction="DESC")SortingParams

Pagination and sorting

Pagination and sorting are optional for this query. If no pagination values are supplied, the API will return only the first 100 activities. There is an upper limit of 500 records per query. Please be aware that setting count greater than 500 will throw an error.

Default sorting is based on the date field, in descending order (i.e. newest to oldest).

How to use

Get all pending user activities

An orchestrated care flow consists of system activities and user activities (forms, messages, checklists, ...). System activities are activities related to the Orchestration of the care flow whereas user activities are the actual activities a stakeholder (eg: patient) needs to interact with.

You can use the hide_system_activities filter to exclude system activities. Additionally, filter by activity_status: ["ACTIVE"] to only get pending activities.

Filter activities by stakeholder

User activities need to be completed by a certain stakeholder. The stakeholder who needs to complete an activity is determined by the stakeholder you assigned to an action in Awell Studio. You can use the stakeholders filter to filter by stakeholder IDs, or filter on the activity.indirect_object.type and activity.indirect_object.name fields in the response.

Example:
If you'd like to get all pending activities for the patient, you can filter the activities array by activity.indirect_object.type === PATIENT.

The table below can help you with filtering activities for the right stakeholder:

Stakeholder type
(activity.indirect_object.type)

Stakeholder name
(activity.indirect_object.name)

PATIENT

Name of the actual patient as stored in the Awell patient profile

STAKEHOLDER

Nurse

STAKEHOLDER

Physician

STAKEHOLDER

Dietician

STAKEHOLDER

(any other stakeholder that is not the patient)

Getting activity content via inputs

Each activity has an inputs field that provides the content associated with that activity based on its type. The inputs field is a union type — use inline fragments to select the fields for each activity type you're interested in.

01

The available inputs types are:

TypeFragmentDescription
FORMFormActivityInputsContains the form definition with questions, options, and visibility rules
MESSAGEMessageActivityInputsContains the message subject, body, format, and attachments
EXTENSIONExtensionActivityInputsContains extension fields and component key
CALCULATIONCalculationActivityInputsContains calculation input fields and their data point values

Form and question metadata is returned as a JSON string rather than a JSON object. You can parse the metadata string into a JSON object in your application (for example, using JSON.parse in JavaScript/TypeScript, json.loads in Python or json_decode in PHP or Ruby).

Examples