Remove Segments from CCDA

Aim :

Let us consider that you want to remove certain segments from the incoming CCDA message structure, which your end client thinks that it is not needed for them to receive. How can we remove those specific segments from all  the incoming CCDA files?

Pre-requisite :

  • MirthConnect : 3.4.1.8057 (latest version) — Any previous versions also OK

Channel setup :

  1. Create a New channel name it as your wish Here I have named CCDA Mofification
  2. Click on Set Data Types button set the source connector inbound to XML
  3. Outbound and Destination 1 to XML
     – that’s it the channel setup is done for it.

Source Transformer :

  • Go to the source transformer and right click to create a new step
  • Name the step as Remove segment
  • Select the drop-down of  the step that you have created and select Javascript

 

let us assume that we don’t require the Vital signs segment from the incoming CCDA, though Vital signs segment is very important, I’m just using this to show demo in a very clear and easier format.

Write the following code in the transformer area:

var messageLength = msg[‘component’][‘structuredBody’][‘component’].length();
for(itr=0;itr<messageLength;itr++)
{
if(msg[‘component’][‘structuredBody’][‘component’][itr][‘section’][‘templateId’][‘@root’]==”2.16.840.1.113883.10.20.22.2.4.1″)
{
logger.info(“incoming Message : “+msg);
var removedSeg = msg[‘component’][‘structuredBody’][‘component’][itr][‘section’];
channelMap.put(“removedSegment”,removedSeg);
delete msg[‘component’][‘structuredBody’][‘component’][itr][‘section’];
logger.info(“outgoing Message : “+msg);
}

}

Consider that you provide the following sample data into mirth.

<ClinicalDocument xmlns=”urn:hl7-org:v3″ xmlns:cda=”urn:hl7-org:v3″ xmlns:sdtc=”urn:hl7-org:sdtc” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”&gt;
<realmCode code=”US”/>
<typeId extension=”POCD_HD000040″ root=”2.16.840.1.113883.1.3″/>
<templateId root=”2.16.840.1.113883.10.20.22.1.1″/>

