On this page:

6.1LiveBundle API

 

Once LiveBundle rules have been configured and enabled on a FHIR Storage module, all FHIR Endpoints attached to that module will accept LiveBundle Operations.

6.1.1Add a Subscriber to a Watchlist

 
This method requires the FHIR_LIVEBUNDLE permission.

Each Watchlist has a set of resource ids for which Smile CDR stores LiveBundles. The type of these resource ids is the subscriberType of that Watchlist. A subscriber id is added to a watchlist using the $livebundle-watchlist-add operation on the Composition resource.

For example, to add Patient/123 to http://myorg.org/diabetes_management|PATIENT_WATCHLIST, call:

POST [base]/Composition/$livebundle-watchlist-add
Content-Type: application/fhir+json

{
  "resourceType": "Parameters",
  "parameter": [
		{
      "name": "watchlist",
      "valueCoding": {
          "system": "http://myorg.org/diabetes_management",
          "code": "PATIENT_WATCHLIST"
      }
		}, {
      "name": "subscriber",
      "valueString": "Patient/123"
    }
  ]
}

6.1.2Remove Subscriber from a Watchlist

 
This method requires the FHIR_LIVEBUNDLE permission.

A Subscriber is removed from the watchlist using the $livebundle-watchlist-delete operation on the Composition resource:

POST [base]/Composition/$livebundle-watchlist-delete
Content-Type: application/fhir+json

{
  "resourceType": "Parameters",
  "parameter": [
	{
      "name": "watchlist",
      "valueCoding": {
          "system": "http://myorg.org/diabetes_management",
          "code": "PATIENT_WATCHLIST"
      }
	}, {
      "name": "subscriber",
      "valueString": "Patient/123"
    }
  ]
}

6.1.3View list of Subscibers to a Watchlist

 
This method requires the FHIR_LIVEBUNDLE permission.

To obtain a list of Subscribers to a Watchlist, use the $livebundle-watchlist command:

GET [base]/Composition/$livebundle-watchlist?watchlist=http://myorg.org/diabetes_management|PATIENT_WATCHLIST

This will return a List resource with references to the Subscribers to that Watchlist.

6.1.4Request a LiveBundle

 
This method requires the FHIR_LIVEBUNDLE permission.

Once subscribers have been added to a Watchlist, the server will begin aggregating data for all rules that use that Watchlist. Request the aggregated data for a TrackingId (usually the SubscriberId) and a Rule by calling the $livebundle operation on the Composition resource.

GET [base]/Composition/$livebundle?rule=http://myorg.org/diabetes_management|LAST_VISIT&trackingId=Patient/123

Multiple trackingIds can be requested. In this case, a separate composition will be returned for each tracking id followed by the resources referred to in those compositions.

GET [base]/Composition/$livebundle?rule=http://myorg.org/diabetes_management|LAST_VISIT&trackingId=Patient/123,Patient/456

This returns a Bundle of that rule’s aggregated resources for that tracking id. The first entry in the bundle will be a Composition that references to the rest of the resources in the bundle, followed by those resources.

The _include parameter is supported on this operation. E.g. if the LAST_VISIT rule stored Encounter resources, you could also include the associated EpisodeOfCare resources by calling:

GET [base]/Composition/$livebundle?rule=http://myorg.org/diabetes_management|LAST_VISIT&trackingId=Patient/123&_include=Encounter:episodeOfCare

Two sort parameters are supported for livebundle: _sort=date which sorts results by date from earliest to latest and _sort=-date sorts results from latest to earliest by date. Root resources are sorted based on the keeper pathToOrderDate. Other resources stored in the LiveBundle or added with _include follow the root resources they are associated with.