How to parse Allergy Contents of a NIST validated CCD?

Hi Everyone,

Here is another Continuity of Care Document post. In this blog post I will provide you the code that can we used to parse the Allergy Section of a NIST validated CCD. This CCD will is a NIST standard validated CCD. You can refer this link for the NIST validation tool

Allergy Section:

An Allergy section in the CCD document will contain the following details:

  1. Allergy substance (Allergy causing substance – Medication for patients)
  2. Reaction for Allergy (What reaction the substance causes)
  3. Start date of the allergy
  4. End date of the allergy

 

/* Parse Allergy Section of CCD */
var component = msg[‘component’][‘structuredBody’][‘component’];
// Loop through the <component>
for (i = 0; i < component.length(); i++) {
// 2.16.840.1.113883.10.20.22.4.30 – OID for Allergy section
var getAllergyTemplateId = component[i][‘section’][‘templateId’][‘@root’].toString();
if ((getAllergyTemplateId != null) && (getAllergyTemplateId != ”)) {
// Patient will be allergic to various substance (multiple <entry>)
var entries = component[i][‘section’][‘entry’];
for (j = 0; j < entries.length(); j++) {
// <participant> contains the substance causing allergy
var participant = entries[j][‘act’][‘entryRelationship’][‘observation’][‘participant’];
// <participant><playingEntity> may occur in multiple places so check for ”
if (((participant != null) || (participant != undefined)) && (participant[‘participantRole’][‘playingEntity’][‘name’].toString() != ”)) {
substaceForAllergy = participant[‘participantRole’][‘playingEntity’][‘name’].toString();
logger.debug(“Allergy Substance : ” + substaceForAllergy);
}
var entryRelations = entries[j][‘act’][‘entryRelationship’][‘observation’][‘entryRelationship’];
// Within each <entry> there will be multiple <entryRelationship>
for (k = 0; k < entryRelations.length(); k++) {
if ((entryRelations[k][‘observation’] != null) || (entryRelations[k][‘observation’] != undefined)) {
// 2.16.840.1.113883.10.20.22.4.28 – OID specific for Allergy Status
if (entryRelations[k][‘observation’][‘templateId’][‘@root’].toString() == ‘2.16.840.1.113883.10.20.22.4.28’) {
allergyStatus = entryRelations[k][‘observation’][‘value’][‘@displayName’].toString();
logger.debug(“reaction Status: ” + allergyStatus);
}
// 2.16.840.1.113883.10.20.22.4.9 – OID specific for Allergy Reaction
if ((entryRelations[k][‘observation’][‘text’].toString() != ”) && (entryRelations[k][‘observation’][‘templateId’][‘@root’].toString() == “2.16.840.1.113883.10.20.22.4.9”)) {
// Fetches <text> along with <reference>
var getAllergyReaction = entryRelations[k][‘observation’][‘text’].toString();
// remove <reference>
var splitReferenceTag = getAllergyReaction.split(‘<‘);
// remove <text xmlns=”> namespace
var splitTextTag = splitReferenceTag[1].split(‘>’);
// Get only reaction for specific allergy
reactionForAllergy = splitTextTag[1];
logger.debug(“Allergy Reaction : ” + reactionForAllergy);
// Allergy start Date
if (entryRelations[k][‘observation’][‘effectiveTime’][‘low’][‘@value’].toString() != ”) {
var reactionStartDate = entryRelations[k][‘observation’][‘effectiveTime’][‘low’][‘@value’].toString();
//logger.debug(“reaction Start Date: ” + reactionStartDate);
}
// Allergy End Date
if (entryRelations[k][‘observation’][‘effectiveTime’][‘high’][‘@value’].toString() != ”) {
var reactionEndDate = entryRelations[k][‘observation’][‘effectiveTime’][‘high’][‘@value’].toString();
//logger.debug(“reaction End Date: ” + reactionEndDate);
}
}
}
}
}
}
}

Advertisements

HL7v3 Vs CCR Vs CCD Vs CCDA

What is HL7v3 Standard?

The HL7v3 standard is basically a XML messaging format. Developed to bring in the complete medical record/history of a patient.The HL7v3 standard includes both messaging and document standards. The document standard for HL7 v3 is CDA.

What is Continuity of Care Record (CCR) ?

The CCR started out as a three-page paper document which was used in patient care referrals. It was created by the Massachusetts Department of Public Health, and included all the information that was necessary for providers to effectively continue care.

Relation Between CCR & CCD ?

Since CCR is very successful document in the transfer of care scenario, the Massachusetts Department of Public Health teamed up with ASTM and the Massachusetts Medical Society to create an electronic version of CCR That is nothing but CCD.

What is Continuity of Care Document (CCD) ?

CCD stands for Continuity of Care Document and it is based on the HL7 CDA architecture. CDA, or Clinical Document Architecture, is a document standard governed by the HL7 organization. The HL7v3 standard includes both messaging and document standards. The document standard for HL7 v3 is CDA, and one of the documents within the CDA architecture is CCD.

What Does CCD contain ?

A CCD document is not intended to give a complete medical history for a patient. It is intended to include only the information critical to effectively continue care. For example consider a patient is moving from one hospital to another for better treatment or care, then in that case what are all the details that the new facility needs to understand about the patient will be specified in CCD.

General 17 sections used in typical CCD document:

  • Header
  • Allergies
  • Problems
  • Procedures
  • Family history
  • Social history
  • Payers
  • Advance directives
  • Medications
  • Immunizations
  • Medical equipment
  • Vital signs
  • Functional stats
  • Results
  • Encounters
  • Plan of care

List of CCDA provided by HL7 standard:

  • Continuity of Care Document
  • Consultation Notes
  • Discharge Summary
  • Imaging Integration, and DICOM Diagnostic Imaging Reports
  • History and Physical
  • Operative Note
  • Progress Note
  • Procedure Note
  • Unstructured Documents

Blog at WordPress.com.

Up ↑