Stream: implementers
Topic: Element.id vs snapshots of subtypes of Element in FHIR 4.0.0
Gabriel Bezerra (Feb 22 2019 at 15:25):
Dear all,
In FHIR 4.0.0, Element.id
is defined by the following ElementDefinition
:
{ "id" : "Element.id", "path" : "Element.id", "representation" : ["xmlAttr"], "short" : "Unique id for inter-element referencing", "definition" : "Unique id for the element within a resource (for internal references). This may be any string value that does "min" : 0, "max" : "1", "base" : { "path" : "Element.id", "min" : 0, "max" : "1" }, "type" : [{ "_code" : { "extension" : [{ "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type", "valueString" : "string" }, { "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-type", "valueString" : "xsd:string" }, { "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-rdf-type", "valueString" : "xsd:string" }] } }], "isModifier" : false, "isSummary" : false, "mapping" : [{ "identity" : "rim", "map" : "n/a" }] },
However, when looking into subtypes of Element
, one can find the StructureDefinition
s have the following shape:
{ "fullUrl" : "http://hl7.org/fhir/StructureDefinition/BackboneElement", "resource" : { "resourceType" : "StructureDefinition", "id" : "BackboneElement", // ... "fhirVersion" : "4.0.0", // ... "kind" : "complex-type", "abstract" : true, "type" : "BackboneElement", "baseDefinition" : "http://hl7.org/fhir/StructureDefinition/Element", "derivation" : "specialization", "snapshot" : { "element" : [{ "id" : "BackboneElement", // ... }, { "id" : "BackboneElement.id", "path" : "BackboneElement.id", "representation" : ["xmlAttr"], "short" : "Unique id for inter-element referencing", "definition" : "Unique id for the element within a resource (for internal references). This may be any string value that does "min" : 0, "max" : "1", "base" : { "path" : "Element.id", "min" : 0, "max" : "1" }, "type" : [{ "code" : "string" }], "isModifier" : false, "isSummary" : false, "mapping" : [{ "identity" : "rim", "map" : "n/a" }] }, { "id" : "BackboneElement.extension", // ... }, { "id" : "BackboneElement.modifierExtension", // ... }] }, "differential" : { "element" : [{ "id" : "BackboneElement", // ... }, { "id" : "BackboneElement.modifierExtension", // ... }] }
...that is:
- differential
does not pose any changes to the id
field; and
- snapshot
shows an id
field whose type
is completely different from the definition of the base Element.id
.
It also happens with other Elements, like http://hl7.org/fhir/StructureDefinition/string
, http://hl7.org/fhir/StructureDefinition/boolean
etc.
What is the correct version: the one described by differential
, or the one described by snapshot
?
Gabriel Bezerra (Feb 25 2019 at 09:08):
@Grahame Grieve @Lloyd McKenzie -- you usually answer my questions in this regard, maybe you would be interested in this one ^
Michel Rutten (Feb 25 2019 at 12:09):
Hi @Gabriel Bezerra, looks like you found an error in the official snapshots.
For comparison, here's a fragment from an Observation snapshot, generated by the (R4) FHIR .NET API:
<element id="Observation.referenceRange.id"> <path value="Observation.referenceRange.id" /> <representation value="xmlAttr" /> <short value="Unique id for inter-element referencing" /> <definition value="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." /> <min value="0" /> <max value="1" /> <base> <path value="Element.id" /> <min value="0" /> <max value="1" /> </base> <type> <code> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type"> <valueString value="string" /> </extension> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-type"> <valueString value="xsd:string" /> </extension> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-rdf-type"> <valueString value="xsd:string" /> </extension> </code> </type> <mapping> <identity value="rim" /> <map value="n/a" /> </mapping> </element>
In this example, you can see that the particular id
child element inherits all the constraints (incl. special "compiler magic" extensions) from the Element.id' ElementDefinition node in the core
Element` StructureDefinition.
Gabriel Bezerra (Feb 25 2019 at 12:19):
@Michel Rutten , yes. In that case, when they disagree, which one wins?
Michel Rutten (Feb 25 2019 at 12:22):
Malformed data is ambiguous, per definition. FHIR core resource & type definitions should be completely valid. I suggest that you submit a GForge ticket to correct this.
Michel Rutten (Feb 25 2019 at 12:23):
In general, a derived profile is only allowed to further constrain the base profile; it is certainly not valid to replace an element type with another, incompatible type.
Gabriel Bezerra (Feb 25 2019 at 13:16):
Ticket submitted in GForge: https://gforge.hl7.org/gf/project/fhir/tracker/?action=TrackerItemEdit&tracker_item_id=20465
Grahame Grieve (Feb 25 2019 at 23:23):
I'll add it to my list
Last updated: Apr 12 2022 at 19:14 UTC