How-toFor engineers

Query activities

How to look up activities, the server-side filters available, and how to page through results.

Activities are the unit of work in Awell. Read the domain model first; these queries are hard to use without it.

Field-level reference is in Activities.

Which query

QueryUse when
careflowActivitiesYou want everything in one care flow, including system activities
activitiesByPatientYou want activities across all of one patient's care flows
activitiesByCareflowDefinitionYou want activities across all patients on one definition
activityYou have an activity ID

careflowActivities requires a pathway_id. The by-patient and by-definition queries are the ones to reach for when the question spans care flows, for example building a worklist.

Filtering happens server-side

Filters are optional, and with none supplied the response contains every activity in the care flow, including calculations, track activations and other system activities.

Available filters cover activity status, activity type, action, stakeholders, care flow status, and date range.

Filter server-side rather than fetching everything and filtering in your client. A long-running care flow accumulates a lot of system activities, and the response grows with it.

Paging and sorting

Results support pagination and sorting. Page through rather than raising a limit: a care flow's activity count grows for as long as the patient is enrolled.

Pending activities for a user

There's a dedicated query for a user's pending activities, suited to a task list rather than a history. It expects particular headers to identify the user.

Expect repetition

A looping track produces the same step's activities many times for one patient. Code that assumes one activity per step shows the wrong one.

Next steps

Next: Work with forms to complete the activities you found.

On this page