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
| Query | Use when |
|---|---|
careflowActivities | You want everything in one care flow, including system activities |
activitiesByPatient | You want activities across all of one patient's care flows |
activitiesByCareflowDefinition | You want activities across all patients on one definition |
activity | You 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.
Start a care flow
Start a care flow through the API: the prerequisites, which start mutation to use, how versions are selected, and starting a hosted-pages session at the same time.
Work with forms
Render a form, evaluate its conditional logic on every answer, and submit responses in the string format the API expects.