yaaaaale
10/09/2023, 8:22 PMPatient?_id=[id]&_include=Patient:link&_include:iterate=RelatedPerson:patient
Child -> parent
Patient?_id=[id]&_revinclude=RelatedPerson:patient&_revinclude:iterate=Patient:link
The first one (Parent -> Child), we can implement in Graphql using the following:
{
Patient(id: $id) {
link {
other {
resource {
... on RelatedPerson {
id
resourceType
patient {
resource {
... on Patient {
id
resourceType
...BasePatientInfo
}
}
}
relationship {
coding {
code
display
}
}
}
}
}
}
}
}
However, we're struggling to query in the opposite direction, from a patient to see a list of their caregivers.
Is this currently possible using the Graphql API?cody
10/09/2023, 8:41 PM{
PatientList(name: "simpson") {
resourceType
id
name {
given
family
}
RelatedPersonList(_reference: patient) {
resourceType
id
relationship {
coding {
code
display
}
}
PatientList(_reference: link) {
resourceType
id
name {
given
family
}
}
}
}
}
(EDIT: Oops, the previous version was incorrect. This one correctly follows the link)cody
10/09/2023, 8:42 PMRelatedPersonList(_reference: patient)
See: https://www.medplum.com/docs/graphql/basic-queries#searching-reverse-references-using-the-_reference-keywordyaaaaale
10/09/2023, 9:33 PM