Queries
Get all activities in a given care flow
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.
01
The pathway_id is a required input variable for this query.
01
All filters are optional. When no filters are provided, all activities in the care flow are returned.
01
| Field | Required | Description | Type |
|---|---|---|---|
| pathway_id | Yes | The ID of the care flow | string |
| activity_status | No | Filter by activity status (e.g., ACTIVE, DONE, FAILED) | array of strings |
| activity_type | No | Filter by activity type (e.g., FORM, MESSAGE, CALCULATION) | array of strings |
| action | No | Filter by action type (e.g., ASSIGNED, ACTIVATE, COMPLETE) | array of strings |
| stakeholders | No | Filter by stakeholder IDs | array of strings |
| hide_system_activities | No | Hide system activities (calculations, activations, etc.) | boolean |
| reference_id | No | Filter by reference ID (e.g., action definition ID) | string |
| track_id | No | Filter by track ID | string |
| date_range | No | Filter activities within a date range | object with from/to ISO date strings |
| pagination | No | Pagination parameters (default: count=100, offset=0) | PaginationParams |
| sorting | No | Sorting parameters (default: field="date", direction="DESC") | SortingParams |
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).
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.
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 | Stakeholder 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) |
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:
| Type | Fragment | Description |
|---|---|---|
| FORM | FormActivityInputs | Contains the form definition with questions, options, and visibility rules |
| MESSAGE | MessageActivityInputs | Contains the message subject, body, format, and attachments |
| EXTENSION | ExtensionActivityInputs | Contains extension fields and component key |
| CALCULATION | CalculationActivityInputs | Contains 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).