Using CDAUtil's Load [message #1771018] |
Mon, 21 August 2017 04:22  |
Eclipse User |
|
|
|
Hello Community,
I have downloaded MDHT Runtimes from the following location.
LINK:
github.com/mdht/mdht-models
/releases/download/v3.0.0.20170725_Consol2/MDHT_CCDA_R2.1_R1.1_MU2_20170725_build.zip
I believe they are the latest Runtimes (as it shows version 3.0.0.xxx).
After that, I followed the examples provided in the following page:
www.cdatools.com/docs/
developeruserguide/org.openhealthtools.mdht.cda.doc.developerguide/tasks/t_Consume_CDA.html
The following code throws a ClassCastException as already discussed in a different post in the MDHT community forum. (Google for 'eclipse ClinicalDocumentImpl cannot be cast ContinuityOfCareDocument' and the first result is the topic I am talking about).
ContinuityOfCareDocument ccdDocument1 =
(ContinuityOfCareDocument) CDAUtil.load(new FileInputStream("/tmp/SampleCCDDocument.xml"), result);
java.lang.ClassCastException: org.eclipse.mdht.uml.cda.impl.ClinicalDocumentImpl cannot be cast to org.openhealthtools.mdht.uml.cda.consol.ContinuityOfCareDocument
So, I tried to do this instead:
ClinicalDocument ccdDocument = (ClinicalDocument) CDAUtil
.load(new FileInputStream("/tmp/SampleCCDDocument.xml"), result);
This compiled/ran fine without any exceptions and I am able to get the list of document sections, their codes etc... as shown in the following code.
EList<Section> sections = ccdDocument.getAllSections();
System.out.println("# of sections (==> " + sections.size());
for (Section sec : sections) {
System.out.println("Section code ==> " + sec.getCode().getCode() + ", # of entries ==> "
+ sec.getEntries().size() + ", class code ==> " + sec.getClassCode().getName()
+ ", template ID ==> " + sec.getTemplateIds().get(0) + ", type ID ==>" + sec.getTypeId()
+ ", title ==> " + sec.getTitle());
}
But, on the other hand, querying for a specific section does not return anything.
Query query = new Query(ccdDocument);
AdvanceDirectivesSection section = query.getSection(AdvanceDirectivesSection.class);
FYI, I am following the examples provided in the link below to query for a specific document section:
LINK:
www.cdatools.com
/docs/developeruserguide/org.openhealthtools.mdht.cda.doc.developerguide/tasks/t_Query_CDA.html
Please see the sample CCD document I am using for this Query exercise.
Please let me know if I am missing anything. I would like to use the MDHT API to parse the CDA documents.
regards,
Karthik
|
|
|
|
|
|
|
Re: Using CDAUtil's Load [message #1773451 is a reply to message #1771367] |
Wed, 27 September 2017 23:46  |
Eclipse User |
|
|
|
HI Karthik,
The consolidated (you can look it up) CDA is the way to go; plus use loadAs method of CDAUtil
So something like
ContinuityOfCareDocument ccd = (ContinuityOfCareDocument) CDAUtil.loadAs(dataHandler.getInputStream() /*or whatever inputstream you have*/
, ConsolPackage.eINSTANCE.getContinuityOfCareDocument());
|
|
|
Powered by
FUDForum. Page generated in 0.04211 seconds