0

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

Vibin Guevara
  • 778
  • 10
  • 27

3 Answers3

1

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);
Shamil
  • 910
  • 4
  • 17
1

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..

Vibin Guevara
  • 778
  • 10
  • 27
0

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.

Marti Pàmies Solà
  • 611
  • 1
  • 6
  • 12
  • Just curious to know from your end, is it possible to develop CDA from XSLT?, from my knowledge XSLT is a XML style sheet right?, Please correct me if I'm wrong and would be great if you provide some sample as well. – Vibin Guevara Sep 16 '16 at 12:06
  • XSLT stands for XSL Transformations. So basically you define an XSLT file and pass required XML feed to this file to consume with all required data. Among others I also prefer this way. Check my profile to find a link to samples. – Shamil Sep 16 '16 at 17:18
  • Hi Vibin, as posted by user3005941, we use XSLT to transform input XML documents that contains "raw data" form our customers, to HL7 CDA documents. What you have to defines is an XML schema for your input data and implement the XSLT. – Marti Pàmies Solà Sep 19 '16 at 15:51