Vibin Guevara
Vibin Guevara

Reputation: 826

Develop Repeating XML segments in CCDA Mirth

I was just developing CCDA xml, where I have to generate multiple template ID tags, I don't like to go by the way of defining structure in the outbound templates, so I decided to go by this method.

function data()
{
var clinicalDocument = new XML ("<clinicalDocument></clinicalDocument>");
clinicalDocument['realmCode']['@code']="US";
clinicalDocument['typeId']['@extension']="POCD_HD000040";
clinicalDocument['typeId']['@root']="2.16.840.1.113883.1.3";
clinicalDocument['templateId'][0]['@root']="2.16.840.1.113883.10.20.22.1.1";
clinicalDocument['templateId'][1]['@root']="2.16.840.1.113883.10.20.24.1.1";
clinicalDocument['templateId'][2]['@root']="2.16.840.1.113883.10.20.24.1.2";
clinicalDocument['documentationOf']['serviceEvent']['performer']['assignedEntity']['code']['@codeSystemName']="Healthcare Provider Taxonomy";
clinicalDocument['documentationOf']['serviceEvent']['performer']['assignedEntity']['code']['@displayName']="Adult Medicine";
logger.info("Data : "+clinicalDocument);
}
data();

I cannot develop template id with referring indexes. It says it is undefined. Obviously i cannot loops and counter also for developing output.It says as undefined or error.

I expect output in this format.

<templateId root="2.16.840.1.113883.10.20.22.1.1"/> 
<templateId root="2.16.840.1.113883.10.20.24.1.1"/>
<templateId root="2.16.840.1.113883.10.20.24.1.2"/>

Would be great If I could get some answer on this

Upvotes: 0

Views: 759

Answers (3)

Vibin Guevara
Vibin Guevara

Reputation: 826

I happen to come across this question after a long time. From whatever I have learned so far is constructing the XML messages via Mirth Interface in the way I have posted is not good.

This is because of one major reason: - Performance will be greatly affected as it is Javascript with multiple number of lines and codes will be processed one by one.

Best Practice: The best way is to construct the JAVA .jar library with section-wise functions (i.e Allergies,Medications,Vitals etc) in separate class files as per the business needs and call them via Mirth (Rhino Engine).

please put your thoughts as well..

Upvotes: 1

Shamil
Shamil

Reputation: 940

I agree, there are better ways to create a header for CCDA documents, however, if you'd like to stick with your solution here is the missing part:

var clinicalDocument = new XML ("<clinicalDocument></clinicalDocument>");

clinicalDocument['realmCode']['@code']="US";
clinicalDocument['typeId']['@extension']="POCD_HD000040";
clinicalDocument['typeId']['@root']="2.16.840.1.113883.1.3";

createSegment('templateId', clinicalDocument);
createSegment('templateId', clinicalDocument, 1);
createSegment('templateId', clinicalDocument, 2);

clinicalDocument['templateId'][0]['@root']="2.16.840.1.113883.10.20.22.1.1";
clinicalDocument['templateId'][1]['@root']="2.16.840.1.113883.10.20.24.1.1";
clinicalDocument['templateId'][2]['@root']="2.16.840.1.113883.10.20.24.1.2";

clinicalDocument['documentationOf']['serviceEvent']['performer']['assignedEntity']['code']['@codeSystemName']="Healthcare Provider Taxonomy";
clinicalDocument['documentationOf']['serviceEvent']['performer']['assignedEntity']['code']['@displayName']="Adult Medicine";

logger.info("Data : "+clinicalDocument);

Upvotes: 1

I am not an expert on Mirth, but yes I have experience on working with CDA. My advise is that (if possible with Mirth) you use XSLT to build or transform a CDA, it is the best and more efficient way.

Hope useful.

Upvotes: 0

Related Questions