0

Working the first time with FHIR, and I can't figure out how I retrieve all data saved as a bundle at once.

So I save a Bundle: Composition with 3 references. Everything is successful. When I call the data (GET) then I get my Composition, but the section just shows the references, so I call each on of the separate to get all the data.

Is there a better method? My method is prone to fail.

moritz
  • 3
  • 2

2 Answers2

1

If you send a transaction or batch to the 'root' endpoint, that will cause the individual resources to be created but the batch won't be persisted. However, if you post a document bundle to the Bundle endpoint, the Bundle should be stored and retrievable as a Bundle. All that said, in FHIR, it's more typical to store individual resources and retrieve individual resources (though you can use _include, _revinclude and operations like $everything to retrieve more than one at the same time). Retrieving multiple resources shouldn't be more error-prone.

Lloyd McKenzie
  • 6,345
  • 1
  • 13
  • 10
0

Did your Bundle save as a Bundle (POSTed to Bundle endpoint), or were the resources inside it saved separately (Bundle POSTed to root endpoint)? If it was the latter, you could check if the server supports the $document operation. If you invoke that on the Composition, the server will send you a Bundle, containing the Composition plus the referenced resources.

Mirjam Baltus
  • 2,035
  • 9
  • 13
  • I tried the $document operation before, but I still get "section": [ { "title": "228438002", "entry": [ { "reference": "Observation/5df162b1cf56931d0bea0bf1" } ] }, { – moritz Jan 06 '20 at 19:08
  • I save it like this: resourceType: 'Bundle', type: 'transaction', entry: [ { Looks like a Bundle save as a Bundle? – moritz Jan 06 '20 at 19:09
  • But did you POST it to the server endpoint, and did you get a transaction-response Bundle back, or did you POST it to /Bundle and get a 201 created response? The $document operation will give you a Bundle of resources. The section of the Composition will still have the reference, and the Observation should be somewhere else in the Bundle. In FHIR, resources are separate entities, and are not put inline if that's what you expected. – Mirjam Baltus Jan 07 '20 at 07:27
  • The backend was buggy. I could solve my problem with the support . Thanks for your help – moritz Jan 07 '20 at 14:14