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, July 22, 2010

Where is the XSD for CCD?

This is a question that shows up in various places quite a bit. People who are familiar with mainstream XML development want a schema to support conformance to all of the constraints of an XML implementation.

The CCD is a specialization of the CDA specification, for which you can find schemas. These schemas are available from HL7. If you are already an HL7 member, you can get them for free.  If not already a member, you can purchase them from the HL7 store (The CDA standard and CCD implementation guide will set you back $50.00 each).

Why isn't there a schema jsut for CCD?  The W3C Schema standard just isn't able to solve this particular problem.  To make a long story short, XML descends from SGML.  One of the requirements in SGML for DTDs which made its way into XML and subsequently the XML Schema specification was implementation simplicity in parsing tags.  This means that schemas are not permitted to use any look-ahead to determine the type of an element.  They can only look at the element name.  The problem comes into play when you need to distinguish between for example, a problem, and a result.  Both of these use the observation element of the CDA, with differing requirements on what appears inside.  But, the element has the same name, and so cannot have different requirements according to the W3C schema specification.  Another example that W3C schema doesn't support very well are co-occurence constraints.  These are constraints that say if A is X, then B must be Y.  These kinds of contraints are very difficult to model in W3C schema (yeah, I know, it can be done using certain features, but those are the very same features that often break, or aren't supported in schema driven persistence models).

In the contest between the information modeling perspective which says that these two things carry many of the same semantics, and the business viewpoint which says that there are different rules that apply, something has to give.  The HL7 XML ITS says that the information model, which ensures semantic interoperability, is paramount, not the business viewpoint which imposes these different constraints.  After all, semantic interoperability has been the Holy Grail that we've all been persuing, right?

All is not lost (especially if you code in Java).  The Model Driven Healthcare Tools project (MDHT) from Open Health Tools has a great deal of support for CDA, the CCD, IHE XPHR and the HITSP C32 specifications.  Those of you using .Net might be a bit stuck.  I encourage you to participate in the MDHT work, because there is a definite need for EMF driven .Net code generation tools here.