Queries
Retrieve a list of patients in your organization
- graphql
01query GetPatients(02 $search: String03 $name_contains: String04 $name_equals: String05 $patient_code: String06 $national_registry_number: String07 $profile_id: [String!]08 $count: Float!09 $offset: Float!10 $sort_field: String!11 $sort_direction: String!12) {13 patients(14 filters: {15 search: { contains: $search }16 name: { contains: $name_contains, eq: $name_equals }17 patient_code: { eq: $patient_code }18 national_registry_number: { eq: $national_registry_number }19 profile_id: { in: $profile_id }20 }21 pagination: { count: $count, offset: $offset }22 sorting: { field: $sort_field, direction: $sort_direction }23 ) {24 pagination {25 offset26 count27 total_count28 }29 sorting {30 field31 direction32 }33 patients {34 id35 profile {36 email37 sex38 birth_date39 first_name40 last_name41 name42 phone43 mobile_phone44 preferred_language45 patient_code46 national_registry_number47 address {48 street49 city50 zip51 state52 country53 }54 }55 }56 }57}
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 patients will be returned.
- graphql
01query GetPatients(02 $count: Float!03 $offset: Float!04 $sort_field: String!05 $sort_direction: String!06) {07 patients(08 pagination: { count: $count, offset: $offset }09 sorting: { field: $sort_field, direction: $sort_direction }10 ) {11 pagination {12 offset13 count14 total_count15 }16 sorting {17 field18 direction19 }20 patients {21 ...Patient22 }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. The contains
filter accepts a single string and returns any results that partially match (case-insensitively) a set of fields. For this query, the fields searched against are name
, patient_code
and email
. name
is a user's full name, if you wish to partial match on first or last name, then use the search
filter rather than the name
contains or equals filters.
When specifying multiple filters, the resulting criteria is the conjuction of all filters.
01{02 "search": "Henriet",03 "name_contains": "Henriet",04 "name_equals": "Henrietta Lacks",05 "national_registry_number": "{{ NRNN }}",06 "patient_code": "{{ PATIENT_CODE }}",07 "profile_id": ["AWELL_PATIENT_ID_1", "AWELL_PATIENT_ID_2"],08 "offset": 0,09 "count": 20,10 "sort_field": "last_name",11 "sort_direction": "DESC"12 }
Pagination and sorting are required for this query. If no pagination values are supplied, the API will return only the first 10 patients, or 10 patients from the specified offset. There is also 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 last_name
field, sorted ascending. Only top-level patient profile fields can be used for sorting (e.g. birth_date
, sex
, patient_code
). Sorting by nested fields (e.g. address.city
) is not supported.
- json
01{02 "count": 100, // max 10003 "offset": 0,04 "sort_field": "last_name",05 "sort_direction": "ASC"06}