………………………………………….
………………………………………….
………………………………………….
<component>
<section>
<templateId root=”2.16.840.1.113883.10.20.22.2.14″/>
<id extension=”Functional Status” root=”2.201″/>
<code code=”47420-5″ codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=”FUNCTIONAL STATUS”/>
<title>Functional Status</title>
<text>
<table>
<thead>
<tr>
<th>Functional Condition</th>
<th>Effective Dates</th>
<th>Condition Status</th>
</tr>
</thead>
<tbody>
<tr>
<td/>
<td>null</td>
<td>completed</td>
</tr>
</tbody>
</table>
</text>
<entry typeCode=”DRIV”>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.68″/>
<id root=”87347b49-c2ce-4e3e-9bf4-8fe09e9332db”/>
<code code=”” codeSystem=”2.16.840.1.113883.6.96″ displayName=”completed” xsi:type=”CE”/>
<statusCode code=”completed”/>
<effectiveTime>
<low value=”null”/>
<high value=”null”/>
</effectiveTime>
<value code=”” codeSystem=”2.16.840.1.113883.6.96″ displayName=”” xsi:type=”CD”/>
</observation>
</entry>
</section>
</component>
<component>
<section>
<templateId root=”2.16.840.1.113883.10.20.22.2.3.1″/>
<code code=”30954-2″ codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=”RESULTS”/>
<title>Results</title>
<text>
<table>
<thead>
<tr>
<th>Test name</th>
<th>Date</th>
<th>Lab Name</th>
<th>Measure</th>
<th>Units</th>
<th>Reference Range</th>
<th>Lab Value</th>
</tr>
</thead>
<tbody>
<tr>
<td/>
<td>20141015</td>
<td>
<name>Century Hospital</name>
<name>Century Hospital</name>
<name>Century Hospital</name>
<name>Century Hospital</name>
</td>
<td>10^3/ul</td>
<td>10^3/ul</td>
<td> – </td>
<td>220.00</td>
</tr>
</tbody>
</table>
</text>
<entry>
<organizer classCode=”BATTERY” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.1″/>
<id root=”e673e7ec-effc-445c-8d4d-b723ad8327aa”/>
<code code=”43789009″ codeSystem=”2.16.840.1.113883.6.96″ codeSystemName=”SNOMED-CT” displayName=”CBC WO Differential” xsi:type=”CE”/>
<statusCode code=”completed”/>
<component>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.2″/>
<id root=”c6a6491d-c11e-425a-ac72-028cb6624783″/>
<code code=”” codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=””/>
<statusCode code=”completed”/>
<effectiveTime value=”20141015″/>
<value unit=”10^3/ul” value=”220.00″ xsi:type=””/>
<author>
<time value=””/>
<assignedAuthor>
<id root=”c6a6491d-c11e-425a-ac72-028cb6624783″/>
<representedOrganization>
<name>&lt;name xmlns=”urn:hl7-org:v3″&gt;Century Hospital&lt;/name&gt;&lt;name xmlns=”urn:hl7-org:v3″&gt;Century Hospital&lt;/name&gt;&lt;name xmlns=”urn:hl7-org:v3″&gt;Century Hospital&lt;/name&gt;&lt;name xmlns=”urn:hl7-org:v3″&gt;Century Hospital&lt;/name&gt;</name>
</representedOrganization>
</assignedAuthor>
</author>
<referenceRange>
<observationRange>
<value xsi:type=””>
<low unit=”” value=””/>
<high unit=”” value=””/>
</value>
</observationRange>
</referenceRange>
</observation>
</component>
</organizer>
</entry>
</section>
</component>
<component>
<section>
<templateId root=”2.16.840.1.113883.10.20.22.2.17″/>
<id extension=”SocialHistory” root=”17eae709-d72c-4b04-a75e-03facbe243d9″/>
<code code=”29762-2″ codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=”Social history”/>
<title>Social History</title>
<text>
<table>
<thead>
<tr>
<th>Description</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td>Current every day smoker</td>
<td>20141120</td>
</tr>
</tbody>
</table>
</text>
<entry typeCode=”DRIV”>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.78″/>
<id extension=”12345″ root=”2.16.840.1.113883.19″/>
<code code=”ASSERTION” codeSystem=”2.16.840.1.113883.5.4″/>
<statusCode code=”completed”/>
<effectiveTime>
<low value=”20141120″/>
<high value=”null”/>
</effectiveTime>
<value code=”449868002″ codeSystem=”2.16.840.1.113883.6.96″ displayName=”Current every day smoker” xsi:type=”CD”/>
</observation>
</entry>
</section>
</component>
<component>
<section>
<templateId root=”2.16.840.1.113883.10.20.22.2.4.1″/>
<id extension=”VitalSigns” root=”17eae709-d72c-4b04-a75e-03facbe243d9″/>
<code code=”8716-3″ codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=”Vital signs”/>
<title>Vital Signs</title>
<text>
<table>
<thead>
<tr>
<th>Date / Time</th>
<th>Height</th>
<th>Weight</th>
<th>BMI</th>
<th>BP</th>
</tr>
</thead>
<tbody>
<tr>
<td>20140923</td>
<td>190 in</td>
<td>200 lbs</td>
<td>3.89 NI</td>
<td>220/120</td>
</tr>
</tbody>
</table>
</text>
<entry typeCode=”DRIV”>
<organizer classCode=”CLUSTER” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.26″/>
<id root=”14c09c70-b5b1-470d-9fa4-c5a1e0562681″/>
<code code=”46680005″ codeSystem=”2.16.840.1.113883.6.96″ codeSystemName=”SNOMED-CT” displayName=”Vital signs”/>
<statusCode code=”completed”/>
<effectiveTime value=”20140923″/>
<component>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.27″/>
<id root=”14c09c70-b5b1-470d-9fa4-c5a1e0562681″/>
<code code=”8302-2″ codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=”Height”/>
<statusCode code=”completed”/>
<effectiveTime value=”20140923″/>
<value unit=”in” value=”190″ xsi:type=””/>
</observation>
</component>
<component>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.27″/>
<id root=”14c09c70-b5b1-470d-9fa4-c5a1e0562681″/>
<code code=”3132″ codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=”Weight”/>
<statusCode code=”completed”/>
<effectiveTime value=”20140923″/>
<value unit=”lbs” value=”200″ xsi:type=””/>
</observation>
</component>
<component>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.27″/>
<id root=”14c09c70-b5b1-470d-9fa4-c5a1e0562681″/>
<code code=”39151″ codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=”Body Mass Index”/>
<statusCode code=”completed”/>
<effectiveTime value=”20140923″/>
<value unit=”NI” value=”3.89″ xsi:type=””/>
</observation>
</component>
<component>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.27″/>
<id root=”14c09c70-b5b1-470d-9fa4-c5a1e0562681″/>
<code code=”” codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=””/>
<statusCode code=”completed”/>
<effectiveTime value=”20140923″/>
<value unit=”NI” value=”220″ xsi:type=””/>
</observation>
</component>
<component>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.27″/>
<id root=”14c09c70-b5b1-470d-9fa4-c5a1e0562681″/>
<code code=”” codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=””/>
<statusCode code=”completed”/>
<effectiveTime value=”20140923″/>
<value unit=”NI” value=”120″ xsi:type=””/>
</observation>
</component>
</organizer>
</entry>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

