Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Model Driven Health Tools » CDAUtil.save() Creating Invalid Document(CCDA Validation)
CDAUtil.save() Creating Invalid Document [message #1797051] Wed, 24 October 2018 12:55 Go to next message
Frank Szofran is currently offline Frank SzofranFriend
Messages: 1
Registered: October 2018
Junior Member
I'm loading one of the ccda test master files and validating it using MDHT-models release 3.0.8.20180531. That works fine; I get the expected warnings. However, if I load the same file, save it using CDAUtil.save() then validate it, it contains multiple errors and warnings. The same occurs if I validate the document using the TTP validator.

This works fine, there are no errors in the document
//create the validator
ReferenceCCDAValidator validator = new ReferenceCCDAValidator();
        
//load a valid document into a string
byte[] data = FileUtils.getFileData(new File("c:/temp/170.315_b5_toc_amb_ccd_r11_sample1_v8.xml"));
String xmlString = new String(data);
        
//validate it
List<RefCCDAValidationResult> results = validator.validateFile("C-CDA_IG_Plus_Vocab", null, xmlString);


The document created here contains errors
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
        
        //load the document
        FileInputStream in = new FileInputStream(new File("c:/temp/170.315_b5_toc_amb_ccd_r11_sample1_v8.xml"));
        Document doc = docBuilder.parse(in);
        ClinicalDocument cda = CDAUtil.load(doc);
        
        //save the document
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        CDAUtil.save(cda, out);
        String xmlString = out.toString();
        FileUtils.setFileData(new File("c:/temp/test_ccda.xml"), out.toByteArray());
        
        //validate it
        ReferenceCCDAValidator validator = new ReferenceCCDAValidator();
        List<RefCCDAValidationResult> results = validator.validateFile("C-CDA_IG_Plus_Vocab", null, xmlString);


Here are some of the erors:
 Error -

cvc-type.2: The type definition cannot be abstract for element value.

Line number: Line number not available
Error -

cvc-complex-type.3.2.2: Attribute 'code' is not allowed to appear in element 'value'.

Line number: Line number not available
Error -

cvc-complex-type.3.2.2: Attribute 'codeSystem' is not allowed to appear in element 'value'.

Line number: Line number not available
Error -

cvc-complex-type.3.2.2: Attribute 'displayName' is not allowed to appear in element 'value'.

Line number: Line number not available
Error -

cvc-type.2: The type definition cannot be abstract for element value.

Line number: Line number not available 


It appears that CCDA.save() is saving some of the elements out of order according to the schema. I've attached the saved document.

Thanks

Frank
  • Attachment: test_ccda.xml
    (Size: 64.18KB, Downloaded 221 times)
Re: CDAUtil.save() Creating Invalid Document [message #1797309 is a reply to message #1797051] Mon, 29 October 2018 18:37 Go to previous message
Sean Muir is currently offline Sean MuirFriend
Messages: 64
Registered: September 2015
Member
First thing i noticed is the xsi type is being dropped when being re - saved not sure why that would be

original
<value xsi:type="PQ" value="86" unit="mm[Hg]" />

saved
<value value="86" unit="mm[Hg]" />

[Updated on: Mon, 29 October 2018 18:38]

Report message to a moderator

Previous Topic:Maven repo unavailable
Next Topic:VDT Summary - Diagnostic Image Report
Goto Forum:
  


Current Time: Fri Dec 06 21:13:56 GMT 2024

Powered by FUDForum. Page generated in 0.02958 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top