Queries
Get all activities in a given pathway
This query fetches all of the pathway activities of any status for a specific orchestrated pathway, including system activities such as calculations or activations.
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
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).
01
An orchesrated 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.
In most cases, you're only interested in the user activities which you can get by filtering the activities array by the isUserActivity
field.
Additionally, you can filter the results by status === 'ACTIVE'
to only get the pending activities.
The query doesn't support server-side filtering yet so the filters have to be applied on the response of the query.
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. To get all pending activities for a given stakeholder, you can filter on the activity.indirect_object.type
and the activity.indirect_object.name
field.
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) |
To simplify obtaining the content of a form for a form activity, there are two options:
activity.object.id
and the related getter query (e.g. GetForm, GetMessage) to fetch the content you needform
field at the activity
root (see ...Form
in the query above), along with the form fields you are interested in. The schema of a form is identical to what you would use in the GetForm query:01
For non-Form activities, this field will return null
. Currently, the form
field is only available on this activity query.
Form and question metadata is returned in all form queries as a JSON string rather than a JSON object. This is because the metadata is defined in Studio as a JSON string and we want to avoid any potential parsing errors. 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).
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
.