Note : This is a sample data taken from an online open source. You can just google it to find any simple open source CCDA files.

You will get an output like this as follows :

<ClinicalDocument xmlns=”urn:hl7-org:v3″ xmlns:cda=”urn:hl7-org:v3″ xmlns:sdtc=”urn:hl7-org:sdtc” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”&gt;
<realmCode code=”US”/>
<typeId extension=”POCD_HD000040″ root=”2.16.840.1.113883.1.3″/>
<templateId root=”2.16.840.1.113883.10.20.22.1.1″/>

………………………………………….
………………………………………….
………………………………………….

<component>
<section>
<templateId root=”2.16.840.1.113883.10.20.22.2.14″/>
<id extension=”Functional Status” root=”2.201″/>
<code code=”47420-5″ codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=”FUNCTIONAL STATUS”/>
<title>Functional Status</title>
<text>
<table>
<thead>
<tr>
<th>Functional Condition</th>
<th>Effective Dates</th>
<th>Condition Status</th>
</tr>
</thead>
<tbody>
<tr>
<td/>
<td>null</td>
<td>completed</td>
</tr>
</tbody>
</table>
</text>
<entry typeCode=”DRIV”>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.68″/>
<id root=”87347b49-c2ce-4e3e-9bf4-8fe09e9332db”/>
<code code=”” codeSystem=”2.16.840.1.113883.6.96″ displayName=”completed” xsi:type=”CE”/>
<statusCode code=”completed”/>
<effectiveTime>
<low value=”null”/>
<high value=”null”/>
</effectiveTime>
<value code=”” codeSystem=”2.16.840.1.113883.6.96″ displayName=”” xsi:type=”CD”/>
</observation>
</entry>
</section>
</component>
<component>
<section>
<templateId root=”2.16.840.1.113883.10.20.22.2.3.1″/>
<code code=”30954-2″ codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=”RESULTS”/>
<title>Results</title>
<text>
<table>
<thead>
<tr>
<th>Test name</th>
<th>Date</th>
<th>Lab Name</th>
<th>Measure</th>
<th>Units</th>
<th>Reference Range</th>
<th>Lab Value</th>
</tr>
</thead>
<tbody>
<tr>
<td/>
<td>20141015</td>
<td>
<name>Century Hospital</name>
<name>Century Hospital</name>
<name>Century Hospital</name>
<name>Century Hospital</name>
</td>
<td>10^3/ul</td>
<td>10^3/ul</td>
<td> – </td>
<td>220.00</td>
</tr>
</tbody>
</table>
</text>
<entry>
<organizer classCode=”BATTERY” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.1″/>
<id root=”e673e7ec-effc-445c-8d4d-b723ad8327aa”/>
<code code=”43789009″ codeSystem=”2.16.840.1.113883.6.96″ codeSystemName=”SNOMED-CT” displayName=”CBC WO Differential” xsi:type=”CE”/>
<statusCode code=”completed”/>
<component>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.2″/>
<id root=”c6a6491d-c11e-425a-ac72-028cb6624783″/>
<code code=”” codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=””/>
<statusCode code=”completed”/>
<effectiveTime value=”20141015″/>
<value unit=”10^3/ul” value=”220.00″ xsi:type=””/>
<author>
<time value=””/>
<assignedAuthor>
<id root=”c6a6491d-c11e-425a-ac72-028cb6624783″/>
<representedOrganization>
<name>&lt;name xmlns=”urn:hl7-org:v3″&gt;Century Hospital&lt;/name&gt;&lt;name xmlns=”urn:hl7-org:v3″&gt;Century Hospital&lt;/name&gt;&lt;name xmlns=”urn:hl7-org:v3″&gt;Century Hospital&lt;/name&gt;&lt;name xmlns=”urn:hl7-org:v3″&gt;Century Hospital&lt;/name&gt;</name>
</representedOrganization>
</assignedAuthor>
</author>
<referenceRange>
<observationRange>
<value xsi:type=””>
<low unit=”” value=””/>
<high unit=”” value=””/>
</value>
</observationRange>
</referenceRange>
</observation>
</component>
</organizer>
</entry>
</section>
</component>
<component>
<section>
<templateId root=”2.16.840.1.113883.10.20.22.2.17″/>
<id extension=”SocialHistory” root=”17eae709-d72c-4b04-a75e-03facbe243d9″/>
<code code=”29762-2″ codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=”Social history”/>
<title>Social History</title>
<text>
<table>
<thead>
<tr>
<th>Description</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td>Current every day smoker</td>
<td>20141120</td>
</tr>
</tbody>
</table>
</text>
<entry typeCode=”DRIV”>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.78″/>
<id extension=”12345″ root=”2.16.840.1.113883.19″/>
<code code=”ASSERTION” codeSystem=”2.16.840.1.113883.5.4″/>
<statusCode code=”completed”/>
<effectiveTime>
<low value=”20141120″/>
<high value=”null”/>
</effectiveTime>
<value code=”449868002″ codeSystem=”2.16.840.1.113883.6.96″ displayName=”Current every day smoker” xsi:type=”CD”/>
</observation>
</entry>
</section>
</component>
<component>
<section>
<templateId root=”2.16.840.1.113883.10.20.22.2.4.1″/>
<id extension=”VitalSigns” root=”17eae709-d72c-4b04-a75e-03facbe243d9″/>
<code code=”8716-3″ codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=”Vital signs”/>
<title>Vital Signs</title>
<text>
<table>
<thead>
<tr>
<th>Date / Time</th>
<th>Height</th>
<th>Weight</th>
<th>BMI</th>
<th>BP</th>
</tr>
</thead>
<tbody>
<tr>
<td>20140923</td>
<td>190 in</td>
<td>200 lbs</td>
<td>3.89 NI</td>
<td>220/120</td>
</tr>
</tbody>
</table>
</text>
<entry typeCode=”DRIV”>
<organizer classCode=”CLUSTER” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.26″/>
<id root=”14c09c70-b5b1-470d-9fa4-c5a1e0562681″/>
<code code=”46680005″ codeSystem=”2.16.840.1.113883.6.96″ codeSystemName=”SNOMED-CT” displayName=”Vital signs”/>
<statusCode code=”completed”/>
<effectiveTime value=”20140923″/>
<component>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.27″/>
<id root=”14c09c70-b5b1-470d-9fa4-c5a1e0562681″/>
<code code=”8302-2″ codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=”Height”/>
<statusCode code=”completed”/>
<effectiveTime value=”20140923″/>
<value unit=”in” value=”190″ xsi:type=””/>
</observation>
</component>
<component>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.27″/>
<id root=”14c09c70-b5b1-470d-9fa4-c5a1e0562681″/>
<code code=”3132″ codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=”Weight”/>
<statusCode code=”completed”/>
<effectiveTime value=”20140923″/>
<value unit=”lbs” value=”200″ xsi:type=””/>
</observation>
</component>
<component>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.27″/>
<id root=”14c09c70-b5b1-470d-9fa4-c5a1e0562681″/>
<code code=”39151″ codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=”Body Mass Index”/>
<statusCode code=”completed”/>
<effectiveTime value=”20140923″/>
<value unit=”NI” value=”3.89″ xsi:type=””/>
</observation>
</component>
<component>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.27″/>
<id root=”14c09c70-b5b1-470d-9fa4-c5a1e0562681″/>
<code code=”” codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=””/>
<statusCode code=”completed”/>
<effectiveTime value=”20140923″/>
<value unit=”NI” value=”220″ xsi:type=””/>
</observation>
</component>
<component>
<observation classCode=”OBS” moodCode=”EVN”>
<templateId root=”2.16.840.1.113883.10.20.22.4.27″/>
<id root=”14c09c70-b5b1-470d-9fa4-c5a1e0562681″/>
<code code=”” codeSystem=”2.16.840.1.113883.6.1″ codeSystemName=”LOINC” displayName=””/>
<statusCode code=”completed”/>
<effectiveTime value=”20140923″/>
<value unit=”NI” value=”120″ xsi:type=””/>
</observation>
</component>
</organizer>
</entry>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

This is a generalized code, that will remove the vital signs status for any incoming CCDA files. You can just change the template ID of the above provided code and remove any data that you want to remove to achieve this.

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: