_RevInclude in hl7.fhir

2.7k views Asked by At

Can someone please explain the functionality of _revInclude in fhir with an example?

This is what i understood,

if we have an encounter resource we can have a location and that location will have a organization resource referenced in partOf property. if we send a request ....Encounter?_id=1234&_include=Encounter:location&_revinclude=Location:Partof then the returned bundle will conatin the enounter resource, its corresponding location resource and the organization resource that the location belongs to.Is this correct?

1

There are 1 answers

2
Lloyd McKenzie On BEST ANSWER

_revinclude causes a search response to include resources that have a relationship to the primary resources in the search response to also be included. Your example wouldn't quite work because your _revinclude isn't talking about a reference to the primary resource (Encounter in your example). To work, you'd have to use _revinclude:iterate. The second consideration is syntax. There's an additional challenge with your _revinclude in that the syntax must be [Resource]:[search-param-name]. The Resource is the resource you want returned and the search-param-name is the search parameter by which that resource points to the primary resource (or with 'iternate', any other included resource). The search parameter name in Location that you need is partof, not Partof. And capitalization matters - at least for some servers

This should work: [base]/Encounter?_id=1234&include=Encounter:location&_revinclude:iterate=Location:partof