R5 Final QA

This page is part of the FHIR Specification (v5.0.0-draft-final: Final QA Preview for R5 - see ballot notes). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4 R3

5.7 Resource CompartmentDefinition - Content

FHIR Infrastructure icon Work GroupMaturity Level: 1 Trial UseSecurity Category: Anonymous Compartments: Not linked to any defined compartments

A compartment definition that defines how resources are accessed on a server.

Each resource may belong to one or more logical 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
  • Provide a definitional basis for applying access control to resources quickly

Notes:

  • At present, compartment definitions can only be defined by HL7 International. This is because their existence creates significant impact on the behavior of servers.
  • Although compartment definitions can be a useful foundation for access control, they may not be sufficient for this purpose. Resources outside the compartment might still be appropriate to be made available or subject to compartment restrictions even though they are not formally part of the compartment (see below about access rules).

Compartment definitions describe how particular compartment instances are named and identified, and how systems know which resources are in the compartment. The following compartments are defined by this specification:

TitleDescriptionIdentityMembership
PatientThe set of resources associated with a particular patientThere is an instance of the patient compartment for each patient resource, and the identity of the compartment is the same as the patient. When a patient is linked to another patient resource, the records associated with the linked patient resource will not be returned as part of the compartment search. Those records will be returned only with another compartment search using the "id" for the linked patient resource. In cases where two patients have been merged rather than linked, associated resources should be moved to the target patient as part of the merge process, so the patient compartment for the target patient would include all relevant data, and the patient compartment for the source patient would include only the linked Patient and possibly remnant resources like AuditEvent.The patient compartment includes any resources where the subject of the resource is the patient, and some other resources that are directly linked to resources in the patient compartment
EncounterThe set of resources associated with a particular encounterThere is an instance of the encounter compartment for each encounter resource, and the identity of the compartment is the same as the encounterThe encounter compartment includes any resources where the resource has an explicitly nominated encounter, and some other resources that themselves link to resources in the encounter compartment. Note that for many resources, the exact nature of the link to encounter can be ambiguous (e.g. for a DiagnosticReport, is it the encounter when it was initiated, or when it was reported?)
RelatedPersonThe set of resources associated with a particular 'related person'There is an instance of the relatedPerson compartment for each relatedPerson resource, and the identity of the compartment is the same as the relatedPersonThe relatedPerson compartment includes any resources where the resource is explicitly linked to relatedPerson (usually as author)
PractitionerThe set of resources associated with a particular practitionerThere is an instance of the practitioner compartment for each Practitioner resource, and the identity of the compartment is the same as the PractitionerThe practitioner compartment includes any resources where the resource is explicitly linked to a Practitioner (usually as author, but other kinds of linkage exist)
DeviceThe set of resources associated with a particular deviceThere is an instance of the device compartment for each Device resource, and the identity of the compartment is the same as the DeviceThe device compartment includes any resources where the resource is explicitly linked to a Device (mostly subject or performer)

The full definitions of these compartments are published as CompartmentDefinition resources. Servers typically do not support the full definition of a compartment, and are not required to. Systems may publish CompartmentDefinition resources so that other systems may make use of compartments properly.

  • CompartmentDefinitions are used by CapabilityStatement instances for specifying how resources are accessed
  • GraphDefinition also provides a mechanism for grouping resources, though it does not provide an additional search mechanism. Inclusion of resources in a GraphDefinition supports more complex criteria for inclusion than that allowed by CompartmentDefinition.

Structure

NameFlagsCard.TypeDescription & Constraintsdoco
.. CompartmentDefinition TUDomainResourceCompartment Definition for a resource
+ Warning: Name should be usable as an identifier for the module by machine processing applications such as code generation

