Converting HL7 v2 Text to CDA

Jun 4, 2012

This is the first of a series of posts dealing with representing diagnostic reports in CDA here in Australia.The first example is an HL7 v2 TX segment, like this: ```` OBX|1|TX|UMC^Urine M\T\C^LAB||~Lab No : 5555-1234       Collected:19:00  13-Apr-12~                         Received: 12:34  14-Apr-12~Specimen : Urine Mid Stream~~~~MICROSCOPY~White Blood Cells           2 x10\S\6/L   (< 10)~Red Blood Cells             0 x10\S\6/L   (< 10)~Squamous Epithelia       Nil~Microscopy Comment:~UTI unlikely in the absence of a leukocyte response, except in a neutropenic patient. This does not~exclude asymptomatic bacteriuria in pregnant patients.~~ANTIMICROBIAL ACTIVITY:~NOT detectedCULTURE:~Mixed Skin Flora <10\S\7/L~~CULTURE COMMENT~No significant growth.~||||||F|||201204150913|ACME^Acme Laboratory^LAB


How do you represent this in CDA? Well, since it's a TX, not a structured data representation, it gets mapped to section.text - and you'll need a section for each OBX. Actually, this should mean a section for each OBR, since there should only be one OBX/TX per OBR - but that's often not going to be the case. So you'll have to review the content of the message to see what's going on if there's more than one TX. (Likely, TX is being used wrongly, and it should be ST)

So, you have to map the TX into section.text. The first thing to do is to replace ~ with end of lines, like this:

Lab No : 5555-1234       Collected:19:00  13-Apr-12 Received: 12:34  14-Apr-12 Specimen : Urine Mid Stream MICROSCOPY White Blood Cells           2 x10\S\6/L   (< 10) Red Blood Cells             0 x10\S\6/L   (< 10) Squamous Epithelia       Nil  Microscopy Comment: UTI unlikely in the absence of a leukocyte response, except in a neutropenic patient. This does not exclude asymptomatic bacteriuria in pregnant patients.    ANTIMICROBIAL ACTIVITY: NOT detected  CULTURE: Mixed Skin Flora <10\S\7/L CULTURE COMMENT No significant growth.

Actually, no, not like that at all. Like this:

Lab No : 5555-1234       Collected:19:00  13-Apr-12                          Received: 12:34  14-Apr-12 Specimen : Urine Mid Stream

MICROSCOPY White Blood Cells           2 x10\S\6/L   (< 10) Red Blood Cells             0 x10\S\6/L   (< 10) Squamous Epithelia       Nil

Microscopy Comment: UTI unlikely in the absence of a leukocyte response, except in a neutropenic patient. This does not exclude asymptomatic bacteriuria in pregnant patients.

ANTIMICROBIAL ACTIVITY: NOT detected

CULTURE: Mixed Skin Flora <10\S\7/L

CULTURE COMMENT No significant growth.


Generally, TX content in v2 assumes that it is being presented in fixed width fonts. As part of the MSIA profile, we decided that there was no way, here in the Australian context, that you could safely decide to use anything but fixed width fonts. So the real question with TX data is how to use fixed width fonts in CDA. And the base CDA specification doesn't have any way to use fixed width fonts.  To deal with this NEHTA
defined two additional custom styles in the standard NEHTA spreadsheet:
* xFixed: use a a fixed-width/monospace font
* xPre: text contains whitespace and carriage returns which may not be ignored (and use a fixed width font)

These are documented in the CDA Rendering Guide (available from the [Software Developers Resource Centre](http://vendors.nehta.gov.au)). So to correctly render this in a NEHTA CDA document, you would do it like this:
...
Lab No : 5555-1234       Collected:19:00  13-Apr-12                          Received: 12:34  14-Apr-12 Specimen : Urine Mid Stream MICROSCOPY White Blood Cells           2 x10\S\6/L   (< 10) Red Blood Cells             0 x10\S\6/L   (< 10) Squamous Epithelia       Nil Microscopy Comment: UTI unlikely in the absence of a leukocyte response, except in a neutropenic patient. This does not exclude asymptomatic bacteriuria in pregnant patients. ANTIMICROBIAL ACTIVITY: NOT detected CULTURE: Mixed Skin Flora <10\S\7/L CULTURE COMMENT No significant growth.

````