Stream: IG creation
Topic: Place a structure definition in a page
Brian Reinhold (Sep 10 2018 at 18:55):
What is the magic syntax to place a structure definition in the resources folder in a page file (using markdown)?
Would the syntax used by Simplifier {{tree:phd/CompoundNumericObservation}}
Probably not. There is probably a different syntax for Jekyll. Any docs on that?
I'm trying to validate a structure definition by making a minimal IG with one page containing one resource - (a structure definition) and that will be the structure definition I want to check.
Grahame Grieve (Sep 10 2018 at 18:58):
{% include StructureDefinition-{id}-{??}.xhtml%} where ?? is the kind of view you want.
Eric Haas (Sep 10 2018 at 20:10):
use liquid syntax for Jekyll and kramdown markdown flavor which as all kinds of extra goodies.
Brian Reinhold (Sep 10 2018 at 20:13):
use liquid syntax for Jekyll and kramdown markdown flavor which as all kinds of extra goodies.
That must be pretty generic. I am still searching the wiki and other IG guides to figure out what the ?? possibilities are (kind of view).
So far I got
{% include StructureDefinition-{PhdDevice}-{??}.xhtml%}
where PhdDevice is the <id> I give it in the structure definition. Forge had no such <id> in their definitions.
I don't have xhtml files either; they are xml.
Brian Reinhold (Sep 10 2018 at 21:45):
{% include StructureDefinition-{id}-{??}.xhtml%} where ?? is the kind of view you want.
What are the possible values for ?? (the kind of views ... I cannot find a source of options)
Eric Haas (Sep 10 2018 at 21:49):
Look here at my template for bit more explanation: https://github.com/Healthedata1/IG-Template2
Eric Haas (Sep 10 2018 at 21:53):
the ig-pub generates the artifacts as xhtml and the pages are created using both the layouts in the _layout folder and template files such as sd.html etc which live in root in my setup. thetemplate is inserted at {{content}} tag in the layout file (framework/_layout/ fhir-artifact.html ).
Brian Reinhold (Sep 10 2018 at 21:59):
the ig-pub generates the artifacts as xhtml and the pages are created using both the layouts in the _layout folder and template files such as sd.html etc which live in root in my setup. thetemplate is inserted at {{content}} tag in the layout file (framework/_layout/ fhir-artifact.html ).
Maybe I am trying to do something that can't be done. In Simplifier I could embed the structure definition right into a markdown page anywhere I wanted. In the IG publisher examples all I see is a table with a list of profiles that are not displayed in the page. I can click them and then see them but they are not present in the page themselves.
Grahame Grieve (Sep 10 2018 at 22:12):
you need to read the documentation here:http://wiki.hl7.org/index.php?title=IG_Publisher_Documentation#Fragment_Codes - this tells you what codes for the views that are available
Brian Reinhold (Sep 11 2018 at 08:57):
you need to read the documentation here:http://wiki.hl7.org/index.php?title=IG_Publisher_Documentation#Fragment_Codes - this tells you what codes for the views that are available
When I put in an xml-html such that I have {% include StructureDefinition-{PhdDevice}-{xml-html}.xhtml%} which I hope means I want to view my xml file as html at this point....BUT,
the output says the 'liquid' (what a stupid name) syntax is in error, it should be like this: {% include file.ext param='value' param2='value' %}
Then it looks like if I do that {% include PhdDeviceStructureDefinition.xml %} it can't find the file because it apparently does not look for my source but something it has already created and placed in the 'temp' directory. Arrg.
So I go with this {% include PhdDeviceStructureDefinition.xhml %} which exists in the temp directory after some processing BUT then I get it wants the file in an '_include' directory within the temp directory!!! That I can't do anything about.
I look on line and so far have not found any uses of 'include' that are inserting anything for example here https://help.shopify.com/en/themes/liquid/tags/
So if I want to view, as html, in a markdown page, my PhdDeviceStructureDefinition.xml file with id PhdDevice located in 'resources' what should this line
{% include StructureDefinition-{id}-{??}.xhtml%} inserted in the markdown file
look like?
Grahame Grieve (Sep 11 2018 at 09:25):
I don't understand what the context of your questions is. I think you should start with a working IG and strip it down so that it works for you
Grahame Grieve (Sep 11 2018 at 09:26):
a relative simple one is https://build.fhir.org/ig/HL7/deqm/
Brian Reinhold (Sep 11 2018 at 09:27):
I don't understand what the context of your questions is. I think you should start with a working IG and strip it down so that it works for you
That's what I am doing. But the working IG does not embed a structure definition within text (like one can do in Simplifier). Instead it has links to the structure definitions which you click on and then you get a separate page with the differential and snapshot views
Grahame Grieve (Sep 11 2018 at 09:27):
but those pages are built they way you are thinking
Grahame Grieve (Sep 11 2018 at 09:28):
alternatively you could try the crude but very simple IG in the master repository itself - in \build\test\ig
Brian Reinhold (Sep 11 2018 at 09:37):
alternatively you could try the crude but very simple IG in the master repository itself - in \build\test\ig
That sounds like a good idea ... there seems to be quite a selection. I see
ig, ig10, ig14, ig30, and ig40. The 'ig' is the complete one?
Grahame Grieve (Sep 11 2018 at 09:44):
ig40
Grahame Grieve (Sep 11 2018 at 09:45):
well, it depends which version you are targeting - these are all basically the same but differ by version
Brian Reinhold (Sep 11 2018 at 09:58):
ig40
R4 (3.6.0 at the current moment). The version where the Device and DeviceComponent have been merged and the DeviceComponent no longer exists
the 'ig' seems the simplest. They are all more complex than my minimal guide which (if it worked) would only have a home page with a structure definition in it. I got the home page.
Also, is it necessary to name my resources with these dashes like 'StructureDefinition-PhdDevice.xml'? It seems like a lot examples I see all do this. Coming down from Forge and Simplifier I have all markdown pages and structure definition resources with names like PhdDeviceStructureDefinition.xml. These structure definitions are all embedded within the markdown files with annotations that look like this
{{tree:phd/CompoundNumericObservation}}
where the structure definition is CompoundNumericObservation.xml
Grahame Grieve (Sep 11 2018 at 10:04):
the IG publisher has to find the resource. The easiest way to find the ig is to use * for the resource path and name it whatever you want
Brian Reinhold (Sep 11 2018 at 10:27):
the IG publisher has to find the resource. The easiest way to find the ig is to use * for the resource path and name it whatever you want
I am trying to follow how the process goes from the structure definition in the resources directory ... for example the file 'test-ig-sd.out.xml to a line like this
{% include StructureDefinition-test-organization-diff.xhtml %}
in the profile-sd-o.html in the pages directory
That line produces the differential (or snapshot should I replace 'diff' with 'snapshot') but I have no idea how the syntax of the line relates to the source files in the resources directory. But I see only two structure definitions in the resources directory (besides the implementation guide). How do the source xml files relate to that 'liquid' line above? I could not find a structure definition with an id 'test-organization'. Both SDs are Patients and I cannot find the word 'organization' anywhere in the source files in 'resource'. Isn't <test-organization> supposed to be an SD id?
SUCCESS! I used the line {% include StructureDefinition-PhdDevice-diff.xhtml %} and it worked. I now have a minimal IG which makes your test IG look like New York City next to my Maria, Australia IG.
I still don't understand the connection between that line and the sources in the test ig though.
Grahame Grieve (Sep 11 2018 at 11:05):
I don't know. Lloyd got his hands on that and did the Lloyd thing and now it's really complicated
Grahame Grieve (Sep 11 2018 at 11:12):
the "ig" one is my favourite - now that I can look
Brian Reinhold (Sep 11 2018 at 11:19):
I don't know. Lloyd got his hands on that and did the Lloyd thing and now it's really complicated
Well this is pretty simple with small ig.json and ImplementationGuide.xml structure definition files. For thick skulls like mine with limited capacity it's a good starting point.
Now I can easily view my structure definitions and see if they have what I want in the diff and snapshot views.
Now I got to see why some of my difference fields are not showing up in the 'diff' (or snapshot). I've got some learning to do there as well!
Eric Haas (Sep 11 2018 at 16:48):
I am trying to follow how the process goes from the structure definition in the resources directory ... for example the file 'test-ig-sd.out.xml to a line like this
{% include StructureDefinition-test-organization-diff.xhtml %}
in the profile-sd-o.html in the pages directory
right now the config.json file defines: ( in the near future will be moved to the IG resource file ( ig.xml)
- source file ( file url)
- base file - the html page [type]+[id].html
- may define the definition page and mapping page too.
This is all based on the resource id
also defines where every lives (pages, resources, examples , etc)
right now ig.xml use is a bit murky, its necessary for some things, just assume you need it for all resources ( you don't but ignore that ), fill in all the metadata and populate it with the resources, only need to stub in the home page .
This is all based on the resource id.
With this set up correctly you will have a bunch of prepackaged paramaters:
Jekyll Site Variables These are the site variables defined here: IG Business version specification (defined in ig.json)- {{site.data.fhir.ig.version}} = 0.0.0 IG status (defined in ig.xml)- {{site.data.fhir.ig.status}} = draft Whether is experimental IG (defined in ig.xml) - {{site.data.fhir.ig.experimental}} = false IG Publisher name (defined in ig.xml) - {{site.data.fhir.ig.publisher}} = Health eData Inc dependency url - e.g. “uscore” : Base url of a dependency implementation Guide (defined in ig.json) - {{site.data.fhir.uscore}} = http://hl7.org/fhir/us/core igName : Title of the implementation Guide (defined in ig.xml) - {{site.data.fhir.igName}} = IG_Test3 path : path to the main FHIR specification (defined in ig.json)- {{site.data.fhir.path}} = http://build.fhir.org/ canonical : canonical path to this specification (defined in ig.json)- {{site.data.fhir.canonical}} = http://www.fhir.org/guides/test3 errorCount : number of errors in the build file (not including HTML validation errors) - {{site.data.fhir.errorCount}} = 18 version : version of FHIR - {{site.data.fhir.version}} = 3.6.0 revision : revision of FHIR - {{site.data.fhir.revision}} = 8660b499 versionFull : version-revision - {{site.data.fhir.versionFull}} = 3.6.0-8660b499 totalFiles : total number of files found by the build - {{site.data.fhir.totalFiles}} = 9 processedFiles : number of files genrated by the build - {{site.data.fhir.processedFiles}} = 146 genDate : date of generation (so date stamps in the pages can match those in the conformance resources) - {{site.data.fhir.genDate}} = Tue, Sep 11, 2018 09:22-0700
since the ig-pub generates all the resource fragments - the liquid tagging in the templates is good to go..
{{type}} and {{id}} are the variables used to capture the fragments like {% include {{[type]}}-{{[id]}}-pseudo-json.xhtml %}
will inject the psuedo json from for a profile into the page
Brian Reinhold (Sep 11 2018 at 18:22):
@Eric Haas I am a little confused about the mentioning of ig.xml and ig.json. This morning I was able to create a minimal IG with only a page and a structure definition. I needed an ig.json file and an ImplementationGuide.xml structure definition. I added the page and a Device structure definition. The ig and ImplementationGuide.xml were both small because they referenced only a single page and resource.
In my page file I used {% StructureDefinition-PhdDevce-diff-xhtml %}. This gave me a nice view of the diff.
Is ig.xml you are talking about the same as my ImplementationGuide.xml structure definition?
Eric Haas (Sep 11 2018 at 20:41):
ig.xml == ImplementationGuide resource instance not a StructureDefinition
Eric Haas (Sep 11 2018 at 20:42):
configuration file == ig.json
Eric Haas (Sep 11 2018 at 20:43):
Can see them in action here: https://github.com/Healthedata1/IG-Template2
Last updated: Apr 12 2022 at 19:14 UTC