R4 Ballot #1 (Mixed Normative/Trial use) Current Build
This is the FHIR R4 Mixed Normative/Trial Use Ballot #1, and the version for the Cologne Connectathon in May 2018. The current version is R3 . See the ballot introduction for details about the ballot. For a full list of available versions, see the Directory of published versions and Timelines for an explanation of STU and other statuses.

2.34 2.36 Resource Bundle - Content

FHIR Infrastructure Work Group Maturity Level : 5   Normative Compartments : Not linked to any defined compartments

Normative Candidate Note: This page is candidate normative content for R4 in the Infrastructure Package . Once normative, it will lose it's Maturity Level, and breaking changes will no longer be made.

A container for a collection of resources.

One common operation performed with resources is to gather a collection of resources into a single instance with containing context. In FHIR this is referred to as "bundling" the resources together. These resource bundles are useful for a variety of different reasons, including:

  • Returning a set of resources that meet some criteria as part of a server operation (see RESTful Search )
  • Returning a set of versions of resources as part of the history operation on a server (see History )
  • Sending a set of resources as part of a message exchange (see Messaging )
  • Grouping a self-contained set of resources to act as an exchangeable and persistable collection with clinical integrity - e.g. a clinical document (see Documents )
  • Creating/updating/deleting a set of resources on a server as a single operation (including doing so as a single atomic transaction) (see Transactions )
  • Storing a collection of resources

There are two ways to collect resources together for transport and persistence purposes - contained resources , and bundles. There is an important difference between the two:

  • Contained resources are "in" the container resource - they can only ever be interpreted and/or changed in the context of the container
  • A bundle is a collection of resources that can have an independent existence - for example, they can might also be accessed directly using the RESTful API

In addition to these two technical mechanisms, there are three administrative and infrastructure resources which also support grouping of content: content. These resources do not contain resources directly, but instead use [Reference] to point to the grouped resources:

  • The List resource – Enumerates a flat collection of resources and provides features for managing the collection. While a particular List instance may represent a "snapshot", from a business process perspective the notion of "List" is dynamic – items are added and removed over time. The list resource references other resources. Lists may be curated and have specific business meaning.
  • The Group resource – Defines a group of specific people, animals, devices, etc. by enumerating them, or by describing qualities that group members have. The group resource refers to other resources, possibly implicitly. Groups are intended to be acted upon or observed as a whole; e.g. performing therapy on a group, calculating risk for a group, etc. This resource will commonly be used for public health (e.g. describing an at-risk population), clinical trials (e.g. defining a test subject pool) and similar purposes.
  • The Composition resource – Defines a set of healthcare-related information that is assembled together into a single logical document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement. The composition resource provides the basic structure of a FHIR document . The full content of the document is expressed using a Bundle. Compositions will often reference Lists as the focus of particular sections.

These three resources represent meaningful groupings of the resources they refer to (e.g. a discharge medication List, a Group of participants for a clinical trial, a set of resources that form a signed document), while a Bundle is merely is a container for resources used for transfer and storage. This resource list is referenced by measurereport not exhaustive; other resources also provde grouping functionality.

Structure

