FHIR Chat · binary resources · IG creation

Stream: IG creation

Topic: binary resources


view this post on Zulip John Moehrke (Dec 08 2021 at 19:28):

I seem to recall some more easy mechanism was added to IG build to support Binary. Something where our binary content could be just a file, that the IG builder would base64binary and encapsulate in a Binary. Or do I need to have a binary json with the content base64 encoded inside?

view this post on Zulip Grahame Grieve (Dec 08 2021 at 19:32):

you can just reference a file as a binary, and it'll be converted to a Binary resource autoamatically

view this post on Zulip John Moehrke (Dec 08 2021 at 19:34):

not sure I understand. so where do I put this file? and how do I refer to it? For example, I have a SAML xml file. I don't want the IG to think that it is FHIR xml

view this post on Zulip Grahame Grieve (Dec 08 2021 at 19:43):

you need to put an extension on the reference to the resource:

 "extension" : [{
  "url" : "http://hl7.org/fhir/StructureDefinition/implementationguide-resource-format",
  "valueCode" : "application/pdf"
}]

And the reference is like Binary/my-file, and unlike the normal case, where the file must have a matching name and .json or .xml, then file can have any extension

view this post on Zulip John Moehrke (Dec 09 2021 at 13:49):

do I put the file in the images folder?

view this post on Zulip Grahame Grieve (Dec 09 2021 at 19:18):

if you want, but I'd put it in the same folder as my other resources

view this post on Zulip John Moehrke (Dec 31 2021 at 14:52):

@Grahame Grieve I am still not getting the contentType or filename errors to go away. Not finding any documentation of the implementationguide-resource-format extension, except in the sushi release notes around logical models. Tried what is specified there and it didn't work for me. Im using DocumentReference

view this post on Zulip John Moehrke (Dec 31 2021 at 15:34):

update - I have eliminated the errors by specifying the DocumentReference.content.attachment.contentType.

view this post on Zulip John Moehrke (Dec 31 2021 at 15:36):

I updated the confluence page https://confluence.hl7.org/pages/viewpage.action?pageId=66938614#ImplementationGuideParameters-BinaryAdjunctFiles

view this post on Zulip John Moehrke (Dec 31 2021 at 15:39):

Binary still throws a file type error

Unknown file type foobar.txt

view this post on Zulip Grahame Grieve (Jan 04 2022 at 21:00):

how to reproduce this?

view this post on Zulip John Moehrke (Jan 04 2022 at 22:06):

It does this for me when I have a Binary, vs no error with DocumentReference.

view this post on Zulip John Moehrke (Jan 04 2022 at 22:44):

here is a test IG that will show the error
https://github.com/JohnMoehrke/testBinary

view this post on Zulip Grahame Grieve (Jan 06 2022 at 02:42):

you need to add:

"extension" [{
          "url" : "http://hl7.org/fhir/StructureDefinition/implementationguide-resource-format",
          "valueCode" : "text/plain"
        }],

view this post on Zulip John Moehrke (Jan 06 2022 at 16:11):

so there is bug in sushi that prevents this extension from moving from sushi-config to the IG json SUSHI#1005

BUT... I have tried adding this manually to the sushi output, but always get two IG build errors indicating the extension is unknown. YET, the sample-ig has this same thing in it and it doesn't throw these errors. I have carefully copied the sample-ig. I must have some stupid mistake that my eyes are not finding.
Here is the entry in my manually edited IG json

    "resource": [
      {
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/implementationguide-resource-format",
            "valueCode": "application/xml"
          }
        ],
        "reference": {
          "reference": "Binary/B-hello-world"
        },
        "name": "Binary example using Binary",
        "description": "Example of a binary hello world using Binary.",
        "exampleBoolean": true
      },
 ```
but I get this error

== fsh-generated\resources\ImplementationGuide-johnmoehrke.testbinary.json ==
ERROR: ImplementationGuide/johnmoehrke.testbinary: ImplementationGuide.definition.resource[0].extension[0]: The extension http://hl7.org/fhir/StructureDefinition/implementationguide-resource-format is unknown, and not allowed here
ERROR: ImplementationGuide/johnmoehrke.testbinary: ImplementationGuide.definition.resource[0].extension[0].url: URL value 'http://hl7.org/fhir/StructureDefinition/implementationguide-resource-format' does not resolve



Last updated: Apr 12 2022 at 19:14 UTC