Published on InterSystems Developer Community (https://community.intersystems.com)

Home > Get FHIR resource content as stream

Question
Sebastian Thiele · Apr 27, 2021

Get FHIR resource content as stream

Hi,

I am looking for a way to retrieve stream data from a FHIR resource. In my case the resourceType is "DocumentReference" and the the Base64 content is stored just as in the FHIR R4 specification

 "resource": {
        "id": "66bd8775-68ef-4710-a3a1-03114341a61a",
        "resourceType": "DocumentReference",
        "meta": {
          "profile": [
            "http://fhir.ch/ig/ch-core/StructureDefinition/ch-core-documentreference"
          ]
        },
        "status": "current",
        "content": [
          {
            "attachment": {
              "contentType": "application/pdf",
              "data": "JVBERi0xLjQKJdPr6...

I am interested in the data field but was not able to find a suitable method yet to access the contents of field data as a stream.

In an upward process step I´ve transformed the received FHIR bundle using HS.FHIR.DTL.vR4.Model.Resource.Bundle to retrieve a bundle object model. That way I was able to work with the contents of the bundle and am now at the point to use the document. Anyway using the contents of "data" would require a stream to retrieve for further processing. Is there any way the framework can be used to accomplish this?

best regards,
sebastian

#FHIR #InterSystems IRIS for Health
Product version: IRIS 2020.4

Source URL:https://community.intersystems.com/post/get-fhir-resource-content-stream