Name Flags Card. Type Description & Constraints doco
. . Bundle Σ I N Resource Contains a collection of resources
+ Rule: total only when a search or history
+ Rule: entry.search only when a search
+ Rule: entry.request mandatory for batch/transaction/history, otherwise prohibited
+ Rule: entry.response mandatory for batch-response/transaction-response/history, otherwise prohibited
+ Rule: FullUrl must be unique in a bundle, or else entries with the same fullUrl must have different meta.versionId (except in history bundles)
+ Rule: A document must have an identifier with a system and a value
+ entry.request only for some types of bundles + entry.response only for some types of bundles Rule: A document must have a date
+ total only when Rule: A document must have a search or history Composition as the first resource
+ entry.search only when Rule: A message must have a search MessageHeader as the first resource
Elements defined in Ancestors: id , meta , implicitRules , language
. . . identifier Σ 0..1 Identifier Persistent identifier for the bundle
. . . type Σ 1..1 code document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection
BundleType ( Required )
. . . timestamp Σ 0..1 instant When the bundle was assembled
. . . total Σ I 0..1 unsignedInt If search, the total number of matches
. . . link Σ 0..* BackboneElement Links related to this Bundle
. . . . relation Σ 1..1 string See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1
. . . . url Σ 1..1 uri Reference details for the link
. . . entry Σ I 0..* BackboneElement Entry in the bundle - will have a resource, resource or information
+ fullUrl cannot be a version specific reference + Rule: must be a resource unless there's a request or response
+ Rule: fullUrl cannot be a version specific reference
This repeating element order: For bundles of type 'document' and 'message', the first resource is special (must be Composition or MessageHeader respectively). For all bundles, the meaning of the order of entries depends on the bundle type
. . . . link Σ 0..* see link Links related to this entry
. . . . fullUrl Σ 0..1 uri Absolute URL URI for resource (server address, (Absolute URL server address or URI for UUID/OID)
. . . . resource Σ 0..1 Resource A resource in the bundle
. . . . search Σ I 0..1 BackboneElement Search related information
. . . . . mode Σ 0..1 code match | include | outcome - why this is in the result set
SearchEntryMode ( Required )
. . . . . score Σ 0..1 decimal Search ranking (between 0 and 1)
. . . . request Σ I 0..1 BackboneElement Transaction Related Information Additional execution information (transaction/batch/history)
. . . . . method Σ 1..1 code GET | HEAD | POST | PUT | DELETE | PATCH
HTTPVerb ( Required )
. . . . . url Σ 1..1 uri URL for HTTP equivalent of this entry
. . . . . ifNoneMatch Σ 0..1 string For managing cache currency
. . . . . ifModifiedSince Σ 0..1 instant For managing update contention cache currency
. . . . . ifMatch Σ 0..1 string For managing update contention
. . . . . ifNoneExist Σ 0..1 string For conditional creates
. . . . response Σ I 0..1 BackboneElement Transaction Related Information Results of execution (transaction/batch/history)
. . . . . status Σ 1..1 string Status response code (text optional)
. . . . . location Σ 0..1 uri The location, if location (if the operation returns a location location)
. . . . . etag Σ 0..1 string The Etag for the resource (if relevant)
. . . . . lastModified Σ 0..1 instant Server's date time modified
. . . . . outcome Σ 0..1 Resource OperationOutcome with hints and warnings (for batch/transaction)
. . . signature Σ TU 0..1 Signature Digital Signature

doco Documentation for this format

UML Diagram ( Legend )

Bundle ( Resource ) A persistent identifier for the batch bundle that won't change as a batch bundle is copied from server to server identifier : Identifier [0..1] Indicates the purpose of this bundle - how it was is intended to be used type : code [1..1] « Indicates the purpose of a bundle - how it was is intended to be used. (Strength=Required) BundleType ! » The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle timestamp : instant [0..1] If a set of search matches, this is the total number of matches for entries of type 'match' across all pages in the search (as opposed to search. It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of results entries in this bundle) the Bundle total : unsignedInt [0..1] Digital Signature - base64 encoded. XML-DSig or a JWT signature : Signature [0..1] Link A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1) relation : string [1..1] The reference details for the link url : uri [1..1] Entry The Absolute URL for the resource. The fullUrl SHALL not NOT disagree with the id in the resource. resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: * fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle) * Results from operations might involve resources that are not identified fullUrl : uri [0..1] The Resources Resource for the entry entry. The purpose/meaning of the resource is determined by the Bundle.type resource : Resource [0..1] Search Why this entry is in the result set - whether it's included as a match or because of an _include requirement requirement, or to convey information or warning information about the search process mode : code [0..1] « Why an entry is in the result set - whether it's included as a match or because of an _include requirement. requirement, or to convey information or warning information about the search process. (Strength=Required) SearchEntryMode ! » When searching, the server's search ranking score for the entry score : decimal [0..1] Request The In a transaction or batch, this is the HTTP verb action to be executed for this entry in either a change history, or entry. In a transaction/ transaction response history bundle, this indicates the HTTP action that occurred method : code [1..1] « HTTP verbs (in the HTTP command line). See [HTTP rfc](https://tools.ietf.org/html/rfc7231) for details. (Strength=Required) HTTPVerb ! » The URL for this entry, relative to the root (the address to which the request is posted) url : uri [1..1] If the ETag values match, return a 304 Not Modified status. See the API documentation for ["Conditional Read"](http.html#cread) ifNoneMatch : string [0..1] Only perform the operation if the last updated date matches. See the API documentation for ["Conditional Read"](http.html#cread) ifModifiedSince : instant [0..1] Only perform the operation if the Etag value matches. For more information, see the API section ["Managing Resource Contention"](http.html#concurrency) ifMatch : string [0..1] Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for ["Conditional Create"](http.html#ccreate). This is just the query portion of the URL - what follows the "?" (not including the "?") ifNoneExist : string [0..1] Response The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code status : string [1..1] The location header created by processing this operation, populated if the operation returns a location location : uri [0..1] The Etag for the resource, it if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency)) etag : string [0..1] The date/time that the resource was modified on the server lastModified : instant [0..1] An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction outcome : Resource [0..1] A series of links that provide context to this bundle link [0..*] A series of links that provide context to this entry link [0..*] Information about the search process that lead to the creation of this entry search [0..1] Additional information about how this entry should be processed as part of a transaction or batch. For history, it shows how the entry was processed to create the version contained in the entry request [0..1] Additional information about how this entry should be processed as part Indicates the results of a processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history response [0..1] An entry in a bundle resource - will either contain a resource, resource or information about a resource (transactions and history only) entry [0..*]

XML Template

<Bundle xmlns="http://hl7.org/fhir"> doco
 <!-- from Resource: id, meta, implicitRules, and language -->
 <</identifier>
 <

 <identifier><!-- 0..1 Identifier Persistent identifier for the bundle --></identifier>
 <type value="[code]"/><!-- 1..1 document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection -->

 <timestamp value="[instant]"/><!-- 0..1 When the bundle was assembled -->
 <

 <total value="[unsignedInt]"/><!-- ?? 0..1 If search, the total number of matches -->

 <link>  <!-- 0..* Links related to this Bundle -->
  <relation value="[string]"/><!-- 1..1 See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1 -->
  <url value="[uri]"/><!-- 1..1 Reference details for the link -->
 </link>
 <

 <entry>  <!-- 0..* Entry in the bundle - will have a resource or information -->

  <link><!-- 0..* Content as for Bundle.link Links related to this entry --></link>
  <<a href=bundle-definitions.html#Bundle.entry.fullUrl class=dict title="The Absolute URL for the resource.  The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: 

  <* Results from operations might involve resources that are not identified.">
  <</resource>

* Results from operations might involve resources that are not identified.">fullUrl value="[uri]"/><!-- 0..1 URI for resource (Absolute URL server address or URI for UUID/OID) -->
  <resource><!-- 0..1 Resource A resource in the bundle --></resource>

  <search>  <!-- ?? 0..1 Search related information -->
   <

   <mode value="[code]"/><!-- 0..1 match | include | outcome - why this is in the result set -->

   <score value="[decimal]"/><!-- 0..1 Search ranking (between 0 and 1) -->
  </search>
  <
   <

  <request>  <!-- ?? 0..1 Additional execution information (transaction/batch/history) -->
   <method value="[code]"/><!-- 1..1 GET | HEAD | POST | PUT | DELETE | PATCH -->

   <url value="[uri]"/><!-- 1..1 URL for HTTP equivalent of this entry -->
   <ifNoneMatch value="[string]"/><!-- 0..1 For managing cache currency -->
   <

   <ifModifiedSince value="[instant]"/><!-- 0..1 For managing cache currency -->

   <ifMatch value="[string]"/><!-- 0..1 For managing update contention -->
   <ifNoneExist value="[string]"/><!-- 0..1 For conditional creates -->
  </request>
  <

  <response>  <!-- ?? 0..1 Results of execution (transaction/batch/history) -->

   <status value="[string]"/><!-- 1..1 Status response code (text optional) -->
   <
   <

   <location value="[uri]"/><!-- 0..1 The location (if the operation returns a location) -->
   <etag value="[string]"/><!-- 0..1 The Etag for the resource (if relevant) -->

   <lastModified value="[instant]"/><!-- 0..1 Server's date time modified -->
   <outcome><!-- 0..1 Resource OperationOutcome with hints and warnings (for batch/transaction) --></outcome>
  </response>
 </entry>
 <signature><!-- 0..1 Signature Digital Signature --></signature>
</Bundle>

JSON Template

{doco
  "resourceType" : "Bundle",
  // from Resource: id, meta, implicitRules, and language
  "
  "

  "identifier" : { Identifier }, // Persistent identifier for the bundle
  "type" : "<code>", // R!  document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection

  "timestamp" : "<instant>", // When the bundle was assembled
  "

  "total" : "<unsignedInt>", // C? If search, the total number of matches

  "link" : [{ // Links related to this Bundle
    "relation" : "<string>", // R!  See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1
    "url" : "<uri>" // R!  Reference details for the link
  }],
  "

  "entry" : [{ // Entry in the bundle - will have a resource or information

    "link" : [{ Content as for Bundle.link }], // Links related to this entry
    "<a href=bundle-definitions.html#Bundle.entry.fullUrl class=dict title="The Absolute URL for the resource.  The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: 

    "* Results from operations might involve resources that are not identified.">fullUrl
    "

* Results from operations might involve resources that are not identified.">fullUrl" : "<uri>", // URI for resource (Absolute URL server address or URI for UUID/OID)
    "resource" : { Resource }, // A resource in the bundle

    "search" : { // C? Search related information
      "

      "mode" : "<code>", // match | include | outcome - why this is in the result set

      "score" : <decimal> // Search ranking (between 0 and 1)
    },
    "
      "

    "request" : { // C? Additional execution information (transaction/batch/history)
      "method" : "<code>", // R!  GET | HEAD | POST | PUT | DELETE | PATCH

      "url" : "<uri>", // R!  URL for HTTP equivalent of this entry
      "ifNoneMatch" : "<string>", // For managing cache currency
      "

      "ifModifiedSince" : "<instant>", // For managing cache currency

      "ifMatch" : "<string>", // For managing update contention
      "ifNoneExist" : "<string>" // For conditional creates
    },
    "

    "response" : { // C? Results of execution (transaction/batch/history)

      "status" : "<string>", // R!  Status response code (text optional)
      "
      "

      "location" : "<uri>", // The location (if the operation returns a location)
      "etag" : "<string>", // The Etag for the resource (if relevant)

      "lastModified" : "<instant>", // Server's date time modified
      "outcome" : { Resource } // OperationOutcome with hints and warnings (for batch/transaction)
    }
  }],
  "signature" : { Signature } // Digital Signature
}

Turtle Template

@prefix fhir: <http://hl7.org/fhir/> .doco
[ a fhir:Bundle;
  fhir:nodeRole fhir:treeRoot; # if this is the parser root
  # from Resource: .id, .meta, .implicitRules, and .language
  fhir:
  fhir:

  fhir:Bundle.identifier [ Identifier ]; # 0..1 Persistent identifier for the bundle
  fhir:Bundle.type [ code ]; # 1..1 document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection

  fhir:Bundle.timestamp [ instant ]; # 0..1 When the bundle was assembled
  fhir:

  fhir:Bundle.total [ unsignedInt ]; # 0..1 If search, the total number of matches

  fhir:Bundle.link [ # 0..* Links related to this Bundle
    fhir:Bundle.link.relation [ string ]; # 1..1 See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1
    fhir:Bundle.link.url [ uri ]; # 1..1 Reference details for the link
  ], ...;
  fhir:

  fhir:Bundle.entry [ # 0..* Entry in the bundle - will have a resource or information

    fhir:Bundle.entry.link [ See Bundle.link ], ... ; # 0..* Links related to this entry
    fhir:<a href=bundle-definitions.html#Bundle.entry.fullUrl class=dict title="The Absolute URL for the resource.  The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: 

    fhir:* Results from operations might involve resources that are not identified.">Bundle.entry.fullUrl
    fhir:

* Results from operations might involve resources that are not identified.">Bundle.entry.fullUrl [ uri ]; # 0..1 URI for resource (Absolute URL server address or URI for UUID/OID)
    fhir:Bundle.entry.resource [ Resource ]; # 0..1 A resource in the bundle

    fhir:Bundle.entry.search [ # 0..1 Search related information
      fhir:

      fhir:Bundle.entry.search.mode [ code ]; # 0..1 match | include | outcome - why this is in the result set

      fhir:Bundle.entry.search.score [ decimal ]; # 0..1 Search ranking (between 0 and 1)
    ];
    fhir:
      fhir:

    fhir:Bundle.entry.request [ # 0..1 Additional execution information (transaction/batch/history)
      fhir:Bundle.entry.request.method [ code ]; # 1..1 GET | HEAD | POST | PUT | DELETE | PATCH

      fhir:Bundle.entry.request.url [ uri ]; # 1..1 URL for HTTP equivalent of this entry
      fhir:Bundle.entry.request.ifNoneMatch [ string ]; # 0..1 For managing cache currency
      fhir:

      fhir:Bundle.entry.request.ifModifiedSince [ instant ]; # 0..1 For managing cache currency

      fhir:Bundle.entry.request.ifMatch [ string ]; # 0..1 For managing update contention
      fhir:Bundle.entry.request.ifNoneExist [ string ]; # 0..1 For conditional creates
    ];
    fhir:

    fhir:Bundle.entry.response [ # 0..1 Results of execution (transaction/batch/history)

      fhir:Bundle.entry.response.status [ string ]; # 1..1 Status response code (text optional)
      fhir:
      fhir:

      fhir:Bundle.entry.response.location [ uri ]; # 0..1 The location (if the operation returns a location)
      fhir:Bundle.entry.response.etag [ string ]; # 0..1 The Etag for the resource (if relevant)

      fhir:Bundle.entry.response.lastModified [ instant ]; # 0..1 Server's date time modified
      fhir:Bundle.entry.response.outcome [ Resource ]; # 0..1 OperationOutcome with hints and warnings (for batch/transaction)
    ];
  ], ...;
  fhir:Bundle.signature [ Signature ]; # 0..1 Digital Signature
]

Changes since R3

Bundle
Bundle.timestamp
  • Added Element

See the Full Difference for further information

This analysis is available as XML or JSON .

See R2 <--> R3 <--> R4 Conversion Maps (status = 23 28 tests of which 1 4 fail to execute . 11 20 fail round-trip testing and 11 21 r3 resources are invalid (3836 (0 errors). ). Note: these have note yet been updated to be R3 to R4 )

Structure

Name Flags Card. Type Description & Constraints doco
. . Bundle Σ I N Resource Contains a collection of resources
+ Rule: total only when a search or history
+ Rule: entry.search only when a search
+ Rule: entry.request mandatory for batch/transaction/history, otherwise prohibited
+ Rule: entry.response mandatory for batch-response/transaction-response/history, otherwise prohibited
+ Rule: FullUrl must be unique in a bundle, or else entries with the same fullUrl must have different meta.versionId (except in history bundles)
+ Rule: A document must have an identifier with a system and a value
+ entry.request only for some types of bundles + entry.response only for some types of bundles Rule: A document must have a date
+ total only when Rule: A document must have a search or history Composition as the first resource
+ entry.search only when Rule: A message must have a search MessageHeader as the first resource
Elements defined in Ancestors: id , meta , implicitRules , language
. . . identifier Σ 0..1 Identifier Persistent identifier for the bundle
. . . type Σ 1..1 code document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection
BundleType ( Required )
. . . timestamp Σ 0..1 instant When the bundle was assembled
. . . total Σ I 0..1 unsignedInt If search, the total number of matches
. . . link Σ 0..* BackboneElement Links related to this Bundle
. . . . relation Σ 1..1 string See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1
. . . . url Σ 1..1 uri Reference details for the link
. . . entry Σ I 0..* BackboneElement Entry in the bundle - will have a resource, resource or information
+ fullUrl cannot be a version specific reference + Rule: must be a resource unless there's a request or response
+ Rule: fullUrl cannot be a version specific reference
This repeating element order: For bundles of type 'document' and 'message', the first resource is special (must be Composition or MessageHeader respectively). For all bundles, the meaning of the order of entries depends on the bundle type
. . . . link Σ 0..* see link Links related to this entry
. . . . fullUrl Σ 0..1 uri Absolute URL URI for resource (server address, (Absolute URL server address or URI for UUID/OID)
. . . . resource Σ 0..1 Resource A resource in the bundle
. . . . search Σ I 0..1 BackboneElement Search related information
. . . . . mode Σ 0..1 code match | include | outcome - why this is in the result set
SearchEntryMode ( Required )
. . . . . score Σ 0..1 decimal Search ranking (between 0 and 1)
. . . . request Σ I 0..1 BackboneElement Transaction Related Information Additional execution information (transaction/batch/history)
. . . . . method Σ 1..1 code GET | HEAD | POST | PUT | DELETE | PATCH
HTTPVerb ( Required )
. . . . . url Σ 1..1 uri URL for HTTP equivalent of this entry
. . . . . ifNoneMatch Σ 0..1 string For managing cache currency
. . . . . ifModifiedSince Σ 0..1 instant For managing update contention cache currency
. . . . . ifMatch Σ 0..1 string For managing update contention
. . . . . ifNoneExist Σ 0..1 string For conditional creates
. . . . response Σ I 0..1 BackboneElement Transaction Related Information Results of execution (transaction/batch/history)
. . . . . status Σ 1..1 string Status response code (text optional)
. . . . . location Σ 0..1 uri The location, if location (if the operation returns a location location)
. . . . . etag Σ 0..1 string The Etag for the resource (if relevant)
. . . . . lastModified Σ 0..1 instant Server's date time modified
. . . . . outcome Σ 0..1 Resource OperationOutcome with hints and warnings (for batch/transaction)
. . . signature Σ TU 0..1 Signature Digital Signature

doco Documentation for this format

UML Diagram ( Legend )

Bundle ( Resource ) A persistent identifier for the batch bundle that won't change as a batch bundle is copied from server to server identifier : Identifier [0..1] Indicates the purpose of this bundle - how it was is intended to be used type : code [1..1] « Indicates the purpose of a bundle - how it was is intended to be used. (Strength=Required) BundleType ! » The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle timestamp : instant [0..1] If a set of search matches, this is the total number of matches for entries of type 'match' across all pages in the search (as opposed to search. It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of results entries in this bundle) the Bundle total : unsignedInt [0..1] Digital Signature - base64 encoded. XML-DSig or a JWT signature : Signature [0..1] Link A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1) relation : string [1..1] The reference details for the link url : uri [1..1] Entry The Absolute URL for the resource. The fullUrl SHALL not NOT disagree with the id in the resource. resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: * fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle) * Results from operations might involve resources that are not identified fullUrl : uri [0..1] The Resources Resource for the entry entry. The purpose/meaning of the resource is determined by the Bundle.type resource : Resource [0..1] Search Why this entry is in the result set - whether it's included as a match or because of an _include requirement requirement, or to convey information or warning information about the search process mode : code [0..1] « Why an entry is in the result set - whether it's included as a match or because of an _include requirement. requirement, or to convey information or warning information about the search process. (Strength=Required) SearchEntryMode ! » When searching, the server's search ranking score for the entry score : decimal [0..1] Request The In a transaction or batch, this is the HTTP verb action to be executed for this entry in either a change history, or entry. In a transaction/ transaction response history bundle, this indicates the HTTP action that occurred method : code [1..1] « HTTP verbs (in the HTTP command line). See [HTTP rfc](https://tools.ietf.org/html/rfc7231) for details. (Strength=Required) HTTPVerb ! » The URL for this entry, relative to the root (the address to which the request is posted) url : uri [1..1] If the ETag values match, return a 304 Not Modified status. See the API documentation for ["Conditional Read"](http.html#cread) ifNoneMatch : string [0..1] Only perform the operation if the last updated date matches. See the API documentation for ["Conditional Read"](http.html#cread) ifModifiedSince : instant [0..1] Only perform the operation if the Etag value matches. For more information, see the API section ["Managing Resource Contention"](http.html#concurrency) ifMatch : string [0..1] Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for ["Conditional Create"](http.html#ccreate). This is just the query portion of the URL - what follows the "?" (not including the "?") ifNoneExist : string [0..1] Response The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code status : string [1..1] The location header created by processing this operation, populated if the operation returns a location location : uri [0..1] The Etag for the resource, it if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency)) etag : string [0..1] The date/time that the resource was modified on the server lastModified : instant [0..1] An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction outcome : Resource [0..1] A series of links that provide context to this bundle link [0..*] A series of links that provide context to this entry link [0..*] Information about the search process that lead to the creation of this entry search [0..1] Additional information about how this entry should be processed as part of a transaction or batch. For history, it shows how the entry was processed to create the version contained in the entry request [0..1] Additional information about how this entry should be processed as part Indicates the results of a processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history response [0..1] An entry in a bundle resource - will either contain a resource, resource or information about a resource (transactions and history only) entry [0..*]

XML Template

<Bundle xmlns="http://hl7.org/fhir"> doco
 <!-- from Resource: id, meta, implicitRules, and language -->
 <</identifier>
 <

 <identifier><!-- 0..1 Identifier Persistent identifier for the bundle --></identifier>
 <type value="[code]"/><!-- 1..1 document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection -->

 <timestamp value="[instant]"/><!-- 0..1 When the bundle was assembled -->
 <

 <total value="[unsignedInt]"/><!-- ?? 0..1 If search, the total number of matches -->

 <link>  <!-- 0..* Links related to this Bundle -->
  <relation value="[string]"/><!-- 1..1 See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1 -->
  <url value="[uri]"/><!-- 1..1 Reference details for the link -->
 </link>
 <

 <entry>  <!-- 0..* Entry in the bundle - will have a resource or information -->

  <link><!-- 0..* Content as for Bundle.link Links related to this entry --></link>
  <<a href=bundle-definitions.html#Bundle.entry.fullUrl class=dict title="The Absolute URL for the resource.  The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: 

  <* Results from operations might involve resources that are not identified.">
  <</resource>

* Results from operations might involve resources that are not identified.">fullUrl value="[uri]"/><!-- 0..1 URI for resource (Absolute URL server address or URI for UUID/OID) -->
  <resource><!-- 0..1 Resource A resource in the bundle --></resource>

  <search>  <!-- ?? 0..1 Search related information -->
   <

   <mode value="[code]"/><!-- 0..1 match | include | outcome - why this is in the result set -->

   <score value="[decimal]"/><!-- 0..1 Search ranking (between 0 and 1) -->
  </search>
  <
   <

  <request>  <!-- ?? 0..1 Additional execution information (transaction/batch/history) -->
   <method value="[code]"/><!-- 1..1 GET | HEAD | POST | PUT | DELETE | PATCH -->

   <url value="[uri]"/><!-- 1..1 URL for HTTP equivalent of this entry -->
   <ifNoneMatch value="[string]"/><!-- 0..1 For managing cache currency -->
   <

   <ifModifiedSince value="[instant]"/><!-- 0..1 For managing cache currency -->

   <ifMatch value="[string]"/><!-- 0..1 For managing update contention -->
   <ifNoneExist value="[string]"/><!-- 0..1 For conditional creates -->
  </request>
  <

  <response>  <!-- ?? 0..1 Results of execution (transaction/batch/history) -->

   <status value="[string]"/><!-- 1..1 Status response code (text optional) -->
   <
   <

   <location value="[uri]"/><!-- 0..1 The location (if the operation returns a location) -->
   <etag value="[string]"/><!-- 0..1 The Etag for the resource (if relevant) -->

   <lastModified value="[instant]"/><!-- 0..1 Server's date time modified -->
   <outcome><!-- 0..1 Resource OperationOutcome with hints and warnings (for batch/transaction) --></outcome>
  </response>
 </entry>
 <signature><!-- 0..1 Signature Digital Signature --></signature>
</Bundle>

JSON Template

{doco
  "resourceType" : "Bundle",
  // from Resource: id, meta, implicitRules, and language
  "
  "

  "identifier" : { Identifier }, // Persistent identifier for the bundle
  "type" : "<code>", // R!  document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection

  "timestamp" : "<instant>", // When the bundle was assembled
  "

  "total" : "<unsignedInt>", // C? If search, the total number of matches

  "link" : [{ // Links related to this Bundle
    "relation" : "<string>", // R!  See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1
    "url" : "<uri>" // R!  Reference details for the link
  }],
  "

  "entry" : [{ // Entry in the bundle - will have a resource or information

    "link" : [{ Content as for Bundle.link }], // Links related to this entry
    "<a href=bundle-definitions.html#Bundle.entry.fullUrl class=dict title="The Absolute URL for the resource.  The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: 

    "* Results from operations might involve resources that are not identified.">fullUrl
    "

* Results from operations might involve resources that are not identified.">fullUrl" : "<uri>", // URI for resource (Absolute URL server address or URI for UUID/OID)
    "resource" : { Resource }, // A resource in the bundle

    "search" : { // C? Search related information
      "

      "mode" : "<code>", // match | include | outcome - why this is in the result set

      "score" : <decimal> // Search ranking (between 0 and 1)
    },
    "
      "

    "request" : { // C? Additional execution information (transaction/batch/history)
      "method" : "<code>", // R!  GET | HEAD | POST | PUT | DELETE | PATCH

      "url" : "<uri>", // R!  URL for HTTP equivalent of this entry
      "ifNoneMatch" : "<string>", // For managing cache currency
      "

      "ifModifiedSince" : "<instant>", // For managing cache currency

      "ifMatch" : "<string>", // For managing update contention
      "ifNoneExist" : "<string>" // For conditional creates
    },
    "

    "response" : { // C? Results of execution (transaction/batch/history)

      "status" : "<string>", // R!  Status response code (text optional)
      "
      "

      "location" : "<uri>", // The location (if the operation returns a location)
      "etag" : "<string>", // The Etag for the resource (if relevant)

      "lastModified" : "<instant>", // Server's date time modified
      "outcome" : { Resource } // OperationOutcome with hints and warnings (for batch/transaction)
    }
  }],
  "signature" : { Signature } // Digital Signature
}

Turtle Template

@prefix fhir: <http://hl7.org/fhir/> .doco
[ a fhir:Bundle;
  fhir:nodeRole fhir:treeRoot; # if this is the parser root
  # from Resource: .id, .meta, .implicitRules, and .language
  fhir:
  fhir:

  fhir:Bundle.identifier [ Identifier ]; # 0..1 Persistent identifier for the bundle
  fhir:Bundle.type [ code ]; # 1..1 document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection

  fhir:Bundle.timestamp [ instant ]; # 0..1 When the bundle was assembled
  fhir:

  fhir:Bundle.total [ unsignedInt ]; # 0..1 If search, the total number of matches

  fhir:Bundle.link [ # 0..* Links related to this Bundle
    fhir:Bundle.link.relation [ string ]; # 1..1 See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1
    fhir:Bundle.link.url [ uri ]; # 1..1 Reference details for the link
  ], ...;
  fhir:

  fhir:Bundle.entry [ # 0..* Entry in the bundle - will have a resource or information

    fhir:Bundle.entry.link [ See Bundle.link ], ... ; # 0..* Links related to this entry
    fhir:<a href=bundle-definitions.html#Bundle.entry.fullUrl class=dict title="The Absolute URL for the resource.  The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: 

    fhir:* Results from operations might involve resources that are not identified.">Bundle.entry.fullUrl
    fhir:

* Results from operations might involve resources that are not identified.">Bundle.entry.fullUrl [ uri ]; # 0..1 URI for resource (Absolute URL server address or URI for UUID/OID)
    fhir:Bundle.entry.resource [ Resource ]; # 0..1 A resource in the bundle

    fhir:Bundle.entry.search [ # 0..1 Search related information
      fhir:

      fhir:Bundle.entry.search.mode [ code ]; # 0..1 match | include | outcome - why this is in the result set

      fhir:Bundle.entry.search.score [ decimal ]; # 0..1 Search ranking (between 0 and 1)
    ];
    fhir:
      fhir:

    fhir:Bundle.entry.request [ # 0..1 Additional execution information (transaction/batch/history)
      fhir:Bundle.entry.request.method [ code ]; # 1..1 GET | HEAD | POST | PUT | DELETE | PATCH

      fhir:Bundle.entry.request.url [ uri ]; # 1..1 URL for HTTP equivalent of this entry
      fhir:Bundle.entry.request.ifNoneMatch [ string ]; # 0..1 For managing cache currency
      fhir:

      fhir:Bundle.entry.request.ifModifiedSince [ instant ]; # 0..1 For managing cache currency

      fhir:Bundle.entry.request.ifMatch [ string ]; # 0..1 For managing update contention
      fhir:Bundle.entry.request.ifNoneExist [ string ]; # 0..1 For conditional creates
    ];
    fhir:

    fhir:Bundle.entry.response [ # 0..1 Results of execution (transaction/batch/history)

      fhir:Bundle.entry.response.status [ string ]; # 1..1 Status response code (text optional)
      fhir:
      fhir:

      fhir:Bundle.entry.response.location [ uri ]; # 0..1 The location (if the operation returns a location)
      fhir:Bundle.entry.response.etag [ string ]; # 0..1 The Etag for the resource (if relevant)

      fhir:Bundle.entry.response.lastModified [ instant ]; # 0..1 Server's date time modified
      fhir:Bundle.entry.response.outcome [ Resource ]; # 0..1 OperationOutcome with hints and warnings (for batch/transaction)
    ];
  ], ...;
  fhir:Bundle.signature [ Signature ]; # 0..1 Digital Signature
]

Changes since DSTU2 Release 3

Bundle
Bundle.timestamp
  • Added Element

See the Full Difference for further information

This analysis is available as XML or JSON .

See R2 <--> R3 <--> R4 Conversion Maps (status = 23 28 tests of which 1 4 fail to execute . 11 20 fail round-trip testing and 11 21 r3 resources are invalid (3836 (0 errors). ). Note: these have note yet been updated to be R3 to R4 )

 

Alternate See the Profiles & Extensions and the alternate definitions: Master Definition XML + JSON , XML Schema / Schematron + JSON Schema , ShEx (for Turtle ) + see the extensions & the dependency analysis

Path Definition Type Reference
Bundle.type Indicates the purpose of a bundle - how it was is intended to be used. Required BundleType
Bundle.entry.search.mode Why an entry is in the result set - whether it's included as a match or because of an _include requirement. requirement, or to convey information or warning information about the search process. Required SearchEntryMode
Bundle.entry.request.method HTTP verbs (in the HTTP command line). See [HTTP rfc](https://tools.ietf.org/html/rfc7231) for details. Required HTTPVerb

id Level Location Description Expression
bdl-1 : Rule (base) total only when a search or history ( expression : total.empty() or (type = 'searchset') or (type = 'history') )
bdl-2 : Rule (base) entry.search only when a search ( expression : entry.search.empty() or (type = 'searchset') )
bdl-3 : Rule (base) entry.request only mandatory for some types of bundles ( expression batch/transaction/history, otherwise prohibited : entry.request.empty() or type entry.all(request.exists() = (%resource.type = 'batch' or type %resource.type = 'transaction' or type %resource.type = 'history' 'history')) )
bdl-4 : Rule (base) entry.response only mandatory for some types of bundles ( expression batch-response/transaction-response/history, otherwise prohibited : entry.response.empty() or type entry.all(response.exists() = (%resource.type = 'batch-response' or type %resource.type = 'transaction-response' or %resource.type = 'history')) )
bdl-5 : On Bundle.entry: Rule Bundle.entry must be a resource unless there's a request or response ( expression on Bundle.entry: resource.exists() or request.exists() or response.exists() )
bdl-7 : Rule (base) FullUrl must be unique in a bundle, or else entries with the same fullUrl must have different meta.versionId ( expression (except in history bundles) : (type = 'history') or entry.where(fullUrl.exists()).select(fullUrl&resource.meta.versionId).isDistinct() )
bdl-8 : On Bundle.entry: Rule Bundle.entry fullUrl cannot be a version specific reference ( expression on Bundle.entry: fullUrl.contains('/_history/').not() )
bdl-9 : Rule (base) A document must have an identifier with a system and a value ( expression : type = 'document' implies (identifier.system.exists() and identifier.value.exists()) ) 2.34.3.3
bdl-10 Rule (base) A document must have a date type = 'document' implies (meta.lastUpdated.hasValue())
bdl-11 Rule (base) A document must have a Composition as the first resource type = 'document' implies entry.first().resource.is(Composition)
bdl-12 Rule (base) A message must have a MessageHeader as the first resource type = 'message' implies entry.first().resource.is(MessageHeader)
  • Conceptually, a bundle is a list of resources with some context (named links, and status on the entries)
  • Since a Bundle is itself a Resource it has the same common metadata as all resources, including profile assertions, tags, and security labels
  • Although there are no extensions on the Bundle itself, link , entry , and search / request / response can all have extensions. See Patient and Location for examples on search
  • Both Bundle.link and Bundle.entry.link are defined to support providing additional context when Bundles are used (e.g. HATEOAS ). Bundle.entry.link corresponds to links found in the HTTP header if the resource in the entry was read directly. This specification defines some specific uses of Bundle.link for searching and paging , but no specific uses for Bundle.entry.link, and no defined function in a transaction - meaning is implementation specific
  • Bundles have both .id and .identifier - see Resource Identities for further information

The content and rules for using a Bundle depend on the type of the bundle. Note that all bundle types use resource identity resolution as described below.

A document Bundle (type = "document") consists of a series of entries, the first of which is a Composition . Each entry element SHALL contain a resource. See Documents for further information.

Example

A message Bundle (type = "message") consists of a series of entries, the first of which is a MessageHeader . Each entry element SHALL contain a resource. See Messaging for further information.

Example Request and Response

A set of search results (type = "searchset") consists of a series of 0 or more entries. Each entry element SHALL contain a resource. See Search for further information.

In addition, Bundle.total may be used to return the total number of resources that match the search, and that may be returned by following the "next" link .

For each entry, a search set can also contain two specific pieces of search related information:

  • search.mode : An indication of whether the resource is in the search set because it matched the search criteria, criteria or whether it is included because another resource refers to it (e.g. by the _include parameter)
  • search.score : The server's search ranking score for the entry. Servers are not required to return a ranking score, but if they do, 1 is most relevant, and 0 is least relevant. Note: often, search results are sorted by score, but the client may specify a different sort order (see Search Relevance )

Example

A change history (type = "history") consists of a series of 0 or more entries. Each entry element SHALL contain a request element that describes the change that was made, made and, if the method is a POST or PUT, a resource that represents the state of the resource at the conclusion of the operation. A response element SHALL also be present so that consumers can access the location header. See History for further information.

In addition, Bundle.total may be used to return the total number of resources that are included in the change history, and including those that may be returned by following the "next" link .

A transaction (type = "transaction") or batch (type = "batch") consists of a series of 0 or more entries. Each entry element SHALL contain either a request element, or a resource element (or both). See Transactions for further information. Each entry in a transaction has the details of an HTTP operation that informs the system processing the transaction what to do with the entry. If the entry method is a 'PUT' or 'POST', then the entry SHALL contain a resource that becomes the body of the HTTP operation. If there is no request element, then there SHALL be a resource and the server must infer whether this is a create or an update from the resource identity supplied. See Transactions for further information.

Example

A transaction response (type = "transaction-response") or batch response (type="batch-response") consists of a series of 0 or more entries, entries: 1 for each entry in the transaction or batch it is in response to. Each entry element SHALL contain a response element which indicates the outcome of the HTTP operation that the server performed for the entry.

Example

A collection (type = "collection") consists of a series of 0 or more entries. No particular use with respect to the FHIR specification is associated with this Bundle. Each entry element SHALL contain a resource.

Example

Except for transactions and batches, each entry in a Bundle must have a fullUrl which is the identity of the resource in the entry. Note that this is not a versioned reference to the resource, but its identity. Where a resource is not assigned a persistent identity that can be used in the Bundle, a UUID should be used (urn:uuid:...).

For transactions and batches, entries SHALL MAY not have fullURLs when the entry.request.method = POST, and the resource has no identity. Note that even in this case, there may still be a fullURL in a transaction on a POST so that relationships between resources can be represented (see Transactions ).

In some Bundles, a A given version of a resource can SHALL only appear once: Type Rules document no duplicates message no duplicates (generally not, unless noted explicitly once in the event definition e.g. for messaging deltas?) transaction no duplicates allowed transaction-response no duplicates allowed batch no duplicates allowed batch-response no duplicates allowed history yes, duplicates are allowed searchset no duplicates allowed collection yes, duplicates are allowed, though generally each Bundle. There might, however, be multiple versions of a single resource present in a single bundle. This would not be expected in Bundles of type history , and also might be necessitated by closely tracking Provenance.

Note that the meaning of an unversioned reference to a good idea resource that appears multiple times is potentially ambiguous, though processors may have additional informaton to help resolve this (e.g. change order in a history bundle).

When processing batches and transactions, it is at server discretion how to behave if multiple versions of a single resource are present.

The Bundle resource is a packaging construct that has one of more entries that are other kinds of resources. Those resources themselves have references to other resources - e.g. an Observation that refers to a Patient. The referenced resources may also be found in the Bundle. For example, the system that constructed the Bundle may have included both the Observation and the Patient. The content of the references between resources doesn't change because of the bundle.

This section documents a method that resolves references correctly within a bundle. Note that this method does not define any new semantics; resolution is based on the way resource identity and resource references work.

Applications reading a Bundle should always look for a resource by its identity in the bundle first before trying to access it by its URL. URL externally.

How to resolve a reference in a Bundle:

  • If the reference is not an absolute reference, convert it to an absolute URL:
    • If if the reference has the format [type]/[id], and
    • if the fullUrl starts with urn:uuid: or urn:oid:, then append for the id to bundle entry containing the base resource is a RESTful one (see the RESTful URL regex )
      • extract the [root] from the fullUrl, and append the reference (type/id) to it
      • then try to resolve within the bundle as for a RESTful URL reference.
      • If no resolution is possible, then the reference has no defined meaning within this specification
    • if the fullUrl of the resource that contains the reference else no resolution is a RESTful one (see the RESTful URL regex ), extract the [root] , possible and append the reference to it otherwise, treat the fullUrl as a normal URL, and follow the normal method for Resolving Relative References to Absolute Form has no defined meaning within this specification
  • else
    • Look for an entry with a fullUrl that contains matches the URL URI in the reference
    • If if no match is found, and the resource URI is not in the bundle, and must a URL that can be found elsewhere resolved (e.g. if an http: URL, URL), try accessing it directly)
    • If multiple matches are found, it is ambiguous which is correct

Note, in addition, that a reference may be by identifier, and if it is, and there is no URL, it may be resolved by scanning the ids in the bundle. Note also that transactions may contain conditional references that must be resolved by the server before processing the matches.

If the reference is version specific (either relative or absolute), then remove the version from the URL before matching fullUrl, and then match the version based on Resource.meta.versionId . Note that the rules for resolving references in contained resources are the same as those for resolving resources in the resource that contains the contained resource.

Here If multiple matches are found, it is ambiguous which is correct. Applications MAY return an error or take some other action as they deem appropriate.

There is an example Bundle the that demonstrates these rules: rules.

<Bundle xmlns="http://hl7.org/fhir"> <type value="collection"/> <!-- A patient that already has an id on a server --> <entry> <fullUrl value="http://example.org/fhir/Patient/23"/> <resource> <Patient> <id value="23"/> </Patient> </resource> </entry> <!-- A patient that doesn't have a persistent home - but it does have a UUID assigned for this bundle "locally identified" --> <entry> <fullUrl value="urn:uuid:04121321-4af5-424c-a0e1-ed3aab1c349d"/> <resource> <Patient> </Patient> </resource> </entry> <!-- a relative resource reference --> <entry> <fullUrl value="http://example.org/fhir/Observation/123"/> <resource> <Observation> <id value="123"/> <subject> <!-- this is reference to the first resource above --> <reference value="Patient/23"/> </subject> </Observation> </resource> </entry>

The Bundle resource type has an end-point like all most other resources. This end-point serves the usual interactions . Bundles are treated as static resources on the /Bundle end-point (i.e. when a batch, transaction, or message is POSTed to /Bundle, it is stored as is, and the content is not processed as batch, transaction, or message - instead, they are processed like normal resource, with indexing / auditing etc. Performing a GET /Bundle/[location] will return the same resource.

The Bundle end point does have two special search parameters - composition and message , which allow for chained search into the first (special) entries in document and message resources.

Search parameters for this resource. The common parameters also apply. See Searching for more information about searching in REST, messaging, and services.

Name Type Description Expression In Common
composition reference The first resource in the bundle, if the bundle type is "document" - this is a composition, and this parameter provides access to searches search its contents Bundle.entry[0].resource
( Composition )
identifier token Persistent identifier for the bundle Bundle.identifier
message reference The first resource in the bundle, if the bundle type is "message" - this is a message header, and this parameter provides access to search its contents Bundle.entry[0].resource
( MessageHeader )
timestamp date When the bundle was assembled Bundle.timestamp
type token document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection Bundle.type