Jayant Singh Website - Healthcare IT Blog

C-CDA to JSON to MongoDB using MDHT & Mirth

Recently I stumbled across a very good tutorial on how to Parse CCDs in Mirth using MDHT (Model Driven Health Tools). This tutorial will help you setting up the Mirth to use MDHT lib. http://www.spheregen.com/parsing-continuity-of-care-ccd-using-mirth-and-mdht/

It was such an easy to implement the tutorial that it inspired me to do a POC with MDHT & Mirth and I thought of converting Consolidated CDA documents to json.

Then I searched if this is already implemented and found two very useful open source libraries.


I tried bluebutton.js first and it was really easy to implement with javascript in browser that I just copied the json format from it.


After successfully converting C-CDA to json using MDHT in Mirth, I then thought of going a step ahead and storing this json in MongoDB with same Mirth Channel and see how Mongo queries can be used to do analytics from document repository created out of it.

Here is how the high level architecture of this POC looks like


CCDA to JSON using MDHT & Mirth


Mirth Channel Details

  • This Mirth channel is configured to listen as a File Reader for incoming C-CDA XMLs
  • Once XML is received, channel creates CDA Document using MDHT toolkit )tutorial link shared at beginning of this article)
  • Source Transformer converts each section to json and stores it in ChannelMap
  • Channel Destination is configured as Javascript Writer
  • Destination has a custom code to write the json to MongoDB
  • JSON data stored in MongoDB can be used for analytics with Mongo Queries
  • Patient/document matching (duplicate check) is not handled in this POC
  • Pre-requisite for using MongoDB in Mirth is to copy java driver jar file in Mirth's custom-lib folder.

Mirth connect transformer step to convert Allergy Section XML to json using MDHT




Sample CCDA document XML




Sample CCDA document JSON

with these sections only (Header, Allergies, Enconters, Immunizations, Results, Problems, Procedures & Medications