Elements defined in Ancestors: id, meta, implicitRules, language, text, contained, extension, modifierExtension
Interfaces Implemented: CanonicalResource
... url ΣC1..1uriCanonical identifier for this compartment definition, represented as a URI (globally unique)
+ Warning: URL should not contain | or # - these characters make processing canonical references problematic
... version Σ0..1stringBusiness version of the compartment definition
... versionAlgorithm[x] Σ0..1How to compare versions
Binding: Version Algorithm (Extensible)
.... versionAlgorithmStringstring
.... versionAlgorithmCodingCoding
... title ΣT0..1stringName for this compartment definition (human friendly)
... status ?!Σ1..1codedraft | active | retired | unknown
Binding: PublicationStatus (Required)
... experimental Σ0..1booleanFor testing purposes, not real usage
... date Σ0..1dateTimeDate last changed
... publisher ΣT0..1stringName of the publisher/steward (organization or individual)
... contact Σ0..*ContactDetailContact details for the publisher

... description T0..1markdownNatural language description of the compartment definition
... useContext Σ0..*UsageContextThe context that the content is intended to support

... purpose T0..1markdownWhy this compartment definition is defined
... code Σ1..1codePatient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare
Binding: Compartment Type (Required)
... search Σ1..1booleanWhether the search syntax is supported
... resource Σ0..*BackboneElementHow a resource is related to the compartment

.... code Σ1..1codeName of resource type
Binding: Resource Types (Required)
.... param Σ0..*stringSearch Parameter Name, or chained parameters

.... documentation 0..1stringAdditional documentation about the resource and compartment
.... startParam 0..1uriSearch Param for interpreting $everything.start
.... endParam 0..1uriSearch Param for interpreting $everything.end

doco Documentation for this format icon

See the Extensions for this resource

UML Diagram (Legend)

CompartmentDefinition (DomainResource) +CanonicalResourceAn absolute URI that is used to identify this compartment definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this compartment definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the compartment definition is stored on different serversurl : uri [1..1]The identifier that is used to identify this version of the compartment definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the compartment definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequenceversion : string [0..1]Indicates the mechanism used to compare versions to determine which is more currentversionAlgorithm[x] : DataType [0..1] « string|Coding; null (Strength=Extensible) VersionAlgorithm+ »A natural language name identifying the compartment definition. This name should be usable as an identifier for the module by machine processing applications such as code generationname : string [1..1] « This element has or is affected by some invariantsC »A short, descriptive, user-friendly title for the capability statementtitle : string [0..1]The status of this compartment definition. Enables tracking the life-cycle of the content (this element modifies the meaning of other elements)status : code [1..1] « null (Strength=Required)PublicationStatus! »A Boolean value to indicate that this compartment definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usageexperimental : boolean [0..1]The date (and optionally time) when the compartment definition was last significantly changed. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the compartment definition changesdate : dateTime [0..1]The name of the organization or individual responsible for the release and ongoing maintenance of the compartment definitionpublisher : string [0..1]Contact details to assist a user in finding and communicating with the publishercontact : ContactDetail [0..*]A free text natural language description of the compartment definition from a consumer's perspectivedescription : markdown [0..1]The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate compartment definition instancesuseContext : UsageContext [0..*]Explanation of why this compartment definition is needed and why it has been designed as it haspurpose : markdown [0..1]Which compartment this definition describescode : code [1..1] « null (Strength=Required)CompartmentType! »Whether the search syntax is supported,search : boolean [1..1]ResourceThe name of a resource supported by the servercode : code [1..1] « null (Strength=Required)ResourceType! »The name of a search parameter that represents the link to the compartment. More than one may be listed because a resource may be linked to a compartment in more than one way,param : string [0..*]Additional documentation about the resource and compartmentdocumentation : string [0..1]Search Parameter for mapping requests made with $everything.start (e.g. on [Patient.$everything](patient-operation-everything.html))startParam : uri [0..1]Search Parameter for mapping requests made with $everything.end (e.g. on [Patient.$everything](patient-operation-everything.html))endParam : uri [0..1]Information about how a resource is related to the compartmentresource[0..*]

XML Template

