Last updated
Was this helpful?
Last updated
Was this helpful?
Each resource may belong to one or more compartments. A compartment is a logical grouping of resources which share a common property. Compartments have two principal roles:
Function as an access mechanism for finding a set of related resources quickly (described here)
Provide a definitional basis for applying access control to resources quickly
Read more about compartments in the FHIR . All examples in this tutorial are executable in Aidbox REST console.
Aidbox supports 5 default FHIR compartments in FHIR versions 1.4.0, 1.8.0, 3.0.1, 3.2.0, 3.3.0, 4.0.0, 4.0.1
In order to use compartments, you will need to create CompartmentDefinition resources on your server. Visit FHIR for official CompartmentDefinition examples or use the following REST console snippets to create the resources.
Although FHIR specification states that compartment definitions can only be defined by HL7 International, this restriction does not apply to Aidbox. You can define any compartments in your box so long as they are valid.
For example, to retrieve all the observation resources for a particular LOINC code associated with a specific encounter:
As an example of compartment usage, to retrieve a list of a patient's conditions, use the URL:
Additional search parameters can be defined, such as this hypothetical search for acute conditions:
Our example compartment search is basically equivalent to these standard FHIR search requests:
The outcome of a compartment search is the same as the equivalent FHIR search. For example, both these searches return the same outcome if there is no patient 333:
If the patient doesn't exist or the user has no access to the patient, both these searches return an empty bundle with no matches.
However, there is a key difference in functionality between compartment-based searches and direct searches with parameters. Consider this search:
To search a for either all possible resources or for a particular resource, type respectively:
Because the definition of the for says that a Communication resource is in the patient compartment if the subject, sender, or recipient is the patient, the compartment search is actually the same as the union of these 3 searches: