Queries
Get all activities in a given pathway
This query lets us fetch 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.
- graphql
01query GetPathwayActivities($pathway_id: String!) {02 pathwayActivities(pathway_id: $pathway_id) {03 success04 activities {05 id06 stream_id07 status08 date09 isUserActivity10 subject {11 type12 name13 }14 action15 object {16 id17 type18 name19 }20 indirect_object {21 id22 type23 name24 }25 # For form content26 form {27 ...Form28 }29 }30 }31}
- json
01{02 "pathway_id": "{{PATIENT_PATHWAY_ID}}"03}
An orchesrated care flow consists of system activities and user actionable activities (forms, messages, checklists, ...). System activities are activities related to the Orchestration of the care flow whereas user actionable activities are the actual activities a stakeholder (eg: patient) needs to interact with.
In most cases, you're only interested in the user actionable 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 actionable 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 (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) |
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:
- graphql
01form {02 id03 definition_id # static id from Studio04 title05 key # form key set in Studio06 metadata # JSON metadata string set in Studio07 questions {08 id09 definition_id # static id from Studio10 title # string or html string (for description questions)11 key # question key set in Studio12 dataPointValueType13 questionType14 metadata # JSON metadata string set in Studio15 options {16 id17 value18 label19 }20 rule {21 # visibility conditions of a question22 boolean_operator23 conditions {24 id25 reference # definition id of the question this condition is based on26 operator27 operand {28 type29 value30 }31 }32 }33 }34}
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
.