Updated to new fragment approach

This commit is contained in:
Lloyd McKenzie
2024-09-04 21:08:35 -06:00
parent 6fdca86d33
commit d1da054253
20 changed files with 19650 additions and 15269 deletions

View File

@@ -19,6 +19,9 @@
<li>
<a href="spec.html">Detailed Specification</a>
</li>
<li>
<a href="fragments.html">Instance Fragments</a>
</li>
</ul>
</li>
<li><a href="artifacts.html">Artifact Index</a></li>

View File

@@ -83,33 +83,6 @@
</reference>
</resource> -->
<resource>
<extension url="http://hl7.org/fhir/tools/StructureDefinition/implementationguide-resource-fragment">
<extension url="id">
<valueId value="demo1"/>
</extension>
<extension url="base">
<valueString value="name.where(use='usual')"/>
</extension>
<extension url="ellipse">
<valueString value="use"/>
</extension>
</extension>
<extension url="http://hl7.org/fhir/tools/StructureDefinition/implementationguide-resource-fragment">
<extension url="id">
<valueId value="demo2"/>
</extension>
<extension url="ellipse">
<valueString value="meta"/>
</extension>
<extension url="ellipseExcept">
<extension url="base">
<valueString value="name.where(use='official')"/>
</extension>
<extension url="except">
<valueString value="family | given.first()"/>
</extension>
</extension>
</extension>
<reference>
<reference value="Patient/example"/>
</reference>
@@ -191,6 +164,11 @@
<nameUrl value="spec.html"/>
<title value="Detailed Specification"/>
<generation value="markdown"/>
<page>
<nameUrl value="fragments.html"/>
<title value="Fragments"/>
<generation value="html"/>
</page>
<page>
<nameUrl value="spec2.html"/>
<title value="Spec sub-page"/>

View File

@@ -0,0 +1,47 @@
<div xmlns="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hl7.org/fhir ../../input-cache/schemas/R5/fhir-single.xsd">
<p>
This page describes how to embed 'fragments' of a resource within a page, possibly ellipsing out portions
of the instance to only show the portions that are relevant to what the surrounding text needs to talk about.
</p>
<p>
To embed content from an instance, use the following structure:<br/>
<code>{% raw %}&#x7b;%&#xA0;fragment <i>ResourceType</i>/<i>id</i> <i>syntax</i> %}{% endraw %}</code><br/>
where:
</p>
<ul>
<li><code>ResourceType</code> is 'Patient', 'Observation', etc. For a logical model instance, this will be 'Binary'.</li>
<li><code>id</code> is the unique resource id of the resource within the IG.</li>
<li><code>syntax</code> is either 'XML' or 'JSON'. (TTL is not yet supported.)</li>
</ul>
<p>For example, <code>{% raw %}&#x7b;%&#xA0;fragment Patient/example XML %}{% endraw %}</code> in this IG evaluates to</p>
{% fragment Patient/example XML %}
<a name="filtering"> </a>
<h3>Filtering</h3>
<p>
However, often examples can be somewhat sizeable and you don't necessarily want to include the entire example in the flow of your narrative - you only need a portion. To filter to a limited portion of the specified resource, you need to declare a 'base' element within that resource that will be included as your fragment. The 'base' is expressed as a FHIRPath expression evaluated against the root of the resource.
</p>
<p>
For example, <code>{% raw %}&#x7b;%&#xA0;fragment Patient/example JSON BASE:name.where(use='usual') %}{% endraw %}</code> will result in the following:
</p>
{% fragment Patient/example JSON BASE:name.where(use='official').first() %}
<a name="ellipsing"> </a>
<h3>Ellipsing</h3>
<p>
Sometimes you want to perform more filtering than only selecting an element within your instance. You want to only show a portion of that element, hiding (ellipsing) the content you don't care about. There are two ways to do this: you can either define the specific elements you want to ellipse; or you can define the elements you <i>don't</i> want to ellipse.
</p>
<p>The 'ELLIPSE:' filter can only be specified once, but with FHIRPath '|', you can express as many elements as you like. For example, <code>{% raw %}&#x7b;%&#xA0;fragment Patient/example XML BASE:name.where(use='official').first() ELLIPSE:use|given[1]|period %}{% endraw %}</code> will look like this:</p>
{% fragment Patient/example XML BASE:name.where(use='official').first() ELLIPSE:use|given[1]|period %}
<p>
'EXCEPT:' works slightly differently. With Except you identify the elements to retain (be unellipsed) but you can also specify a descendant 'BASE:' element those expressions are evaluated within. For example, the following expression will return the patient showing only id an names, and within name, will ellipse everything except the family name: <code>{% raw %}&#x7b;%&#xA0;fragment Patient/example XML EXCEPT:id|name EXCEPT:family BASE:name %}{% endraw %}</code>
</p>
{% fragment Patient/example XML EXCEPT:id|name EXCEPT:family BASE:name %}
<p>
The overall syntax for fragments is as follows:
<code>{% raw %}&#x7b;%&#xA0;fragment [resource]/[id] [XML|JSON] (BASE:[base FHIRPath])? (ELLIPSE:[ellipse elements path])? (EXCEPT:[except elements FHIRPath] (BASE:[except base FHIRPath])?)* %}{% endraw %}</code>
</p>
</div>

View File

@@ -23,6 +23,9 @@
<li>
<a href="spec.html">Detailed Specification</a> - The actual stuff implementers are expected to do. (Could be multiple pages for this.)
</li>
<li>
<a href="fragments.html">Fragments</a> - Guidance about how to embed fragments in an IG
</li>
<li>
<a href="downloads.html">Downloads</a> - Allows downloading a copy of this implementation guide and other useful information
</li>

View File

@@ -3,17 +3,3 @@ You can also use markdown if that's your thing
And an icon: ![resource](icon-resource.png)
You can also embed fragments of examples (or other resources)
As JSON:
{% include Patient-example-demo1-json-html.xhtml %}
{% include Patient-example-demo2-json-html.xhtml %}
or as XML:
{% include Patient-example-demo1-xml-html.xhtml %}
{% include Patient-example-demo2-xml-html.xhtml %}