Extracting CCD document values using MDHT via Mirth

1.1k views Asked by At

I am trying to use MDHT tools to extract values from a CCD document via Mirth. I am doing this in the following way.

Downloaded Java runtime libraries and placed them in Mirth's custom-lib folder and wrote sample code to extract some patient values in Mirth's transformer & Deploy section.

Code in transformer.

// Load the CCD Document

var doc = org.openhealthtools.mdht.uml.cda.util.CDAUtil.load(new 
java.io.ByteArrayInputStream(messageObject.getRawData().getBytes("UTF-8")));

// Get CCD Document Sections to be parsed

var docPatientRole = doc.getRecordTargets().get(0).getPatientRole();
var docPatient = docPatientRole.getPatient();
var docPatientName = docPatient.getNames().get(0);

// Map Patient Identity Fields to Mirth Channel Map Variables

channelMap.put('patientFirstName', 
docPatientName.getGivens().get(0).getText());
channelMap.put('patientLastName', 
docPatientName.getFamilies().get(0).getText());
channelMap.put('patientGenderCode', 
docPatient.getAdministrativeGenderCode().getCode());
channelMap.put('patientDateOfBirth', docPatient.getBirthTime().getValue()); // YYYYMMDD

Can anyone help me with the code as I am new to JavaScript and also I am not aware of all the functions in the .jar files so as to access all the other components in a CCD.

I am currently stuck at this point. I need to access all the sections/Components in a CCD. Can anyone please redirect me to any examples/tutorials (via Mirth) related to each section. I have already looked at some links guide/developers guide but all links are Dead and not working.

Any help is appreciated.

1

There are 1 answers

2
naXa stands with Ukraine On

"but all links are dead and not working"

I know that feel... it's frustrating.

For a start, you need to define a type and a version of the document that you want to consume. Check out this article What version of CCDA Document is this? Then you need to find an Implementation Guide (IG) for this type of documents so you know its structure (for example, HL7 C-CDA Release 1.1 IG is available here). If you know the document type, you know what data can be extracted from the document.

I'm not sure about a programming language that you use in your question. Is it Java or JavaScript? My examples are in Java:

  1. CCDA REST API - package com.appliedinformatics.cdaapi.parser (RecordTarget, Medications, Problems, Results).
  2. MDHT Developers Guide: Consume CDA Content using MDHT API (Allergies).
  3. MDHT Consolidated CDA Validator - GitHub
  4. A reference C-CDA Validator - GitHub
  5. MDHT CDA Maven example - GitHub