Stream: implementers
Topic: Example Generation
Ross Shnaper (Dec 19 2016 at 20:37):
Hi, I have a custom Patient profile for which I generated an example, but when building the IG the example is not linked to the profile. This is what I have in my IG file:
<resource>
<purpose value="example"/>
<name value="Patient Example"/>
<description value="Example of patient profile"/>
<sourceReference>
<reference value="Patient/rad-patient-example"/>
</sourceReference>
<exampleFor>
<reference value="StructureDefinition/rad-patient"/>
</exampleFor>
</resource>
The example file is located under 'examples' folder and has the name of 'rad-patient-example.xml', with the id of the resource being 'rad-patient-example'. Anything I'm doing wrong?
Grahame Grieve (Dec 19 2016 at 21:01):
what does 'not linked to the profile' mean?
Ross Shnaper (Dec 19 2016 at 22:19):
@Grahame Grieve what I meant is that the 'Examples' tab doesn't show the example that I have included in main IG file. Although I see the file 'rad-patient-example.html' being generated with the appropriate XML content.
Lloyd McKenzie (Dec 19 2016 at 22:32):
You need to set up your template to do this. Here's the one I use for SDC:
Lloyd McKenzie (Dec 19 2016 at 22:33):
template-profile-examples.html
Ross Shnaper (Dec 20 2016 at 22:14):
@Lloyd McKenzie I have a template similar to the one you've provided, and I've used both mine and yours but examples don't show up. The issue seems to be in the {{site.data.pages[page.path]}} as it returns an empty string. Thus when the template checks for {% if site.data.pages[page.path].examples.size > 0 %} nothing is returned. Any thoughts on what might be going on?
Lloyd McKenzie (Dec 20 2016 at 22:29):
Do you have a page defined in your ig with the same name as the resource?
Ross Shnaper (Dec 21 2016 at 20:23):
Hi @Lloyd McKenzie , yes I do as per example above in my first post.
Eric Haas (Dec 22 2016 at 01:20):
does your ig.json definitions file have
"resources": [
"resources", "examples"
],
otherwise it won't know where find it.
Ross Shnaper (Jan 25 2017 at 18:11):
Thanks @Eric Haas, I've tried modifying the 'resources' section but still don't see my examples getting linked in the final IG site. Is there a working example that I can run to see how it should be done properly? I'm clearly missing something/doing something wrong...
Eric Haas (Jan 25 2017 at 18:27):
Mmmm... I don't use the examples tab in the spreadsheet for igs. I create my examples load to the examples directory and manually link them using a markdown file that I insert into the profile template. There is a fragment that lists all the files: temp/_includes/list-{type].xhtml. Does that contain your examples? you could update the templates to include it using {%include list-{{[type]}}.xhtml %} liquid tag.
Eric Haas (Jan 25 2017 at 18:37):
And check both the ig.xml and ig.json file to make sure the examples are listed. for example for my example Procedure-rehab.xml
In the ig.xml file there is:
<resource> <purpose value="example"/> <sourceReference> <reference value="Procedure/rehab"/> </sourceReference> </resource>
and for ig.json, I explicity created anddefined the template base as ex.html so added this
}, "Procedure": { "template-base": "ex.html" },
and this so Jekyll knows what it is called.
}, "Procedure/rehab": { "base": "Procedure-rehab.html" },
Eric Haas (Jan 25 2017 at 18:39):
I actually created a python script to generate these files automatically. Which is helpful if you have lots of examples
Lloyd McKenzie (Jan 26 2017 at 01:32):
If you want examples to show up, take a look at what the SDC IG does. Example linkage is based on the IG. Examples listed in a profile spreadsheet are ignored, to the best of my knowledge.
Last updated: Apr 12 2022 at 19:14 UTC