<CompartmentDefinition xmlns="http://hl7.org/fhir"> doco
 <!-- from Resource: id, meta, implicitRules, and language -->
 <!-- from DomainResource: text, contained, extension, and modifierExtension -->
 <url value="[uri]"/><!-- 1..1 Canonical identifier for this compartment definition, represented as a URI (globally unique) -->
 <version value="[string]"/><!-- 0..1 Business version of the compartment definition -->
 <versionAlgorithm[x]><!-- 0..1 string|Coding How to compare versions --></versionAlgorithm[x]>
 <name value="[string]"/><!-- I 1..1 Name for this compartment definition (computer friendly) -->
 <title value="[string]"/><!-- 0..1 Name for this compartment definition (human friendly) -->
 <status value="[code]"/><!-- 1..1 draft | active | retired | unknown -->
 <experimental value="[boolean]"/><!-- 0..1 For testing purposes, not real usage -->
 <date value="[dateTime]"/><!-- 0..1 Date last changed -->
 <publisher value="[string]"/><!-- 0..1 Name of the publisher/steward (organization or individual) -->
 <contact><!-- 0..* ContactDetail Contact details for the publisher --></contact>
 <description value="[markdown]"/><!-- 0..1 Natural language description of the compartment definition -->
 <useContext><!-- 0..* UsageContext The context that the content is intended to support --></useContext>
 <purpose value="[markdown]"/><!-- 0..1 Why this compartment definition is defined -->
 <code value="[code]"/><!-- 1..1 Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare -->
 <search value="[boolean]"/><!-- 1..1 Whether the search syntax is supported -->
 <resource>  <!-- 0..* How a resource is related to the compartment -->
  <code value="[code]"/><!-- 1..1 Name of resource type -->
  <param value="[string]"/><!-- 0..* Search Parameter Name, or chained parameters -->
  <documentation value="[string]"/><!-- 0..1 Additional documentation about the resource and compartment -->
  <startParam value="[uri]"/><!-- 0..1 Search Param for interpreting $everything.start -->
  <endParam value="[uri]"/><!-- 0..1 Search Param for interpreting $everything.end -->
 </resource>
</CompartmentDefinition>

JSON Template

{doco
  "resourceType" : "CompartmentDefinition",
  // from Resource: id, meta, implicitRules, and language
  // from DomainResource: text, contained, extension, and modifierExtension
  "url" : "<uri>", // R!  Canonical identifier for this compartment definition, represented as a URI (globally unique)
  "version" : "<string>", // Business version of the compartment definition
  // versionAlgorithm[x]: How to compare versions. One of these 2:
  "versionAlgorithmString" : "<string>",
  "versionAlgorithmCoding" : { Coding },
  "name" : "<string>", // I R!  Name for this compartment definition (computer friendly)
  "title" : "<string>", // Name for this compartment definition (human friendly)
  "status" : "<code>", // R!  draft | active | retired | unknown
  "experimental" : <boolean>, // For testing purposes, not real usage
  "date" : "<dateTime>", // Date last changed
  "publisher" : "<string>", // Name of the publisher/steward (organization or individual)
  "contact" : [{ ContactDetail }], // Contact details for the publisher
  "description" : "<markdown>", // Natural language description of the compartment definition
  "useContext" : [{ UsageContext }], // The context that the content is intended to support
  "purpose" : "<markdown>", // Why this compartment definition is defined
  "code" : "<code>", // R!  Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare
  "search" : <boolean>, // R!  Whether the search syntax is supported
  "resource" : [{ // How a resource is related to the compartment
    "code" : "<code>", // R!  Name of resource type
    "param" : ["<string>"], // Search Parameter Name, or chained parameters
    "documentation" : "<string>", // Additional documentation about the resource and compartment
    "startParam" : "<uri>", // Search Param for interpreting $everything.start
    "endParam" : "<uri>" // Search Param for interpreting $everything.end
  }]
}

Turtle Template

@prefix fhir: <http://hl7.org/fhir/> .doco


