Search with related resources
Last updated
Was this helpful?
Last updated
Was this helpful?
A client can add related resources to a search result using FHIR parameters and with Aidbox parameter. In ORM frameworks, such feature is sometimes called an "associations eager loading". This technique can save extra roundtrips from the client to the server and potential N+1 problem.
This example demonstrates how search parameters work. You may want to get encounters with patients (each encounter refers to patient):
Or you can request patients and return all Encounter resources that refer to them (by a reverse reference):
Aidbox can do the same in a compact way:
An entry.search.mode field has a value match
if the resource is in the search set because it matched the search criteria and has a value include
if another resource refers to it.