Question: GTS cardinality in CDA
Sep 20, 2012Question: I have an RMIM that states “effectiveTime” is a GTS[0..1], that implies a SET
Thee following snippet is ok by schema, but the schematron constraint fails:
<effectiveTime xsi:type="IVL_TS">
<low value="20110301"/>
<high value="20120301"/>
</effectiveTime>
<effectiveTime institutionSpecified="true" operator="A" xsi:type="PIVL_TS">
<period unit="h" value="6"/>
</effectiveTime>
What does the snippet mean, and is it legal?
Answer: The snippet identifies the intersection of “every 6 hours” and “1-Mar 2011 to 1-Mar 2012”. It’s meaningful, and it’s valid CDA. Whether it’s valid against the schematron.. that’s a much harder question. As a background, the cardinality stated against an item in the RIM is the UML cardinality. There’s a little bit of ambiguity here, with collections - does a collection
So, the cardinality in the CDA document is the UML cardinality. When the CDA document is represented in XML, using the XML representations defined in the base v3 methodology, there is one xml element for each data type, and therefore there is a direct correspondance between the UML cardinality and the XML cardinality: UML cardinality 1..2 means 1..2 XML elements… for all cases. Except, that is, for GTS.
GTS is a set of items. A single set - a set with a cardinality of 1 - can be built by specifying an element, and then adding repeated elements, each of which define an operation that is to be performed on the set using the operator attribute. No matter how many XML elements there are, there is only one set. So the UML cardinality is 1, irrespective of the XML element cardinality.
Aside - I need to make several caveats to this statement:
- All the repeating elements must have an operator. If there’s a repeating element that doesn’t have an operator, then this is an invalid instance (Act.effectiveTime has an upper cardinality of 1 in the RIM itself)
- Strictly, there are ways to build a bag
using BXIT and operators where the UML cardinality doesn't match the XML element cardinality - but there's no use for this in the context of CDA (and no rational use for this anywhere) - some UML attributes are represented as XML attributes, and cardinality applies differently
So, given this, the question is, what does it mean to say “I have a (Schematron) constraint that effectiveTime is [1..1]” - does it intend to address the UML or the XML cardinality? That’s not clear. Consider this, from the CCDA ballot:
The cardinality indicator (0..1, 1..1, 1..*, etc.) specifies the allowable occurrences within a document instance. Figure 2: Constraints format – only one allowed
- SHALL contain exactly one [1..1] participant (CONF:2777).
a. This participant** SHALL contain exactly one [1..1] **@typeCode=”LOC” (CodeSystem: 2.16.840.1.113883.5.90 HL7ParticipationType) (CONF:2230).
The language in this extract is unclear - do they mean, the XML representation of the document instance, or a logical document at the UML level? Not clear. “shall contain one participant”… I’m inclined to think that this is different to “shall contain one participant element”, and that the cardinalities should be understood to line up with the UML cardinalities. Of course, there’s only one case where this matters, which is this one.
So I reckon that fragment at the top should be valid. But there’s a way to work around this - this fragment is equivalent in meaning:
<effectiveTime xsi:type="SXPR_TS">
<comp>
<low value="20110301"/>
<high value="20120301"/>
</comp>
<comp institutionSpecified="true" operator="A" xsi:type="PIVL_TS">
<period unit="h" value="6"/>
</comp>
</effectiveTime>
But it has a cardinality of 1 in the XML. So I recommend to use this form, and not the other. Bingo, problem solved.