Queries
Search activities by status, type, patient and other criteria
We suggest reading the page on our domain model first to get an understanding of the activity model.
- graphql
01query GetActivities(02 $activity_type: [String!]03 $activity_status: [String!]04 $pathway_definition_id: [String!]05 $action: [String!]06 $patient_id: String07 $count: Float!08 $offset: Float!09 $sort_field: String!10 $sort_direction: String!11) {12 activities(13 filters: {14 activity_type: { in: $activity_type }15 action: { in: $action }16 pathway_definition_id: { in: $pathway_definition_id }17 patient_id: { eq: $patient_id }18 activity_status: { in: $activity_status }19 }20 pagination: { count: $count, offset: $offset }21 sorting: { field: $sort_field, direction: $sort_direction }22 ) {23 pagination {24 offset25 count26 total_count27 }28 sorting {29 field30 direction31 }32 activities {33 id34 stream_id # pathway id35 date36 subject {37 id38 name39 type40 }41 action42 object {43 id44 name45 type46 }47 indirect_object {48 id # typically the stakeholder id49 name50 type51 }52 resolution53 status54 }55 }56}
There are no required parameters for this query. However, you should provide pagination and sorting parameters. See Pagination and Sorting
below.
The filter is optional: if you don't provide one, an unfiltered list of pathways will be returned.
- graphql
01query GetActivities(02 $count: Float!03 $offset: Float!04 $sort_field: String!05 $sort_direction: String!06) {07 activities(08 pagination: { count: $count, offset: $offset }09 sorting: { field: $sort_field, direction: $sort_direction }10 ) {11 pagination {12 count13 offset14 total_count15 }16 sorting {17 field18 direction19 }20 activities {21 ...Activity22 }23 }24}
All in
filters accept a list of values and result in an is any of
search criteria. The eq
filter accepts a single string and results in is exact match
search criteria.
When specifying multiple filters, the resulting criteria is the conjuction of all filters.
01{02 "action": ["ASSIGNED", "ACTIVATE"], // See ActivityAction enum03 "activity_type": ["FORM", "MESSAGE"], // See ActivityObjectType enum04 "activity_status": ["DONE", "ACTIVE"], // See ActivityStatus enum05 "pathway_definition_id": ["{{ PATHWAY_DEFINITION_ID }}"],06 "patient_id": "{{ PATIENT_ID }}",07 "offset": 0,08 "count": 20,09 "sort_field": "date",10 "sort_direction": "desc"11 }
Pagination and sorting are required for this query. If no pagination values are supplied, the API will return only the first 100 activities, or 100 activities from the specified offset. There is an upper limit of 100 records per query. Please be aware that setting count
greater than 100 will successfully execute but return only 100 records.
Default sorting is based on the date
field, in descending order (i.e. newest to oldest).
- json
01{02 "count": 100, // max 10003 "offset": 0,04 "sort_field": "start_date",05 "sort_direction": "DESC"06}