[ a fhir:CompartmentDefinition;
  fhir:nodeRole fhir:treeRoot; # if this is the parser root

  # from Resource: .id, .meta, .implicitRules, and .language
  # from DomainResource: .text, .contained, .extension, and .modifierExtension
  fhir:url [ uri ] ; # 1..1 Canonical identifier for this compartment definition, represented as a URI (globally unique)
  fhir:version [ string ] ; # 0..1 Business version of the compartment definition
  # versionAlgorithm[x] : 0..1 How to compare versions. One of these 2
    fhir:versionAlgorithm [  a fhir:string ; string ]
    fhir:versionAlgorithm [  a fhir:Coding ; Coding ]
  fhir:name [ string ] ; # 1..1 I Name for this compartment definition (computer friendly)
  fhir:title [ string ] ; # 0..1 Name for this compartment definition (human friendly)
  fhir:status [ code ] ; # 1..1 draft | active | retired | unknown
  fhir:experimental [ boolean ] ; # 0..1 For testing purposes, not real usage
  fhir:date [ dateTime ] ; # 0..1 Date last changed
  fhir:publisher [ string ] ; # 0..1 Name of the publisher/steward (organization or individual)
  fhir:contact  ( [ ContactDetail ] ... ) ; # 0..* Contact details for the publisher
  fhir:description [ markdown ] ; # 0..1 Natural language description of the compartment definition
  fhir:useContext  ( [ UsageContext ] ... ) ; # 0..* The context that the content is intended to support
  fhir:purpose [ markdown ] ; # 0..1 Why this compartment definition is defined
  fhir:code [ code ] ; # 1..1 Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare
  fhir:search [ boolean ] ; # 1..1 Whether the search syntax is supported
  fhir:resource ( [ # 0..* How a resource is related to the compartment
    fhir:code [ code ] ; # 1..1 Name of resource type
    fhir:param  ( [ string ] ... ) ; # 0..* Search Parameter Name, or chained parameters
    fhir:documentation [ string ] ; # 0..1 Additional documentation about the resource and compartment
    fhir:startParam [ uri ] ; # 0..1 Search Param for interpreting $everything.start
    fhir:endParam [ uri ] ; # 0..1 Search Param for interpreting $everything.end
  ] ... ) ;
]

Changes since R4

CompartmentDefinition
CompartmentDefinition.versionAlgorithm[x]
  • Added Element
CompartmentDefinition.title
  • Added Element
CompartmentDefinition.resource.startParam
  • Added Element
CompartmentDefinition.resource.endParam
  • Added Element

See the Full Difference for further information

This analysis is available as XML or JSON.

See R3 <--> R4 Conversion Maps (status = 6 tests that all execute ok. 1 fail round-trip testing and 5 r3 resources are invalid (0 errors).)

Structure

NameFlagsCard.TypeDescription & Constraintsdoco
.. CompartmentDefinition TUDomainResourceCompartment Definition for a resource
+ Warning: Name should be usable as an identifier for the module by machine processing applications such as code generation

Elements defined in Ancestors: id, meta, implicitRules, language, text, contained, extension, modifierExtension
Interfaces Implemented: CanonicalResource
... url ΣC1..1uriCanonical identifier for this compartment definition, represented as a URI (globally unique)
+ Warning: URL should not contain | or # - these characters make processing canonical references problematic
... version Σ0..1stringBusiness version of the compartment definition
... versionAlgorithm[x] Σ0..1How to compare versions
Binding: Version Algorithm (Extensible)
.... versionAlgorithmStringstring
.... versionAlgorithmCodingCoding
... title ΣT0..1stringName for this compartment definition (human friendly)
... status ?!Σ1..1codedraft | active | retired | unknown
Binding: PublicationStatus (Required)
... experimental Σ0..1booleanFor testing purposes, not real usage
... date Σ0..1dateTimeDate last changed
... publisher ΣT0..1stringName of the publisher/steward (organization or individual)
... contact Σ0..*ContactDetailContact details for the publisher

... description T0..1markdownNatural language description of the compartment definition
... useContext Σ0..*UsageContextThe context that the content is intended to support

... purpose T0..1markdownWhy this compartment definition is defined
... code Σ1..1codePatient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare
Binding: Compartment Type (Required)
... search Σ1..1booleanWhether the search syntax is supported
... resource Σ0..*BackboneElementHow a resource is related to the compartment

.... code Σ1..1codeName of resource type
Binding: Resource Types (Required)
.... param Σ0..*stringSearch Parameter Name, or chained parameters

