Stream: implementers
Topic: Search CareTeam by participants with period
Donn Relacion (Jan 10 2022 at 05:29):
Hi. We're developing an application where practitioners can be invited the join a CareTeam and they can choose to accept the invitation or not.
In our preliminary design, we thought of always adding the practitioner as a participant, regardless of if they accept the invitation or not, and use the period component to indicate if the invitation had been accepted. If the practitioner declines, we remove them from the CareTeam.participant list.
However, we also have a requirement where when the practitioner lists Patients, the practitioner should only see patients where they have accepted the CareTeam invitation. We are using the search query Patient?_has:CarePlan:subject:care-team.participant=Practitioner/{practitioner.Id}
. I've tried to create a custom SearchParameter that checks if the period component of the participant exists:
active-participant:
"expression": "CareTeam.participant.where(period).member"
The custom search parameter worked when testing on a microsoft fhir-server implementation.
The search query used was Patient?_has:CarePlan:subject:care-team.active-participant=Practitioner/{practitioner.Id}
.
My question is if this is proper usage of the SearchParameter expression? From what I see in the existing SearchParameters, none of them use a where expression similar to what I used, it's either where(resolve() is Resource)
or where(field='xxx')
Lloyd McKenzie (Jan 10 2022 at 15:38):
There's no restriction against going as weird and wild as you like with your expression. However, whether a given server will be able to just consume the SearchParameter automatically without needing to write custom code will vary. The simpler the expression, the more likely it'll just "work" out of the box.
Last updated: Apr 12 2022 at 19:14 UTC