"Assigned Patients" query.
# support
c
I have a simple solution I am building for our care teams that will allow Practitioners to go to a "My Patients" page and see a table view of all patients to whom they are assigned (via a FHIR care team). Currently, I am going about this with a Graphql Query like this:
Copy code
graphql
query GetPractitionerPatients($practitionerReference: String!, $offset: Int, $pageSize: Int) {
  CareTeamConnection(participant: $practitionerReference, _offset: $offset, _count: $pageSize) {
    count
    pageSize
    offset
    edges {
      resource {
        subject {
          reference
          resource {
            ... on Patient {
              id
              name {
                given
                family
              }
              birthDate
              extension {
                valueCode
                url
              }
              meta {
                tag {
                  system
                  code
                  display
                }
              }
              impressions: ClinicalImpressionList(_reference: patient) {
                id
                code {
                  coding {
                    system
                    code
                  }
                }
                status
                finding {
                  itemCodeableConcept {
                    coding {
                      code
                      display
                      system
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
But I also need to filter by patient name as well. What would be the recommend way to implement this type of search, but with a filter option on patient name?
I think maybe what I am looking for is a graphql implementation of "Reverse Chaining"?
doing a restful query like this works:
medplum get 'CareTeam?participant=$practitionerRef&subject:Patient.name=$name
r
Hi @Charlie from Imagine , chained search is definitely the right way to go here. Unfortunately, the GraphQL spec currently doesn't support search chaining out of the box as of yet
If you'd like to use the FHIR Rest API, I can help you craft such a query
c
Yeah, I think the rest query I pasted above, I will just need to figure out how to wire it into our pagination stuff.
Thanks for pointing me to the GQL spec and confirming its not supported, Rahul!