.... documentation 0..1stringAdditional documentation about the resource and compartment
.... startParam 0..1uriSearch Param for interpreting $everything.start
.... endParam 0..1uriSearch Param for interpreting $everything.end

doco Documentation for this format icon

See the Extensions for this resource

UML Diagram (Legend)

CompartmentDefinition (DomainResource) +CanonicalResourceAn absolute URI that is used to identify this compartment definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this compartment definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the compartment definition is stored on different serversurl : uri [1..1]The identifier that is used to identify this version of the compartment definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the compartment definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequenceversion : string [0..1]Indicates the mechanism used to compare versions to determine which is more currentversionAlgorithm[x] : DataType [0..1] « string|Coding; null (Strength=Extensible) VersionAlgorithm+ »A natural language name identifying the compartment definition. This name should be usable as an identifier for the module by machine processing applications such as code generationname : string [1..1] « This element has or is affected by some invariantsC »A short, descriptive, user-friendly title for the capability statementtitle : string [0..1]The status of this compartment definition. Enables tracking the life-cycle of the content (this element modifies the meaning of other elements)status : code [1..1] « null (Strength=Required)PublicationStatus! »A Boolean value to indicate that this compartment definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usageexperimental : boolean [0..1]The date (and optionally time) when the compartment definition was last significantly changed. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the compartment definition changesdate : dateTime [0..1]The name of the organization or individual responsible for the release and ongoing maintenance of the compartment definitionpublisher : string [0..1]Contact details to assist a user in finding and communicating with the publishercontact : ContactDetail [0..*]A free text natural language description of the compartment definition from a consumer's perspectivedescription : markdown [0..1]The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate compartment definition instancesuseContext : UsageContext [0..*]Explanation of why this compartment definition is needed and why it has been designed as it haspurpose : markdown [0..1]Which compartment this definition describescode : code [1..1] « null (Strength=Required)CompartmentType! »Whether the search syntax is supported,search : boolean [1..1]ResourceThe name of a resource supported by the servercode : code [1..1] « null (Strength=Required)ResourceType! »The name of a search parameter that represents the link to the compartment. More than one may be listed because a resource may be linked to a compartment in more than one way,param : string [0..*]Additional documentation about the resource and compartmentdocumentation : string [0..1]Search Parameter for mapping requests made with $everything.start (e.g. on [Patient.$everything](patient-operation-everything.html))startParam : uri [0..1]Search Parameter for mapping requests made with $everything.end (e.g. on [Patient.$everything](patient-operation-everything.html))endParam : uri [0..1]Information about how a resource is related to the compartmentresource[0..*]

XML Template

<CompartmentDefinition xmlns="http://hl7.org/fhir"> doco
 <!-- from Resource: id, meta, implicitRules, and language -->
 <!-- from DomainResource: text, contained, extension, and modifierExtension -->
 <url value="[uri]"/><!-- 1..1 Canonical identifier for this compartment definition, represented as a URI (globally unique) -->
 <version value="[string]"/><!-- 0..1 Business version of the compartment definition -->
 <versionAlgorithm[x]><!-- 0..1 string|Coding How to compare versions --></versionAlgorithm[x]>
 <name value="[string]"/><!-- I 1..1 Name for this compartment definition (computer friendly) -->
 <title value="[string]"/><!-- 0..1 Name for this compartment definition (human friendly) -->
 <status value="[code]"/><!-- 1..1 draft | active | retired | unknown -->
 <experimental value="[boolean]"/><!-- 0..1 For testing purposes, not real usage -->
 <date value="[dateTime]"/><!-- 0..1 Date last changed -->
 <publisher value="[string]"/><!-- 0..1 Name of the publisher/steward (organization or individual) -->
 <contact><!-- 0..* ContactDetail Contact details for the publisher --></contact>
 <description value="[markdown]"/><!-- 0..1 Natural language description of the compartment definition -->
 <useContext><!-- 0..* UsageContext The context that the content is intended to support --></useContext>
 <purpose value="[markdown]"/><!-- 0..1 Why this compartment definition is defined -->
 <code value="[code]"/><!-- 1..1 Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare -->
 <search value="[boolean]"/><!-- 1..1 Whether the search syntax is supported -->
 <resource>  <!-- 0..* How a resource is related to the compartment -->
  <code value="[code]"/><!-- 1..1 Name of resource type -->
  <param value="[string]"/><!-- 0..* Search Parameter Name, or chained parameters -->
  <documentation value="[string]"/><!-- 0..1 Additional documentation about the resource and compartment -->
  <startParam value="[uri]"/><!-- 0..1 Search Param for interpreting $everything.start -->
  <endParam value="[uri]"/><!-- 0..1 Search Param for interpreting $everything.end -->
 </resource>
