Convert your FHIR JSON -> XML and back here. The CDA Book is sometimes listed for Kindle here and it is also SHIPPING from Amazon! See here for Errata.

Thursday, June 2, 2011

Subtleties in Constraint Language

We were discussing this topic on an SIFramework call the other day, as related to the CDA Consolidation guide.  I'm putting together a rogues gallery of different types of implementation guide constraints (of which this is one input).

One of the subtleties of constraint in a guide has to do with how different constraints interact.  Consider the following two scenarios:

Scenario 1 (Cardinality AND Value Constraint):
  1. There shall be exactly one [1..1] typeId element beneath the ClinicalDocument element.
    1. The typeId/@root shall be "2.16.840.1.113883.1.3"
    2. The typeId/@extension shall be "POCD_HD00004"
In XPath these three assertions could be individually represented as:
  1. count(/ClinicalDocument/typeId) = 1 
    1. /ClinicalDocument/typeId/@root="2.16.840.1.113883.1.3"
    2. /ClinicalDocument/typeId/@extension="POCD_HD00004"
NOT: These could be combined into a single expression using and, but there is little value of that to end users because the test would no longer be able to tell them WHICH of the three requirements was not met.
Scenario 2 (Cardinality WITH Value Constraint):

  1. There shall be exactly one [1..1] templateId element where @root = "2.16.840.1.113883.10.20.22.1.1"
In XPath, this could be represented as:

  1. count(/ClinicalDocument/templateId[@root="2.16.840.1.113883.10.20.22.1.1"]) = 1


The first set of constraints indicate that there shall be only typeId element, and that it must have a particular value (using the II datatype).  It prohibits the appearance of a typeId element containing any other value.

The second constraint indicates that there is only one templateId element that has a particular value.  It does not prohibit the appearance of other templateId elements containing other values.

In other words, there is a difference between "there shall be only 1, and it shall have this value" and "there shall be only 1 with this value".

This is the root cause of one of the confusions with respect to using other medication vocabulary in the HITSP C32 to record the coded brand names.  The intent in that case was to following scenario 2, not scenario 1, as I explained here.

I think the rogue's gallery will help.

0 comments:

Post a Comment