Compartment Search
Search
Compartment Search
Search resources within a compartment
GET
Compartment Search
Compartment Search
Search for resources within a specific compartment. Compartments group related resources together (e.g., all resources related to a specific patient).The compartment type (
Patient, Encounter, RelatedPerson, Practitioner, Device)The ID of the compartment resource
Optional: Filter to a specific resource type within the compartment
Endpoint
Patient Compartment
Search all resources related to a specific patient:Encounter Compartment
Search all resources related to a specific encounter:All Resources in Compartment
Search all resource types in a compartment:Search Parameters
You can combine compartment search with type-specific search parameters:Response
Success (200 OK)
Returns aBundle containing resources in the compartment:
Standard Compartments
Patient Compartment
Includes resources that reference the patient:ObservationConditionProcedureMedicationRequestEncounterDiagnosticReport- And more…
Encounter Compartment
Includes resources that reference the encounter:ObservationProcedureMedicationRequestDiagnosticReport- And more…
RelatedPerson Compartment
Includes resources related to a related person.Practitioner Compartment
Includes resources related to a practitioner.Device Compartment
Includes resources related to a device.Examples
All Observations for a Patient
Observations with Specific Code
All Resources in Patient Compartment
Filtered Compartment Search
Notes
- Compartment membership is determined by resource references
- Not all resources belong to compartments
- Compartment search is more efficient than filtering by reference
- Use compartment search when you know the compartment resource ID
- The compartment ID must exist for the search to work
Authorizations
Bearer token authentication
Path Parameters
The compartment type (Patient, Encounter, etc.)
The compartment resource ID
The FHIR resource type (e.g., Patient, Observation, Encounter)
Query Parameters
Maximum number of results to return
Required range:
x >= 0Sort order (prefix with - for descending)
Response
Search results
A container for a collection of resources
Resource type
Available options:
Bundle Indicates the purpose of this bundle
Available options:
document, message, transaction, transaction-response, batch, batch-response, history, searchset, collection If search, the total number of matches
Links related to this Bundle
Entry in the bundle