</CompartmentDefinition>

JSON Template

{doco
  "resourceType" : "CompartmentDefinition",
  // from Resource: id, meta, implicitRules, and language
  // from DomainResource: text, contained, extension, and modifierExtension
  "url" : "<uri>", // R!  Canonical identifier for this compartment definition, represented as a URI (globally unique)
  "version" : "<string>", // Business version of the compartment definition
  // versionAlgorithm[x]: How to compare versions. One of these 2:
  "versionAlgorithmString" : "<string>",
  "versionAlgorithmCoding" : { Coding },
  "name" : "<string>", // I R!  Name for this compartment definition (computer friendly)
  "title" : "<string>", // Name for this compartment definition (human friendly)
  "status" : "<code>", // R!  draft | active | retired | unknown
  "experimental" : <boolean>, // For testing purposes, not real usage
  "date" : "<dateTime>", // Date last changed
  "publisher" : "<string>", // Name of the publisher/steward (organization or individual)
  "contact" : [{ ContactDetail }], // Contact details for the publisher
  "description" : "<markdown>", // Natural language description of the compartment definition
  "useContext" : [{ UsageContext }], // The context that the content is intended to support
  "purpose" : "<markdown>", // Why this compartment definition is defined
  "code" : "<code>", // R!  Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare
  "search" : <boolean>, // R!  Whether the search syntax is supported
  "resource" : [{ // How a resource is related to the compartment
    "code" : "<code>", // R!  Name of resource type
    "param" : ["<string>"], // Search Parameter Name, or chained parameters
    "documentation" : "<string>", // Additional documentation about the resource and compartment
    "startParam" : "<uri>", // Search Param for interpreting $everything.start
    "endParam" : "<uri>" // Search Param for interpreting $everything.end
  }]
}

Turtle Template

@prefix fhir: <http://hl7.org/fhir/> .doco


[ a fhir:CompartmentDefinition;
  fhir:nodeRole fhir:treeRoot; # if this is the parser root

  # from Resource: .id, .meta, .implicitRules, and .language
  # from DomainResource: .text, .contained, .extension, and .modifierExtension
  fhir:url [ uri ] ; # 1..1 Canonical identifier for this compartment definition, represented as a URI (globally unique)
  fhir:version [ string ] ; # 0..1 Business version of the compartment definition
  # versionAlgorithm[x] : 0..1 How to compare versions. One of these 2
    fhir:versionAlgorithm [  a fhir:string ; string ]
    fhir:versionAlgorithm [  a fhir:Coding ; Coding ]
  fhir:name [ string ] ; # 1..1 I Name for this compartment definition (computer friendly)
  fhir:title [ string ] ; # 0..1 Name for this compartment definition (human friendly)
  fhir:status [ code ] ; # 1..1 draft | active | retired | unknown
  fhir:experimental [ boolean ] ; # 0..1 For testing purposes, not real usage
  fhir:date [ dateTime ] ; # 0..1 Date last changed
  fhir:publisher [ string ] ; # 0..1 Name of the publisher/steward (organization or individual)
  fhir:contact  ( [ ContactDetail ] ... ) ; # 0..* Contact details for the publisher
  fhir:description [ markdown ] ; # 0..1 Natural language description of the compartment definition
  fhir:useContext  ( [ UsageContext ] ... ) ; # 0..* The context that the content is intended to support
  fhir:purpose [ markdown ] ; # 0..1 Why this compartment definition is defined
  fhir:code [ code ] ; # 1..1 Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare
  fhir:search [ boolean ] ; # 1..1 Whether the search syntax is supported
  fhir:resource ( [ # 0..* How a resource is related to the compartment
    fhir:code [ code ] ; # 1..1 Name of resource type
    fhir:param  ( [ string ] ... ) ; # 0..* Search Parameter Name, or chained parameters
    fhir:documentation [ string ] ; # 0..1 Additional documentation about the resource and compartment
    fhir:startParam [ uri ] ; # 0..1 Search Param for interpreting $everything.start
    fhir:endParam [ uri ] ; # 0..1 Search Param for interpreting $everything.end
  ] ... ) ;
]

