FHIR: Slicing extensions - hl7-fhir

Slicing of DataElements is defined once per path (only one set of discriminators per unique path). This works for built-in elements, but extension is (and must be) sliced only by url. As a result, it appears that further (more detailed) slicing of an extension isn't possible.
For example, consider an extension to Patient for research authorizations, ext url "http://example.com/DataElement/researchAuth".
It has an extension sub-element "authorizationType" (http://example.com/DataElement/researchAuth.type) of type Code. Here are two instances of this extension (one type "local", one "national").
<extension url="http://example.com/DataElement/researchAuth">
<extension url="http://example.com/DataElement/researchAuth.type">
<valueCode value="local" />
</extension>
<extension url="http://example.com/DataElement/researchAuth.flag>
<valueBoolean value="true" />
</extension>
</extension>
<extension url="http://example.com/DataElement/researchAuth">
<extension url="http://example.com/DataElement/researchAuth.type">
<valueCode value="national" />
</extension>
<extension url="http://example.com/DataElement/researchAuth.flag>
<valueBoolean value="false" />
</extension>
</extension>
The StructureDefinition for this would include (from Patient):
...snip...
<element>
<path value="Patient.extension" />
<slicing>
<discriminator value="url" />
</slicing>
</element>
I could add an element for researchAuthorization by using type.Profile to define the extension URL, but can I add a slicing as shown?
<element>
<path value="Patient.extension" />
<slicing>
<discriminator value="url" />
</slicing>
</element>
<element>
<path value="Patient.extension" />
<name value="researchAuthorization" />
<slicing>
<discriminator value="url" />
<discriminator value="extension["http://example.com/DataElement/researchAuth.type"].code" />
</slicing>
<type>
<profile value="http://example.com/DataElement/researchAuth" />
</type>
</element>
The second is now legal since it "satisfies" the first slicing via type.profile.#value being fixed?

It's possible for a set of sliced data to have multiple discriminators. Whether the existing tooling will support this for extensions is a different question. You may need to manually author your profile.

Related

Fhir , slicing based on the value of an extension

is there a way to define a slicing based on the value of an extension on top of each element of a collection? example: Procedure.bodySite
<element id="Procedure.bodySite">
<path value="Procedure.bodySite" />
<slicing>
<discriminator>
<type value="value" />
<path value="bodySite.extension("http://a/ext").value" />
</discriminator>
<rules value="open" />
</slicing>
</element>
<element id="Procedure.bodySite.extension">
<path value="Procedure.bodySite.extension" />
<slicing>
<discriminator>
<type value="value" />
<path value="url" />
</discriminator>
<rules value="open" />
</slicing>
</element>
<element id="Procedure.bodySite.extension:myExtension">
<path value="Procedure.bodySite.extension" />
<sliceName value="myExtension" />
<type>
<code value="Extension" />
<profile value="http://a/ext" />
</type>
</element>
<element id="Procedure.bodySite:sliceBodySite">
<path value="Procedure.bodySite" />
<sliceName value="sliceBodySite" />
<max value="1" />
</element>
<element id="Procedure.bodySite:sliceBodySite.text">
<path value="Procedure.bodySite.extension" />
<fixedBoolean value="true" />
</element>
the result is : Unable to resolve discriminator in definitions: bodySite.extension('http://a/ext').value
so what is the problem here?
You can use .extension("url") as part of the path in a discriminator. So you can slice by value with a discriminator path of:
bodySite.extension("http://your/extension/url/here").value

Can a FHIR extension be defined within the StructureDefinition of a profiled resource?

Does a FHIR extension always have to be defined in its own StructureDefinition before it can be used in a resource profile?
Or can its definition exist solely within the StructureDefinition of a profiled resource?
E.g.
<StructureDefinition xmlns="http://hl7.org/fhir">
<base value="http://hl7.org/fhir/StructureDefinition/Order" />
<name value="Order" />
...
<differential>
<element>
<path value="Order.extension" />
<name value="type" />
<label value="Type" />
<short value="BookAppointment | TelephonePatient | PatientNote | Note | Other" />
<definition value="Order type" />
<min value="1" />
<max value="1" />
<type>
<code value="code" />
</type>
<binding>
<strength value="required" />
<valueSetReference>
<reference value="http://test.org/fhir/ValueSet/task-type" />
</valueSetReference>
</binding>
</element>
...
Is the above valid?
No, that's not valid - because Order.extension can't have a type of "code". You could, in theory, slice extension and constrain the value[x] type to be valueCode with the specified properties. You'd also have to constrain the URL to a specified fixed value. The tricky part is that the URL you indicate as the fixed value is supposed to resolve to a StructureDefinition that defines the extension. So you really won't have saved yourself any work. Sending an instance where any immediate receiver can't discover the extension definition would make you automatically non-conformant.

How to deal with deafult namespace when searching using xpath in splunk?

So I have a valid xml file looking something like this:
<session xmlns="http://winscp.net/schema/session/1.0" name="mysession#10.0.0.22" start="2015-09-28T05:00:01.974Z">
<ls>
<destination value="/" />
<files>
<file>
<filename value="." />
<type value="d" />
<modification value="2015-09-28T05:44:14.000Z" />
<permissions value="rw-rw----" />
</file>
<file>
<filename value=".." />
<type value="d" />
<modification value="2015-09-28T05:44:14.000Z" />
<permissions value="rw-rw----" />
</file>
<file>
<filename value="55800379_150928_071525.zip" />
<type value="-" />
<size value="999124" />
<modification value="2015-09-28T05:36:08.000Z" />
<permissions value="rw-rw----" />
</file>
</files>
<result success="true" />
</ls>
<download>
<filename value="/55800379_150928_071525.zip" />
<destination value="C:\somefolder\55800478_150928_071525.zip" />
<result success="true" />
</download>
<rm>
<filename value="/55800379_150928_071525.zip" />
<result success="true" />
</rm>
</session>
I have added it as data in splunk and am trying to search using a query as below:
source="sample5.xml" host="dummy1" sourcetype="WinSCP XML" | xpath outfield=afield "//ls/files/file/filename/#value"
However, in this case the afield field is not getting populated (I was expecting the three values '.', '..' and '55800379_150928_071525.zip'). So I've got the error down to the xmlns in the session tag, when the first line looks like this (note: no xmlns attribute), the search does what I expect:
<session name="mysession#10.0.0.22" start="2015-09-28T05:00:01.974Z">
What do I have to put in my xpath to get the result I am looking for (I would very much prefer not to have to preprocess my logs to remove the XML namespace prior to import)?
Hmm, that looks like an unnamed namespace, which I can get at by registering a custom namespace prefix using my libxml2 wrapper program:
$ xpquery -n 'x:http://winscp.net/schema/session/1.0' '//x:ls/x:files/x:file/x:filename/#value' blah.xml
value="."
value=".."
value="55800379_150928_071525.zip"
$
Check whether your xpath program has support for the equivalent of libxml2 registerNs functionality?

FHIR: Nested extensions

What is the correct representation of a multi-level FHIR extension?
<extension url="http://example.com/DataElement/researchAuth">
<extension url="http://example.com/DataElement/researchAuth.type">
<valueCode value="local" />
</extension>
<extension url="http://example.com/DataElement/researchAuth.flag>
<valueBoolean value="true" />
</extension>
</extension>
-- OR --
<extension url="http://example.com/DataElement/researchAuth">
<extension url="http://example.com/DataElement/researchAuth#type">
<valueCode value="local" />
</extension>
<extension url="http://example.com/DataElement/researchAuth#flag>
<valueBoolean value="true" />
</extension>
</extension>
In the StructureDefinition, should the URL for the sub-extensions be fully qualified (url: "http://example.com/DataElement/researchAuth#type") or just the name ("type") as here: http://hl7-fhir.github.io/extension-goal-relationship.html
Finally, is there an standard linkage between StructureDefinition.name and the sub-extension URL? I.e. the part after the # (type in http://example.com/DataElement/researchAuth#type) should match the name in the structure defition of the extension:
<StructureDefinition>
...
<element>
<path value="Extension" />
<name value="researchAuth" />
</element>
<element>
<path value="Extension.extension" />
<name value="researchAuth.type" />
</element>
...
</StructureDefinition>
Otherwise, how does one determine what the post # element is??
James's example adds to my confusion:
http://jamesagnew.github.io/hapi-fhir/doc_extensions.html
In the sub-extensions section, the "parent" is "http://example.com#parent" and the children are "http://example.com#ChildOne" and "http://example.com#ChildTwo" respectively.
I would expect only "http://example.com" for the parent extension (no # as it's the base extension defined at the URL). OR http://example.com#parent.ChildOne for the sub-extensions.
In DSTU 1, it would be the first approach. In DSTU 2, it would be this:
<extension url="http://example.com/DataElement/researchAuth">
<extension url="type">
<valueCode value="local" />
</extension>
<extension url="flag>
<valueBoolean value="true" />
</extension>
</extension>
That only holds for children of complex extensions. If you want to include an extension defined elsewhere inside another extension, you need to use the full URL.

Adding a custom button to the advanced find robbon

I've got my customizations.xml importing ok, but when I open the Advanced Find Dialog, it tell me "Ribbon XML Validation Error":
I can't seem to get any more info than that. Below is my customizations.xml text, I've tried to simplify it as much as possible.
<ImportExportXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Entities></Entities>
<Roles></Roles>
<Workflows></Workflows>
<FieldSecurityProfiles></FieldSecurityProfiles>
<Templates />
<RibbonDiffXml>
<CustomActions>
<CustomAction Id="DEW.Mscrm.AdvancedFind.Groups.Debug.UploadFetchXml"
Location="Mscrm.AdvancedFind.Groups.Debug._children" >
<CommandUIDefinition>
<Button Id="DEW.Mscrm.AdvancedFind.Groups.Debug.UploadFetchXmlButton" />
</CommandUIDefinition>
</CustomAction>
</CustomActions>
<Templates>
<RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
</Templates>
<CommandDefinitions>
</CommandDefinitions>
<RuleDefinitions>
<TabDisplayRules />
<DisplayRules />
<EnableRules />
</RuleDefinitions>
<LocLabels />
</RibbonDiffXml>
<EntityMaps />
<EntityRelationships />
<OrganizationSettings />
<optionsets />
<Languages>
<Language>1033</Language>
</Languages>
</ImportExportXml>
For others looking to find the solution, or at least something to take note of if you're having a similar problem.
My problem was that the id for the different elements were the same. You must have unique id's even among different elements. And "Mscrm.AdvancedFind.Groups.Debug._children" should have been "Mscrm.AdvancedFind.Groups.Debug.Controls._children"

Resources