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, December 5, 2013

What is the purpose of XDS formatCode

There's a big discussion on the FHIR list serve about formatCode, and how to model it in the DocumentReference resource.  I thought I would take a few moments to explain its purpose.

There are a lot of different ways to classify clinical documents.  The first of these is to describe the MIME type.  This allows you to say that the document is in plain text (text/plain), RTF (text/rtf), HTML (text/html), XML (text/xml), PDF (application/pdf) and various other formats.  Back when XDS was written, many of the XML based formats hadn't yet started using or registering the various +xml MIME types following the new conventions.  So we had text/xml which wasn't distinct enough (and still today we have this problem with XML formats).

Document type (using LOINC), and document Class classifies documents in fine and coarse grained ways, the former for detailed classification, the latter for selection among pick lists.  A discharge summary could be in any number of MIME types, and still have the same document type code.

The purpose of formatCode was to distinguish between the cases where type code and MIME type still didn't give you enough distinction.  The problem back in 2004/2005 was very real, as a CDA and a CCR were using text/xml for MIME type, but the Schemas  were very different.  There are other cases where the Schema (big S) could be the same, but the schema (little s) is different, even when using CDA.  Today we have CCD, and two versions of it, the one in CCD Release 1.0, and the other in CCD 1.1 found in the CCDA specification.

One of the challenges with format code is that while we understood the need for it in IHE, it took us a while to figure out the correct use.  The correct use of formatCode is to present enough information to distinguish between two formats, but no more.  In CCDA, there are nine different document types, eight of which are CDA Level 1/2/3 and one of which (the unstructured document) is CDA level 1 only.

For format code, we'd want to be able to distinguish that the document complied with one of the eight document types, and might also conform to the ninth (yes, formatCode could be many -- we restricted it to one in XDS because at the time it was the right thing to do, the concept was new enough that people would have understood it even less if we allowed for many).  CCDA doesn't have a formatCode yet, and that's yet another discussion.  CCDA is an HL7 document, and so HL7 should specify the format code for it.

My recommendation on what that should look like will likely come up on an HL7 SDWG call or on the list serve. The idea is that somewhere within it, it will distinguish two flavors of CCDA, that with structured content, and that with unstructured content.  MIME type will already be the same, but typeCode is enough to distinguish between the nine varieties if we have format code, MIME type, and type code.