FHIR Tooling Extensions IG
0.3.0 - Release 0.2.0 International flag

This page is part of the HL7 Tools Extension IG (v0.3.0: Releases - Informative) based on FHIR (HL7® FHIR® Standard) v5.0.0. This is the current published version in its permanent home (it will always be available at this URL). For a full list of available versions, see the Directory of published versions

Binary Support

Binary Support

The IG publisher supports providing binaries as raw content instead of as a binary resource.

This means that instead of providing a binary resource like this:

{
  "resourceType" : "Binary",
  "id" : "CDSHookServices",
  "contentType" : "application/json",
  "data" : "ewogICJzZXJ2aWNlcyI6IFsKICAgIHsKICAgICAgImhvb2siOiAicGF0aWVudC12aWV3IiwKICAgICAgInRpdGxlIjogIlN0YXRpYyBDRFMgU2VydmljZSBFeGFtcGxlIiwKICAgICAgImRlc2NyaXB0aW9uIjogIkFuIGV4YW1wbGUgb2YgYSBDRFMgU2VydmljZSB0aGF0IHJldHVybnMgYSBzdGF0aWMgc2V0IG9mIGNhcmRzIiwKICAgICAgImlkIjogInN0YXRpYy1wYXRpZW50LWdyZWV0ZXIiLAogICAgICAicHJlZmV0Y2giOiB7CiAgICAgICAgInBhdGllbnRUb0dyZWV0IjogIlBhdGllbnQve3tjb250ZXh0LnBhdGllbnRJZH19IgogICAgICB9CiAgICB9LAogICAgewogICAgICAiaG9vayI6ICJvcmRlci1zZWxlY3QiLAogICAgICAidGl0bGUiOiAiT3JkZXIgRWNobyBDRFMgU2VydmljZSIsCiAgICAgICJkZXNjcmlwdGlvbiI6ICJBbiBleGFtcGxlIG9mIGEgQ0RTIFNlcnZpY2UgdGhhdCBzaW1wbHkgZWNob2VzIHRoZSBvcmRlcihzKSBiZWluZyBwbGFjZWQiLAogICAgICAiaWQiOiAib3JkZXItZWNobyIsCiAgICAgICJwcmVmZXRjaCI6IHsKICAgICAgICAicGF0aWVudCI6ICJQYXRpZW50L3t7Y29udGV4dC5wYXRpZW50SWR9fSIsCiAgICAgICAgIm1lZGljYXRpb25zIjogIk1lZGljYXRpb25SZXF1ZXN0P3BhdGllbnQ9e3tjb250ZXh0LnBhdGllbnRJZH19IgogICAgICB9CiAgICB9LAogICAgewogICAgICAiaG9vayI6ICJvcmRlci1zaWduIiwKICAgICAgInRpdGxlIjogIlBoYXJtYWNvZ2Vub21pY3MgQ0RTIFNlcnZpY2UiLAogICAgICAiZGVzY3JpcHRpb24iOiAiQW4gZXhhbXBsZSBvZiBhIG1vcmUgYWR2YW5jZWQsIHByZWNpc2lvbiBtZWRpY2luZSBDRFMgU2VydmljZSIsCiAgICAgICJpZCI6ICJwZ3gtb24tb3JkZXItc2lnbiIsCiAgICAgICJ1c2FnZVJlcXVpcmVtZW50cyI6ICJOb3RlOiBmdW5jdGlvbmFsaXR5IG9mIHRoaXMgQ0RTIFNlcnZpY2UgaXMgZGVncmFkZWQgd2l0aG91dCBhY2Nlc3MgdG8gYSBGSElSIFJlc3RmdWwgQVBJIGFzIHBhcnQgb2YgQ0RTIHJlY29tbWVuZGF0aW9uIGdlbmVyYXRpb24uIgogICAgfQogIF0KfQ=="
}  
  

The editor provides a raw json file like this:

{
  "services": [
  ...
  ]
}    
  

Note that the format doesn't have to be JSON - it can be any content at all - images, text, json, xml, cql, etc. Any content that's useful.

How to make this work

Instructions:

  • You can't leave binary resources like this to be picked up automatically - they'll be ignored by the loader when it scans the folders (if autoloading is on)
  • You have to create an entry in the IG resource for the resource:
        <resource>
          <reference>
            <reference value="Binary/Example"/>
          </reference>
          <description value="An example of a binary resource"/>
        </resource>  
         
    (doesn't have to be XML, and the description is optional)
  • The file will be called something like binary-example.xxx where xxx is whatever works for the edit, and the filename follows usual file name conventions for the IG publisher
  • Then add an extension to the resource element in the IG resource that provides the mime type for the binary resource:
        <resource>
          <extension url="http://hl7.org/fhir/tools/StructureDefinition/implementationguide-resource-format">
            <valueCode value="text/plain"/>>
          </extension>
          <reference>
          ...
        </resource>  
         
    or whatever the appropriate media type is.
  • That's it - it should be processed into a binary as loaded, the package will contain a binary, and the IG publisher will do it's best attempt at rendering the content usefully in the HTML pages for the implementation guide

Validation

If you want, you can validate the binary content against a logical model. You add another extension to do that:

    <resource>
      <extension url="http://hl7.org/fhir/tools/StructureDefinition/implementationguide-resource-format">
        <valueCode value="text/plain"/>>
      </extension>
      <extension url="http://hl7.org/fhir/tools/StructureDefinition/implementationguide-resource-logical">
        <valueUrl value="http://hl7.org/fhir/tools/StructureDefinition/CDSHooksServices"/>>
      </extension>
      <reference>
      ...
    </resource>  
     

The content will be validatd against the specificied logical model. You must define the logical model referred to here, or depend on an IG unless it's declared in the tooling IG. The following logical models are defined in the tooling IG: