Stream: IG creation
Topic: complex types
Jens Villadsen (Feb 09 2019 at 13:18):
Is there a fragment showing how to include complex-type strucdefs in an IG? I can see that the html sites are generated and the linking from the resource html sites works as intended. I would eg. like a tab in the nav-bar that listed the complex-type profiles but I'm having a hard time finding examples
Eric Haas (Feb 09 2019 at 13:26):
What do you mean by complex type. ? Extensions?? You can customize the Navbar to point to anything.
Jens Villadsen (Feb 09 2019 at 13:27):
Yes I know - I'm looking for an example for a tab that only lists complex-type structure defs
Jens Villadsen (Feb 09 2019 at 13:31):
eg:
<StructureDefinition xmlns="http://hl7.org/fhir"> <url value="http://trifork.dk/fhir/StructureDefinition/dk-tm-ssn-identifier"/> <name value="Danish SSN Identifier"/> <status value="draft"/> <description value="This structure holds the danish CPR identifier"/> <fhirVersion value="3.0.1"/> <kind value="complex-type"/> <abstract value="false"/> <type value="Identifier"/> <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Identifier"/> <derivation value="constraint"/> <differential> <element id="Identifier.use"> <path value="Identifier.use"/> <fixedCode value="official"/> </element> <element id="Identifier.system"> <path value="Identifier.system"/> <min value="1"/> <fixedUri value="urn:oid:1.2.208.176.1.2"/> </element> <element id="Identifier.value"> <path value="Identifier.value"/> <min value="1"/> <constraint> <key value="ssn"/> <requirements value="Requirement of danish social security numbers"/> <severity value="error"/> <human value="Requirement of danish social security numbers"/> <expression value="value.matches('^[0-9]{10}$')"/> </constraint> <mustSupport value="false"/> </element> </differential> </StructureDefinition>
Jens Villadsen (Feb 09 2019 at 13:37):
kind = complex-type
Lloyd McKenzie (Feb 09 2019 at 17:58):
A data type profile is treated no differently than any other other sort of profile. If you want a menu link that takes to a page of complex type profiles, you'll have to define a page that includes those links and put a link to that page in the menu.
Jens Villadsen (Feb 09 2019 at 19:56):
I guess I'll have to look more into http://wiki.hl7.org/index.php?title=IG_Publisher_Documentation#Fragment_.26_Template_Options ...
Jens Villadsen (Feb 09 2019 at 19:58):
@Lloyd McKenzie - I would have expected that complex types would have been part of 'list-extensions' - is that intentional that that is not the case?
Jens Villadsen (Feb 09 2019 at 20:02):
or 'list-profiles'
Lloyd McKenzie (Feb 09 2019 at 20:15):
I don't use the list pages, so I'm not sure. list-profiles would be more appropriate than list-extensions unless the complex type was an extension. I'm pretty sure we don't have a separate list for data type profiles
Jens Villadsen (Feb 10 2019 at 12:38):
@Lloyd McKenzie it looks like im ending up with a feature request. Since list-structuredefinitions shows both profiles, data types, and extensions - and list-profiles only shows profiles for resources and list-extensions only shows extensions, I seem to be missing the last bit - the list that only shows data type profiles - or am I missing something here?
Eric Haas (Feb 10 2019 at 16:01):
the only prepackaged lists are :
table-profiles.xhtml & list-profiles.xhtml table-extensions.xhtml & list-extensions.xhtml table-logicals.xhtml & list-logicals.xhtml
Lloyd McKenzie (Feb 10 2019 at 16:36):
Sounds like a change request is appropriate. Data type profiles should be showing up in the profiles list.
Eric Haas (Feb 10 2019 at 16:36):
to create a list of data types you can cycle through profiles and create your own list in liquid syntax using the data.structuredefinitions something like this...
{% for sd in site.data.structuredefinitions %} {% if sd.contextType == 'datatype' %} - {{sd.path}}/{{sd.type}}-{{sd.name}}.html {% endif %} {% endfor %}
See the ig pub docs here: http://wiki.hl7.org/index.php?title=IG_Publisher_Documentation#Jekyll
All this information about the profile is in the temp/data/stucturedefinitions.json file. This combined with the ig.json file allow you to pretty much access anything using Liquid. you can also get all the pages using site.html_pages and sort through those too.
Eric Haas (Feb 10 2019 at 16:37):
the list files are a convenience
Eric Haas (Feb 10 2019 at 16:39):
(deleted)
Eric Haas (Feb 10 2019 at 16:48):
For me is often easier to just manually create the list if there are only a few of them.
Jens Villadsen (Feb 10 2019 at 19:35):
@Eric Haas I'll just have to familiarize myself with liquid it seems ;)
Jens Villadsen (Feb 10 2019 at 19:35):
I would imagine data type profiles as a pretty basic need in any IG - or am I wrong?
Lloyd McKenzie (Feb 10 2019 at 19:56):
Yes. It's just that the lists aren't commonly used in most IG publications, so no one's noticed before.
Jens Villadsen (Feb 10 2019 at 20:09):
the list of all included profiles in the IG is not a common case?
Lloyd McKenzie (Feb 10 2019 at 21:15):
Technically, extensions are profiles too. So the question is "do IGs typically want a pre-defined list of particular artifacts?" and the answer is that most IGs organize the content into logical groupings that make sense in their own IG. Sometimes I list data types and profiles together, sometimes separate, sometimes datatypes themselves get split into separate sections. Sometimes there are no profiles at all. As a result, I don't think either my framework or Eric's framework (which drive most of the HL7-published IGs) make use of the 'list' files.
Jens Villadsen (Feb 10 2019 at 21:35):
noted ... I tried @Eric Haas snippet and modified it. Regardless of my modifications or not, I cannot seem to access the attributes under the structuredef. I only seem to be able to get the sd as a json string and not being able to dot into the attributes? The Liquid syntax seems to be pretty clear on this. Is there something that I'm not getting?
Jens Villadsen (Feb 10 2019 at 21:36):
@Lloyd McKenzie For what its worth, the IG im working on is not under HL7 (nor local affiliate) .... yet
Giorgio Cangioli (Feb 11 2019 at 09:54):
I think that having a prepackaged list for datatypes would be helpful .. for the IPS IG we made the datatype list by hand adding the links ..
Eric Haas (Feb 11 2019 at 17:07):
I actually have use the list files in my default pages template like this"
--- title: Profiles defined as part of this Guide layout: default active: profiles --- ### Profiles The following Profiles have been defined for this implementation guide. {% include list-profiles.xhtml %} <br /> ### Extensions These extensions have been defined for this implementation guide. {% include list-extensions.xhtml %} {% include link-list.md %} <br />
Eric Haas (Feb 11 2019 at 17:08):
so a 'list-datatypes.xhtml' could be useful too. but in the meantime you can create these using liquid... I'll post a working example shortly
Eric Haas (Feb 11 2019 at 17:10):
because right now the datatypes get lumped in with list-profiles.xhtml
Eric Haas (Feb 11 2019 at 17:24):
Looking into this more deeply this example in the CI build is wrong
Base Extension (a standard data type) (example: Extension - XML, JSON):
{ "resourceType": "StructureDefinition", "url": "http://hl7.org/fhir/StructureDefinition/Extension", "name": "Extension", "kind": "datatype", "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Element" }
There is no code 'datatype' for the element kind
GF pending
Eric Haas (Feb 11 2019 at 17:27):
I am assuming what @Jens Villadsen is looking for is a list of constrained datatypes...
e.g. these critters
A constrained data type (example: Money - XML, JSON):
{ "resourceType": "StructureDefinition", "url": "http://hl7.org/fhir/StructureDefinition/Money", "name": "Money", "kind": "complex-type", "type": "Quantity", "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Quantity" }
Jens Villadsen (Feb 11 2019 at 18:01):
Whats the GF #ID
Eric Haas (Feb 11 2019 at 18:31):
OK I created a constrained Reference profile in FHIR R4 and here is the generated structuredefinitions.json file from which you can create a list....
}, "ifr": { "index": 5, "url": "http://www.fhir.org/guides/test3/StructureDefinition/ifr", "name": "Identifer Free Reference Data Type", "path": "StructureDefinition-ifr.html", "kind": "complex-type", "type": "Reference", "base": "http://hl7.org/fhir/StructureDefinition/Reference", "basename": "Reference", "basepath": "http://build.fhir.org/datatypes.html#Reference", "status": "draft", "date": "Fri Jun 02 00:00:00 PDT 2017" }
so to create a list in markdown would be;
{% for sd_hash in site.data.structuredefinitions -%} {%- assign sd = sd_hash[1] -%} {%- if sd.kind == "complex-type" and sd.type != "Extension" -%} - [{{sd.name}}]({{sd.path}}) {%- endif -%} {%- endfor -%}
here is an example...
https://github.com/Healthedata1/IG-Template2/blob/master/source/pages/profiles.md
which produces this output:
https://healthedata1.github.io/IG-Template2/profiles.html
Eric Haas (Feb 11 2019 at 18:36):
Jens Villadsen (Feb 12 2019 at 12:17):
Whats the -%
in your liquid?
Jens Villadsen (Feb 12 2019 at 13:10):
@Eric Haas - if you have multiple data type profiles, the output does not look all that nice. It seems that the generated out adds indents for each entry
Eric Haas (Feb 12 2019 at 15:57):
You can control that using the white space controls in liquid using the "-" in the {%- or -%} I went a little overboard in using them in my example.
https://shopify.github.io/liquid/basics/whitespace/
Eric Haas (Feb 12 2019 at 16:00):
it lets you indent your control structures all nice and pretty like
Jens Villadsen (Feb 13 2019 at 08:53):
thx - regardless - I didn't find a way to control the indentation/margin of the generated bullets when having multiple elements. I ended up doing
{% for sd_hash in site.data.structuredefinitions -%} {%- assign sd = sd_hash[1] -%} {%- if sd.kind == "complex-type" and sd.type != "Extension" -%} <li> <a href="{{sd.path}}">{{sd.name}}</a>{{sd.title}} </li> {%- endif -%} {%- endfor -%}
As the way of controlling the same bullet margin for all elements
Last updated: Apr 12 2022 at 19:14 UTC