Add Pathology Report Attachments to NEHTA Clinical Documents

Jun 28, 2012

In previous posts, I’ve shown how to represent a pathology report in a NEHTA Clinical document, and how to convert the PIT format and the TX format into the CDA narrative format. I pretty much left it as an exercise for the reader to represent the pathology report as an attachment. This post explains how to do that. Firstly, the Pathology report structure in a CDA document includes the logical field “Pathology Test Result > Test Result Representation” (defined in the SCS/SDT, which is the logical structure of the documents). The definition of this is:

“Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they must be semantically equivalent”

In other words, the CDA narrative contains a simple representation of the report (though simple does not mean unsafe), and the CDA structure may contain additional structured data to help with the interpretation (this can range from the diagnostic service - haem, biochem, etc - through to a fully structured Cancer Report Protocol). But whatever else that contains, it’s useful and important to carry the full representation of the original report as provided by the pathology service (usually as a PDF document, though other forms are sometimes encountered, including html and pdf).

I’ve been told that it’s unsafe to represent the report as anything but the original form in pdf - which is the version of the report that equates to the classic printed report pathology services have provided for several decades. But that would be a problem, because the pathology services themselves provide these alternative formats, and all we are concerned with here is presenting the alternative content they provide faithfully (and therefore, safely). AS 4700.2 provides for a structured and a text representation to be represented in a series of OBX segments, followed by the formal representation of the report in one or more display segments, and we are faithfully reproducing this structure in the CDA document. Here, we are concerned with reproducing the display segments in CDA.

So we’re going to assume that we have some attachment, with some known mime type (which, for the purposes of this post, we will assume to be application/pdf). We have to do three things:

  • Put the attachment in the CDA Package
  • Define the report formally in the structured data
  • Reference the attachment in the narrative

Attachment in the CDA Package

According the CDA, any clinical content that is inherently part of the document must be transported around with the document so that it is always available where ever the document is. (The pathology report probably fits the definition - at least, we’re going to treat it so, since it’s safer to do this). In order to ensure that images and attachments like this, and digital signatures, are always available, NEHTA clinical documents are always moved around in “packages” which are effectively IHE XDM packages, though without metadata in most applications (maybe that’s worth another post, but I’m not going to explain it here).

So a clinical document package is a zip archive that contains a CDA document, an XML signature file, and one or more attachments. The full spec is here - this is just a simplified description. Attachments are effectively “local” to the document - i.e. a relative URL. In order to ensure that the attachments from different documents don’t accidently run into each other in some context - though this really shouldn’t be allowed anyway - attachments should have a GUID as their name (and it’s.. polite.. to include a file extension to assist newbie developers to get this right).

So the first thing we do is ensure that the pathology report is included in the zip file with a name like 317dcda7-7e67-405e-802e-0430c208f354.pdf, which we will hereafter call [guid].pdf.

Next, we link to the report in the structured data. According to the CDA Implementation Guide, the content is supposed to go in entry[path_test_res]/observation/value:ED, which means that it would look like this:

<section>
 <code code="102.16144" codeSystem="1.2.36.1.2001.1001.101" 
    displayName="Pathology Test Result" />
 <title>Pathology Test Result</title>
 <text>..</text>
 <entry>
  <observation classCode="OBS" moodCode="EVN">
  <code code="[loinc code]" codeSystem="2.16.840.1.113883.6.1" displayName="[...]" />
  <value xsi:type="ED" mediaType="application/pdf">
   <reference value="[guid].pdf" />
  </value>
  <!-- other stuff... -->

There can be multiple values. Each value element is saying, “the value of this pathology report is… this fully formatted report”. (Why not use Observation.text? there can only be one of them, but there can be multiple values). And the content of the value is a reference to [guid].pdf - and since this is a local reference, it means, resolve this in the local CDA package, where we just put it.

Including the report in the narrative

In CDA, though, that’s not enough - if we actually want to add the attachment to the document as part of the content, we need to do that in the narrative. We can’t do that by actually dropping the content into the narrative - CDA doesn’t have an instruction to do that (i.e. something equivalent to iFrame) - and none of the software could easily do that anyway. So we’re going to provide a reference to it.

<section>
 <code code="102.16144" codeSystem="1.2.36.1.2001.1001.101" 
    displayName="Pathology Test Result" />
 <title>Pathology Test Result</title>
 <text>
  <!-- pathology text report - built from pit of html or whatever -->
  <paragraph>
   <linkHtml ref="[guid].pdf">Original Pathology Report</linkHtml>
  </paragraph>
 </text>

So this says, when you render “Original Pathology Report”, make it a clickable link that points to [guid].pdf, which is the same local report. It’s up to the viewer software to enable this link (the requirement to do this is part of the base requirements described by the NEHTA CDA Rendering Guide that apply to all conformant renderers, so it can be relied on).

So this is how to include an original pathology report in a NEHTA Clinical Document.