Changes since Release 4

CompartmentDefinition
CompartmentDefinition.versionAlgorithm[x]
  • Added Element
CompartmentDefinition.title
  • Added Element
CompartmentDefinition.resource.startParam
  • Added Element
CompartmentDefinition.resource.endParam
  • Added Element

See the Full Difference for further information

This analysis is available as XML or JSON.

See R3 <--> R4 Conversion Maps (status = 6 tests that all execute ok. 1 fail round-trip testing and 5 r3 resources are invalid (0 errors).)

 

Additional definitions: Master Definition XML + JSON, XML Schema/Schematron + JSON Schema, ShEx (for Turtle) , the spreadsheet version & the dependency analysis

PathValueSetTypeDocumentation
CompartmentDefinition.versionAlgorithm[x] VersionAlgorithm Extensible

Indicates the mechanism used to compare versions to determine which is more current.

CompartmentDefinition.status PublicationStatus Required

The lifecycle status of an artifact.

CompartmentDefinition.code CompartmentType Required

Which type a compartment definition describes.

CompartmentDefinition.resource.code ResourceType Required

Concrete FHIR Resource Types

UniqueKeyLevelLocationDescriptionExpression
img cnl-0Warning (base)Name should be usable as an identifier for the module by machine processing applications such as code generationname.exists() implies name.matches('^[A-Z]([A-Za-z0-9_]){1,254}$')
img cnl-1Warning CompartmentDefinition.urlURL should not contain | or # - these characters make processing canonical references problematicexists() implies matches('^[^|# ]+$')

A compartment implicitly always includes the resource that is a 'root' of the compartment e.g. the resource Patient/123 is the root resource of the Patient Compartment for Patient/123. Thus an operation that retrieves everything within the compartment will include the base resource; a scope that grants access to everything within the compartment will grant access to the resource; etc.

As an example of compartment usage, to retrieve a list of a patient's conditions, use the URL:

  GET [base]/Patient/[id]/Condition

Additional search parameters can be defined, such as this hypothetical search for acute conditions:

  GET [base]/Patient/[id]/Condition?code:in=http://hspc.org/ValueSet/acute-concerns

Note that as searches, these are syntactic variations on these two search URLs respectively:

  GET [base]/Condition?patient=[id]
  GET [base]/Condition?patient=[id]&code:in=http://hspc.org/ValueSet/acute-concerns

The outcome of a compartment search is the same as the equivalent normal search. For example, both these searches return the same outcome if there is no patient 333:

  GET [base]/Patient/333/Condition
  GET [base]/Condition?patient=333

Whether the patient doesn't exist, or the user has no access to the patient, both these searches return an empty bundle with no matches. Some systems will include an operation outcome warning that there is no matching patient.

However, there is a key difference in functionality between compartment based searches and direct searches with parameters. Consider this search:

  GET [base]/Patient/[id]/Communication

Because the definition of the patient compartment for Communication 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:

  GET [base]/Communication?subject=[id]
  GET [base]/Communication?sender=[id]
  GET [base]/Communication?recipient=[id]

There is no way to do this as a single search, except by using the _filter:

  GET [base]/Communication?_filter=subject re [id] or sender re [id] or recipient re [id]

Further details of searching by compartment are described under the search operation. As a search related operation, the assignment of resources to compartments is only based on the current version of any of the resources involved. Note that contained patient resources cannot create a patient compartment of their own.

