Skip to main content
GET
Compartment Search
Search for resources within a specific compartment. Compartments group related resources together (e.g., all resources related to a specific patient).
string
required
The compartment type (Patient, Encounter, RelatedPerson, Practitioner, Device)
string
required
The ID of the compartment resource
string
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:
Or using POST:

Search Parameters

You can combine compartment search with type-specific search parameters:

Response

Success (200 OK)

Returns a Bundle containing resources in the compartment:

Standard Compartments

Patient Compartment

Includes resources that reference the patient:
  • Observation
  • Condition
  • Procedure
  • MedicationRequest
  • Encounter
  • DiagnosticReport
  • And more…

Encounter Compartment

Includes resources that reference the encounter:
  • Observation
  • Procedure
  • MedicationRequest
  • DiagnosticReport
  • 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

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

Authorization
string
header
required

Bearer token authentication

Path Parameters

compartmentType
string
required

The compartment type (Patient, Encounter, etc.)

compartmentId
string
required

The compartment resource ID

resourceType
string
required

The FHIR resource type (e.g., Patient, Observation, Encounter)

Query Parameters

_count
integer
default:10

Maximum number of results to return

Required range: x >= 0
_sort
string

Sort order (prefix with - for descending)

Response

Search results

A container for a collection of resources

resourceType
enum<string>
required

Resource type

Available options:
Bundle
type
enum<string>
required

Indicates the purpose of this bundle

Available options:
document,
message,
transaction,
transaction-response,
batch,
batch-response,
history,
searchset,
collection
total
integer

If search, the total number of matches

Links related to this Bundle

entry
object[]

Entry in the bundle