Stream: implementers
Topic: References from Narrative to data
Grahame Grieve (Aug 02 2018 at 03:23):
I ave just run into a problem applying dispositions. GF#17336 say that we'll add an example of how to reference from narrative to data in another resource. So I thought that I'd add an example of how to reference inside the same resource first... and I can't
Grahame Grieve (Aug 02 2018 at 03:23):
what we say is:
References between the narrative and the resource data (in either direction) are mediated by the XML id/idref attributes.
Grahame Grieve (Aug 02 2018 at 03:25):
... but the problem is, there is no suitable attribute anywhere for the idref.
Grahame Grieve (Aug 02 2018 at 03:26):
I had thought that it would be
<table><tr idref="#link/><td>row content....
Grahame Grieve (Aug 02 2018 at 03:26):
but it's not.
Grahame Grieve (Aug 02 2018 at 03:26):
The only option I've come up with so far is :
Grahame Grieve (Aug 02 2018 at 03:32):
<td><a rel="related" href="#link">text content</a></td>
Grahame Grieve (Aug 02 2018 at 03:32):
and I'm not finding that at all convincing for several reasons
Grahame Grieve (Aug 02 2018 at 03:33):
- I don't know if it's legal to use href like that
- I don't know if 'related' is a valid attribute value in this context
- I expect that it will be rendered as a link which isn't what is desired
Grahame Grieve (Aug 02 2018 at 03:33):
and you can't put this on any element
Grahame Grieve (Aug 02 2018 at 03:38):
so... that's a problem.
Lloyd McKenzie (Aug 02 2018 at 03:41):
Can we do the reverse? Put ids in the xhtml and then use an extension on elements to point to them?
Grahame Grieve (Aug 02 2018 at 03:48):
it's.. possible....
Lloyd McKenzie (Aug 02 2018 at 03:52):
Do we have an issue with 'id' being required to be unique across a full instance - including across resources inside a Bundle?
Grahame Grieve (Aug 02 2018 at 03:54):
well, not across resources inside a bundle. but if you flip the references over, ids might be a probelm
Michel Rutten (Aug 02 2018 at 09:13):
IDREF
is an XML datatype; as far as I am aware, the HTML spec does not define a default attribute of type IDREF. However the FHIR spec could introduce a custom data-* attribute of type IDREF, e.g. data-fhir-elemdef
. That would allow a narrative HTML fragment to specify symbolic links to element definitions in the containing StructureDefinition.
According to W3C, for an XML document to be valid, all IDREF values must uniquely resolve to a target element in the same document:
https://www.w3.org/TR/xmlschema11-2/#IDREF
https://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#cvc-id
This implies that an IDREF attribute value cannot link to an element in an external StructureDef. Also, a Bundle containing valid stand-alone StructureDefs is not guaranteed to be a valid XML document, because of possible duplicate element ID values. However this seems a minor concern, considering that FHIR already allows differential & snapshot components to introduce duplicate id values within a StructureDefinition.
Grahame Grieve (Aug 02 2018 at 12:14):
but I don't think we can introduce our own attribute in the xhtml
Lloyd McKenzie (Aug 02 2018 at 14:05):
Not and be valid against the schema. And I suspect other tools would choke too.
Michel Rutten (Aug 02 2018 at 14:30):
data-
attributes are designed to safely store custom data and are ignored by any user agent. Indeed, XML Schema is not sufficiently expressive to allow any data-* attribute, but we could extend the schema to allow one or more concrete fhir-specific data attributes.
Grahame Grieve (Aug 02 2018 at 18:54):
well, we do not at any time explain what version of XHTML we are using, but it's really xhtml 1.0
Grahame Grieve (Aug 02 2018 at 18:54):
since all the (x)HTML 5 changes were active content we ban anyway, it has not mattered
Lloyd McKenzie (Aug 06 2018 at 23:07):
One benefit of pointing from FHIR item to text rather than the reverse is it removes a reason to have an element with a bare id (where the narrative points to the element and provides the content). If the element contains an extension pointing to an id in the narrative, that would be more clear. And we could then prohibit elements with just an id.
Grahame Grieve (Aug 06 2018 at 23:08):
so the question here is references in either direction. I'm not sure what that would look like.
Lloyd McKenzie (Aug 06 2018 at 23:36):
<Observation xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hl7.org/fhir ../../schema/fhir-single.xsd">
<id value="blood-pressure"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<table>
<tbody>
<tr>
<th>Systolic</th>
<td id="systolic">107 mmHg</td>
</tr>
<tr>
<th>Diastolic</th>
<td id="diastolic">60 mmHg</td>
</tr>
</tbody>
</table>
</div>
</text>
<status value="final"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="85354-9"/>
</coding>
</code>
<subject>
<reference value="Patient/example"/>
</subject>
<effectiveDateTime value="2012-09-17"/>
<component>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="8480-6"/>
</coding>
</code>
<valueQuantity>
<extension url="http://hl7.org/fhir/narrativeId">
<valueString value="systolic"
</extension>
<value value="107"/>
<unit value="mmHg"/>
<system value="http://unitsofmeasure.org"/>
<code value="mm[Hg]"/>
</valueQuantity>
</component>
<component>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="8462-4"/>
</coding>
</code>
<valueQuantity>
<extension url="http://hl7.org/fhir/narrativeId">
<valueString value="diastolic"
</extension>
<value value="60"/>
<unit value="mmHg"/>
<system value="http://unitsofmeasure.org"/>
<code value="mm[Hg]"/>
</valueQuantity>
</component>
</Observation>
Lloyd McKenzie (Aug 06 2018 at 23:41):
Only question mark with this approach is whether having 'id' attributes in the narrative is going to cause grief for resources in Bundles due to XML's uniqueness expectation.
Grahame Grieve (Aug 06 2018 at 23:48):
we sorted that a long time ago: idsa re not defined as xml:id because the uniqueness scope is the resource, not the xml document
Lloyd McKenzie (Aug 07 2018 at 00:24):
Yes but these would be id attributes defined by xhtml
Lloyd McKenzie (Aug 07 2018 at 00:24):
Do we have the same power to define behavior there?
Grahame Grieve (Aug 07 2018 at 00:29):
well, sort of.... I'd have to hack that bit of the xhtml schema. but we already have a hacked xhtml schema
Lloyd McKenzie (Aug 07 2018 at 00:40):
If we were willing to do that, I don't see any other downsides.
Grahame Grieve (Aug 07 2018 at 00:41):
well, if we're going to have ids in xhtml, then it's an issue whatever....
Lloyd McKenzie (Aug 07 2018 at 01:01):
I'm not following
Grahame Grieve (Aug 07 2018 at 01:02):
if we're going to allow xhtml to have ids - which we do - then id uniquess is an issue with regard to Bundle/Parameters irrespective of anything we do in regard to this subject
Lloyd McKenzie (Aug 07 2018 at 01:08):
Ah. Yeah, I suppose. But it's more of a problem if we have a reason for them to actually be used.
Last updated: Apr 12 2022 at 19:14 UTC