Note that while this specification describes how to use the compartment syntax to find resources that are logically associated with the compartment, the compartment is not part of the identity of the resource. E.g. the response to the following is not defined by this specification:

  GET [base]/Patient/[patient-id]/Condition/[resource-id]

The response for write operations (PUT/DELETE/PATCH) are also not defined by this specification. Nor is the response to a POST defined:

  POST [base]/Patient/[patient-id]/Condition

There is no expectation for servers to support either read or write to such URLs.

Compartments may be used explicitly, like this, but can also be used implicitly. For instance, if a FHIR server is providing a patient view of a record, the authorized user associated with use of the FHIR RESTful API may be limited to accessing records from the compartment instance(s) logically associated with their identity. Irrespective of whether compartments are being used explicitly or implicitly, servers will need to make arrangements to make some resources with no direct link to a patient available to the client (medications, substances, binaries, etc.).

Note that resources may cross between compartments, or interlink them. Examples of this would be where a Diagnostic Report identifies a subject, but an Observation it references identifies a different subject, or where a List resource references items that identify different subjects. Such cross-linking may arise for many valid reasons, including:

  • Cases where subject records are inter-linked - Transplants, Perinatal care, family therapy etc.
  • Workflow management where action lists link multiple patients and/or practitioners

Given the wide variety of use cases and contexts in which FHIR is used, compartments do not define how cross-linking is handled. Systems may reject resources, remove them from both compartments, or place them in both, or act in some other fashion.

The graph definition resource provides a method by which rules about cross-linking may be made and enforced.

It is at the discretion of the server whether to include resources in a compartment when the reference to the resource that establishes the compartment is in an extension.

Some resources are not in any compartment, e.g. Medication, Substance, Location. These resources are not linked directly to a patient or authored record, and are sometimes called 'master files'. Servers will need to make arrangements to make these resources available to the clients that are limited to particular compartments. For example, a Medication resource describes a medication itself and does not link to a patient; however, a resource such as MedicationAdministration connects the Medication (details of what was administered) to the patient (for whom was it administered), and so is required to interpret the administration.

Compartments are defined and added to the list above when implementer communities identify them as common access points for data. As described below, compartments have both syntactical and logical consequences, and both these aspects of their functionality are evaluated when deciding whether to define compartments.

Search parameters for this resource. See also the full list of search parameters for this resource, and check the Extensions registry for search parameters on extensions related to this resource. The common parameters also apply. See Searching for more information about searching in REST, messaging, and services.

NameTypeDescriptionExpressionIn Common
codetokenPatient | Encounter | RelatedPerson | Practitioner | DeviceCompartmentDefinition.code
contexttokenA use context assigned to the compartment definition(CompartmentDefinition.useContext.value.ofType(CodeableConcept))30 Resources
context-quantityquantityA quantity- or range-valued use context assigned to the compartment definition(CompartmentDefinition.useContext.value.ofType(Quantity)) | (CompartmentDefinition.useContext.value.ofType(Range))30 Resources
context-typetokenA type of use context assigned to the compartment definitionCompartmentDefinition.useContext.code30 Resources
context-type-quantitycompositeA use context type and quantity- or range-based value assigned to the compartment definitionOn CompartmentDefinition.useContext:
  context-type: code
  context-quantity: value.ofType(Quantity) | value.ofType(Range)
30 Resources
context-type-valuecompositeA use context type and value assigned to the compartment definitionOn CompartmentDefinition.useContext:
  context-type: code
  context: value.ofType(CodeableConcept)
30 Resources
datedateThe compartment definition publication dateCompartmentDefinition.date30 Resources
descriptionstringThe description of the compartment definitionCompartmentDefinition.description28 Resources
namestringComputationally friendly name of the compartment definitionCompartmentDefinition.name26 Resources
publisherstringName of the publisher of the compartment definitionCompartmentDefinition.publisher30 Resources
resourcetokenName of resource typeCompartmentDefinition.resource.code
statustokenThe current status of the compartment definitionCompartmentDefinition.status34 Resources
urluriThe uri that identifies the compartment definitionCompartmentDefinition.url33 Resources
versiontokenThe business version of the compartment definitionCompartmentDefinition.version30 Resources