Stream: IG creation
Topic: Logical Model Examples
Grahame Grieve (Aug 30 2021 at 07:20):
I have a feature request from the CDA publishing team that has bubbled to the top of my list.
The request is to able to publish examples for logical models. Internally, these will be Binary resources, but they'll be published as examples rather than plain binary resources.
From an editors point of view, it will work like this:
- Include the file as a binary resource, like any other resource
- the resource format will be anything at all; it will be converted to a binary resource as is is loaded
- if the binary is labelled as an example of a logical model, it will be parsed and validated against the logical model like other kinds of resources are, and treated as an example for the logical model
Comments welcome on this basic approach
Grahame Grieve (Aug 30 2021 at 07:21):
(this does imply that the logical model is marked up with the details it needs to parse the example correctly. CDA logical models are
Oliver Egger (Aug 30 2021 at 07:34):
i like the approach! The editors need to convert the CDA (or other logical model) to base64 for embedding it in the Binary, correct? Or would it be a possibility that the tooling (IGPublisher) also creates the base64 in the Binary maybe via a tooling extension?
Grahame Grieve (Aug 30 2021 at 07:42):
no need for base64; the IG publisher would publish that, of course, but you'd just have and see native XML for the CDA content
Jose Costa Teixeira (Aug 30 2021 at 09:44):
I welcome this. The elements in the LM: can we specify data types and will those be validated?
Jose Costa Teixeira (Aug 30 2021 at 09:45):
e.g. if my LM says "this is a date" and the example contains a string "30 Augustus 2021", will this be validated?
Grahame Grieve (Aug 30 2021 at 10:36):
no. only two date formats are supported right now - xml and the HL7 yyyymmddhhmmss.sssZ
Grahame Grieve (Aug 30 2021 at 10:36):
though you can propose others - there's an extension to say what it is if it's something else
Jose Costa Teixeira (Aug 30 2021 at 10:45):
I didn't want to propose a new date type. I wanted to ask whether the LM instance will be validated against whatever data types we use (so the date I mention should fail because it is not a valid FHIR date)
Jose Costa Teixeira (Aug 30 2021 at 10:46):
I should have asked "will this be validated and therefore fail?"
Grahame Grieve (Aug 30 2021 at 11:18):
yes it will be validated against the logical model
Jose Costa Teixeira (Aug 30 2021 at 11:51):
Thanks. Looking forward to this enhancement
Chris Moesel (Aug 30 2021 at 12:31):
Is the whole "wrap it in a binary resource thing" needed because the IG Publisher only processes valid FHIR resources? Is that the thing we're working around here?
Grahame Grieve (Aug 30 2021 at 12:32):
yes
Grahame Grieve (Aug 30 2021 at 12:33):
internally, they will be Binary resources. They'll just look like something else as well when they get published
Chris Moesel (Aug 30 2021 at 12:35):
OK, and one more question. When you say "this does imply that the logical model is marked up with the details it needs to parse the example", is that referring to specifying ElementDefinition.representation
? Is there anything else that's needed? (I'm asking in order to understand how SUSHI might best support this).
Grahame Grieve (Aug 30 2021 at 12:56):
Yes, and these extensions:
- http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace
- http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-no-order
- http://hl7.org/fhir/StructureDefinition/elementdefinition-xml-name
Though I expect that to be a growing set over time. basically: a set of metadata that explains how a logical model is related to a particular wire format representation. In json, it might be around how the wire format gets started, for instance
Lloyd McKenzie (Aug 30 2021 at 16:01):
It needs to be visually clear that these are not FHIR examples and can't appear in FHIR interfaces.
Grahame Grieve (Aug 31 2021 at 21:09):
I think that's the business of the template and/or IG author, given the range of things that a binary can be used for.
Grahame Grieve (Aug 31 2021 at 21:10):
Anyway, the release due out in the next few hours will include the first part of this change: you can now provide Binary resources as Binary. Here's an example in the IG:
Grahame Grieve (Aug 31 2021 at 21:12):
<resource>
<extension url="http://hl7.org/fhir/StructureDefinition/implementationguide-resource-format">
<valueCode value="image/jpeg"/>
</extension>
<reference>
<reference value="Binary/image-example"/>
</reference>
<name value="Example of Binary Image"/>
<description value="Example showing example content for an image"/>
</resource>
Grahame Grieve (Aug 31 2021 at 21:12):
then you provide the binary as a file:
Grahame Grieve (Aug 31 2021 at 21:12):
Grahame Grieve (Aug 31 2021 at 21:13):
Then, when it generates:
Grahame Grieve (Aug 31 2021 at 21:13):
Grahame Grieve (Aug 31 2021 at 21:13):
The Binary resource was built on the fly from the image. And the narrative rendering:
Grahame Grieve (Aug 31 2021 at 21:14):
Grahame Grieve (Aug 31 2021 at 21:15):
this also works for xml or json Binary files:
Grahame Grieve (Aug 31 2021 at 21:16):
Grahame Grieve (Sep 01 2021 at 11:44):
@Sean McIlvenna this is for you - you should be good to go now
Sean McIlvenna (Sep 01 2021 at 15:24):
This is great, @Grahame Grieve ! Thanks!
- Is implementationguide-resource-format extension required? What's the difference between this and Binary.contentType? How are the two used differently?
- I'm surprised the ImplementationGuide.resource doesn't specify
exampleBoolean=true
at the least? How does it now that this IG resource is an example? - Is it required to put these Binary XML files in the
input/examples
folder?
Grahame Grieve (Sep 01 2021 at 19:28):
-
you need the extension because the Binary is constructed on the fly, and the value of the extension becomes the value of Binary.contentType
-
you need to specify exampleCanonical = {logical} to link the example to the logical. There's an example here: https://github.com/FHIR/sample-ig/blob/master/input/myig.xml
<resource>
<extension url="http://hl7.org/fhir/StructureDefinition/implementationguide-resource-format">
<valueCode value="application/xml"/>
</extension>
<reference>
<reference value="Binary/logical-example"/>
</reference>
<name value="Example of Logical Model"/>
<description value="Example showing example content for a logical model"/>
<exampleCanonical value="http://somewhere.org/fhir/uv/myig/StructureDefinition/MyLogical"/>
</resource>
which leads to this: https://build.fhir.org/ig/FHIR/sample-ig/Binary-logical-example.html
- no, you can put the files whereever they could be loaded from otherwise
Frank Oemig (Sep 02 2021 at 10:40):
:+1:
Chris Moesel (Oct 01 2021 at 15:24):
@Grahame Grieve -- just to confirm, should this work w/ examples that are in JSON format as well? The discussion above mostly concerns XML formatted examples. SUSHI produces JSON, so I want to be sure it will work before we go too far down this road.
Grahame Grieve (Oct 01 2021 at 19:37):
certainly should. I'll never do anything that's format specific
Chris Moesel (Oct 01 2021 at 20:14):
OK. So you're pretty much just rendering whatever is in the attachment, using the resource format value to determine its mime-type. I get it now. Thanks.
Jose Costa Teixeira (Oct 01 2021 at 20:24):
@Chris Moesel those custom json / xml structures would need to be excluded from sushi's mix-ins, right?
Chris Moesel (Oct 02 2021 at 13:58):
By mix-ins
, do you mean SUSHI's attempt to load all the non-FSH definitions in other input
folders? Assuming that's what you mean, then, yes, I guess SUSHI would need to skip those (at least for now). I'm not sure what it does now, as I can't recall if it just ignores non-FHIR files it finds there or if it will emit an error because it doesn't recognize it as a valid FHIR resource.
Jose Costa Teixeira (Oct 02 2021 at 15:13):
Right, just wanted to mention that. I hope sushi ignores those non-FHIR files
Frank Oemig (Dec 16 2021 at 21:33):
How to get the reference entries into the sushi generated IG?
Chris Moesel (Dec 16 2021 at 21:42):
@Frank Oemig - I'm not sure if I fully understand your question, but we documented how to put logical models into a SUSHI IG in the release notes for SUSHI 2.2.0: https://github.com/FHIR/sushi/releases/tag/v2.2.0. See the section titled Allow Authors to Provide Instances of Logical Models.
Frank Oemig (Dec 16 2021 at 21:55):
Thx, Chris, will check that.
Frank Oemig (Jan 13 2022 at 15:23):
That works, thx :blush:
But is there any means to specify how an instance should be rendered? I am thinking on defining a template (in Jekyll?) For a LM to specify which attributes should be taken and arranged, eg. in a table or so...
Jose Costa Teixeira (Jan 13 2022 at 18:37):
Yes, @Frank Oemig I'd like to work on that , as soon as the feature is enabled
Frank Oemig (Jan 15 2022 at 09:45):
Great, where to look at?
Last updated: Apr 12 2022 at 19:14 UTC