From dddfae5fa4b47f5d1805abed64752b2993d83b45 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Mon, 27 Sep 2021 18:35:08 -0400 Subject: [PATCH 1/8] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d63951b..734f7cf 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.sitenv referenceccdavalidator - 1.0.60 + 1.0.61-SNAPSHOT war Reference CCDA Validator From be844f495f72baae0c3954c05ab8c8007a6d961d Mon Sep 17 00:00:00 2001 From: Sean Muir Date: Fri, 15 Oct 2021 11:55:16 -0400 Subject: [PATCH 2/8] Updates for missing SDTC extensions Modified core MDHT library Added test and junit Added log4j in test folder to use local target as location for log file --- pom.xml | 7 ++- .../referenceccda/test/tests/RefCCDATest.java | 61 ++++++++++++++++++- src/test/resources/SDTCExtensionsTest.xml | 49 +++++++++++++++ src/test/resources/log4j.xml | 32 ++++++++++ 4 files changed, 143 insertions(+), 6 deletions(-) create mode 100644 src/test/resources/SDTCExtensionsTest.xml create mode 100644 src/test/resources/log4j.xml diff --git a/pom.xml b/pom.xml index 734f7cf..2f264af 100644 --- a/pom.xml +++ b/pom.xml @@ -15,9 +15,10 @@ latestVersion latestVersion - 3.0.0.20210924 - ${mdht.models.version} - 3.0.0.202109230500 + 3.0.0.20211012 + ${mdht.models.version} + 3.0.0.202110121523 + diff --git a/src/test/java/org/sitenv/referenceccda/test/tests/RefCCDATest.java b/src/test/java/org/sitenv/referenceccda/test/tests/RefCCDATest.java index 4eb22ef..b8bfcb1 100644 --- a/src/test/java/org/sitenv/referenceccda/test/tests/RefCCDATest.java +++ b/src/test/java/org/sitenv/referenceccda/test/tests/RefCCDATest.java @@ -1,6 +1,8 @@ package org.sitenv.referenceccda.test.tests; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.sitenv.referenceccda.test.other.ReferenceValidationLogger.printResults; import static org.sitenv.vocabularies.test.other.ValidationLogger.println; @@ -14,13 +16,19 @@ import java.util.Arrays; import java.util.List; +import org.apache.commons.io.IOUtils; import org.apache.log4j.BasicConfigurator; +import org.eclipse.mdht.uml.cda.ClinicalDocument; +import org.eclipse.mdht.uml.cda.Patient; +import org.eclipse.mdht.uml.cda.Person; +import org.eclipse.mdht.uml.cda.Subject; +import org.eclipse.mdht.uml.cda.SubjectPerson; +import org.eclipse.mdht.uml.cda.util.CDAUtil; import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.sitenv.contentvalidator.service.ContentValidatorService; -import org.sitenv.referenceccda.controllers.ReferenceCCDAValidationController; import org.sitenv.referenceccda.dto.ValidationResultsDto; import org.sitenv.referenceccda.services.ReferenceCCDAValidationService; import org.sitenv.referenceccda.test.other.ReferenceValidationLogger; @@ -65,7 +73,7 @@ public class RefCCDATest extends ReferenceValidationTester implements Validation SUB_SOCIAL_HISTORY_WITH_BIRTH_SEX_OBS_TEMPLATE_SITE_3094 = 15, SUB_PROCEDURES_WITH_DEVICE_IDENTIFIER_OBSERVATION_SITE_3218 = 16, SUB_PROCEDURES_WITH_DEVICE_IDENTIFIER_OBSERVATION_BAD_VALUE_ROOT_SITE_3218 = 17, - DS4P_REFRAIN_OBSERVATION = 18,IVL_REAL_EXAMPLE=19,IVL_REAL_EXAMPLE2=20,REFERRAL_NOTE=21,REFERRAL_NOTE2=22; + DS4P_REFRAIN_OBSERVATION = 18,IVL_REAL_EXAMPLE=19,IVL_REAL_EXAMPLE2=20,REFERRAL_NOTE=21,REFERRAL_NOTE2=22,SDTCTEST=23; // Feel free to add docs to the end but don't alter existing data @@ -95,7 +103,8 @@ public class RefCCDATest extends ReferenceValidationTester implements Validation RefCCDATest.class.getResource("/ivl_real_example.xml").toURI(), RefCCDATest.class.getResource("/ivl_real_example2.xml").toURI(), RefCCDATest.class.getResource("/ReferralNote.xml").toURI(), - RefCCDATest.class.getResource("/ReferralNote2.xml").toURI() + RefCCDATest.class.getResource("/ReferralNote2.xml").toURI(), + RefCCDATest.class.getResource("/SDTCExtensionsTest.xml").toURI() }; } catch (URISyntaxException e) { @@ -807,6 +816,52 @@ public void referralnoteindparticipantname_ExpectPassTest() { } + /** + * parseSDTCExtensionsTest test for the ability to parse extensions + * Do not see much need to have negative tests + * + * @throws IOException + * @throws Exception + */ + @Test + public void parseSDTCExtensionsTest() throws IOException, Exception { + ClinicalDocument sdtcTestDocument = CDAUtil.load(IOUtils.toInputStream(convertCCDAFileToString(CCDA_FILES[SDTCTEST]), "UTF-8")); + assertNotNull("sdtcTestDocument.getSDTCStatusCode",sdtcTestDocument.getSDTCStatusCode()); + assertEquals("sdtcTestDocument.getSDTCStatusCode","ClinicalDocumentStatusCode",sdtcTestDocument.getSDTCStatusCode().getCode()); + Patient patient = sdtcTestDocument.getRecordTargets().get(0).getPatientRole().getPatient(); + assertFalse("patient.getSDTCEthnicGroupCodes",patient.getSDTCEthnicGroupCodes().isEmpty()); + assertEquals("patient.getSDTCEthnicGroupCodes","PatientEthnicGroupCode",patient.getSDTCEthnicGroupCodes().get(0).getCode()); + assertFalse("patient.getSDTCRaceCodes",patient.getSDTCRaceCodes().isEmpty()); + assertEquals("patient.getSDTCRaceCodes","PateintRaceCode",patient.getSDTCRaceCodes().get(0).getCode()); + assertFalse( "patient.getSDTCDeceasedInd" , patient.getSDTCDeceasedInd().getValue() ); + assertNotNull("patient.getSDTCDeceasedTime",patient.getSDTCDeceasedTime()); + assertEquals("patient.getSDTCDeceasedTime","1900",patient.getSDTCDeceasedTime().getValue()); + assertNotNull("patient.getSDTCDesc",patient.getSDTCDesc()); + assertEquals("patient.getSDTCDesc","PatientDescription",patient.getSDTCDesc().getText()); + assertTrue("patient.getSDTCMultipleBirthInd",patient.getSDTCMultipleBirthInd().getValue()); + assertNotNull("patient.getSDTCMultipleBirthOrderNumber",patient.getSDTCMultipleBirthOrderNumber()); + assertEquals("patient.getSDTCMultipleBirthOrderNumber","3",patient.getSDTCMultipleBirthOrderNumber().getValue().toString()); + Person person = sdtcTestDocument.getAuthors().get(0).getAssignedAuthor().getAssignedPerson(); + assertNotNull("person.getSDTCAsPatientRelationship",person.getSDTCAsPatientRelationship()); + assertEquals("person.getSDTCAsPatientRelationship","AsPatientRelationship",person.getSDTCAsPatientRelationship().getText()); + assertNotNull("person.getSDTCDesc",person.getSDTCDesc()); + assertEquals("person.getSDTCDesc","PersonDescription",person.getSDTCDesc().getText()); + SubjectPerson subjectPerson = sdtcTestDocument.getSections().get(0).getSubject().getRelatedSubject().getSubject(); + assertFalse("subjectPerson.getSDTCEthnicGroupCodes",subjectPerson.getSDTCEthnicGroupCodes().isEmpty()); + assertEquals("subjectPerson.getSDTCEthnicGroupCodes","SubjectEthnicGroupCode",subjectPerson.getSDTCEthnicGroupCodes().get(0).getCode()); + assertFalse("subjectPerson.getSDTCRaceCodes",subjectPerson.getSDTCRaceCodes().isEmpty()); + assertEquals("subjectPerson.getSDTCRaceCodes","SubjectRaceCode",subjectPerson.getSDTCRaceCodes().get(0).getCode()); + assertTrue( "subjectPerson.getSDTCDeceasedInd" , subjectPerson.getSDTCDeceasedInd().getValue() ); + assertNotNull("subjectPerson.getSDTCDeceasedTime",subjectPerson.getSDTCDeceasedTime()); + assertEquals("subjectPerson.getSDTCDeceasedTime","1900",subjectPerson.getSDTCDeceasedTime().getValue()); + assertNotNull("subjectPerson.getSDTCDesc",subjectPerson.getSDTCDesc()); + assertEquals("subjectPerson.getSDTCDesc","SubjectDescription",subjectPerson.getSDTCDesc().getText()); + assertTrue("subjectPerson.getSDTCMultipleBirthInd",subjectPerson.getSDTCMultipleBirthInd().getValue()); + assertNotNull("subjectPerson.getSDTCMultipleBirthOrderNumber",subjectPerson.getSDTCMultipleBirthOrderNumber()); + assertEquals("subjectPerson.getSDTCMultipleBirthOrderNumber","3",subjectPerson.getSDTCMultipleBirthOrderNumber().getValue().toString()); + } + + private static List getGenericConfiguredExpressionsForTesting() { final String validationMessage = "Will always fail"; final String configuredXpathExpression = "//v3:informant/v3:relatedEntity/v3:relatedPerson/v3:name"; diff --git a/src/test/resources/SDTCExtensionsTest.xml b/src/test/resources/SDTCExtensionsTest.xml new file mode 100644 index 0000000..7688e36 --- /dev/null +++ b/src/test/resources/SDTCExtensionsTest.xml @@ -0,0 +1,49 @@ + + + + + + + PatientDescription + + + + + + + + + + + + + PersonDescription + AsPatientRelationship + + + + + + + +
+ + + + + + SubjectDescription + + + + + + + + + +
+
+
+
+
\ No newline at end of file diff --git a/src/test/resources/log4j.xml b/src/test/resources/log4j.xml new file mode 100644 index 0000000..eb05566 --- /dev/null +++ b/src/test/resources/log4j.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From a08062b10b58b8f87183cdf44f3842c467a8f438 Mon Sep 17 00:00:00 2001 From: Sean Muir Date: Wed, 20 Oct 2021 09:37:09 -0700 Subject: [PATCH 3/8] Updates for errata SITE-3348 Update MDHT library Add junit test noteActivity_expectfailtest Added sample resource --- pom.xml | 2 +- .../referenceccda/test/tests/RefCCDATest.java | 19 +- src/test/resources/ConsolNoteActivity.xml | 515 ++++++++++++++++++ 3 files changed, 532 insertions(+), 4 deletions(-) create mode 100644 src/test/resources/ConsolNoteActivity.xml diff --git a/pom.xml b/pom.xml index 2f264af..7aa79d6 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,7 @@ latestVersion latestVersion - 3.0.0.20211012 + 3.0.0.20211018 ${mdht.models.version} 3.0.0.202110121523 diff --git a/src/test/java/org/sitenv/referenceccda/test/tests/RefCCDATest.java b/src/test/java/org/sitenv/referenceccda/test/tests/RefCCDATest.java index b8bfcb1..8ee6f6f 100644 --- a/src/test/java/org/sitenv/referenceccda/test/tests/RefCCDATest.java +++ b/src/test/java/org/sitenv/referenceccda/test/tests/RefCCDATest.java @@ -57,7 +57,7 @@ public class RefCCDATest extends ReferenceValidationTester implements Validation private static final boolean LOG_RESULTS_TO_CONSOLE = true; - private static final boolean SHOW_ERRORS_ONLY = true; + private static boolean SHOW_ERRORS_ONLY = true; private static final boolean LOG_LOG4J = true; static { if (LOG_LOG4J) { @@ -73,7 +73,7 @@ public class RefCCDATest extends ReferenceValidationTester implements Validation SUB_SOCIAL_HISTORY_WITH_BIRTH_SEX_OBS_TEMPLATE_SITE_3094 = 15, SUB_PROCEDURES_WITH_DEVICE_IDENTIFIER_OBSERVATION_SITE_3218 = 16, SUB_PROCEDURES_WITH_DEVICE_IDENTIFIER_OBSERVATION_BAD_VALUE_ROOT_SITE_3218 = 17, - DS4P_REFRAIN_OBSERVATION = 18,IVL_REAL_EXAMPLE=19,IVL_REAL_EXAMPLE2=20,REFERRAL_NOTE=21,REFERRAL_NOTE2=22,SDTCTEST=23; + DS4P_REFRAIN_OBSERVATION = 18,IVL_REAL_EXAMPLE=19,IVL_REAL_EXAMPLE2=20,REFERRAL_NOTE=21,REFERRAL_NOTE2=22,SDTCTEST=23,CONSOLNOTEACTIVITY=24; // Feel free to add docs to the end but don't alter existing data @@ -104,7 +104,9 @@ public class RefCCDATest extends ReferenceValidationTester implements Validation RefCCDATest.class.getResource("/ivl_real_example2.xml").toURI(), RefCCDATest.class.getResource("/ReferralNote.xml").toURI(), RefCCDATest.class.getResource("/ReferralNote2.xml").toURI(), - RefCCDATest.class.getResource("/SDTCExtensionsTest.xml").toURI() + RefCCDATest.class.getResource("/SDTCExtensionsTest.xml").toURI(), + RefCCDATest.class.getResource("/ConsolNoteActivity.xml").toURI() + }; } catch (URISyntaxException e) { @@ -815,6 +817,17 @@ public void referralnoteindparticipantname_ExpectPassTest() { failIfIssueIsInResults(results, ValidationResultType.CCDA_MDHT_CONFORMANCE_ERROR, "CONF:1198-31645"); } + /* + * SITE-3348 ETT GG, Errata CDA-2008, MDHT: "A plethora of b.1 issues that we think are invalid" + */ + @Test + public void noteActivity_expectfailtest() { + List results = validateDocumentAndReturnResults( + convertCCDAFileToString(CCDA_FILES[CONSOLNOTEACTIVITY]), CCDATypes.NON_SPECIFIC_CCDAR2); + passIfIssueIsInResults(results, ValidationResultType.CCDA_MDHT_CONFORMANCE_WARN, "3250-16940, 3250-1694"); + } + + /** * parseSDTCExtensionsTest test for the ability to parse extensions diff --git a/src/test/resources/ConsolNoteActivity.xml b/src/test/resources/ConsolNoteActivity.xml new file mode 100644 index 0000000..92e4fbe --- /dev/null +++ b/src/test/resources/ConsolNoteActivity.xml @@ -0,0 +1,515 @@ + + + + + + + + + + + Continuity of Care Document (C-CDA R2.1) + + + + + + + + 1357 Amber Dr + Beaverton + OR + 97006 + US + + + + + + + Newman + Alice + Jones + + + Newman + Alicia + + + + + + + + + + + + + + + + Neighborhood Physicians Practice + + + 2472 Rocky Place + Beaverton + OR + 97006 + US + + + + + + + + + + + + + + + + + Admin + NEXTGEN + + + + + + Neighborhood Physicians Practice + + + 2472 Rocky Place + Beaverton + OR + 97006 + US + + + + + + + + + + Neighborhood Physicians Practice + + + 2472 Rocky Place + Beaverton + OR + 97006 + US + + + + + + + + + + + + + + + + 2472 Rocky Place + Beaverton + OR + 97006 + + + + + Allison + Kristin + + + + + + + + + + Davis + Albert + + + + + + + + + + + + + + + + 1 Jarrett White Rd + Tripler Army Medical Center + HI + 96859-5000 + US + + + + + TerryThisIsAReallyLongFi + HoitzThisIsAReallyLongLa + + + + + + + + + +
+ + + + + + Procedures + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ProcedureUniversal Device Identifier/Device IdentifierDate
+ Nebulizer Therapy + + + + Jun-22-2015 +
+ Introduction of cardiac pacemaker system via + vein + + + CRT-D DTBA1QQ VIVA QUAD XT US IS4/DF4 - + (01)00643169007222(17)160128(21)BLC200461H + + + Oct-05-2011 +
+ OFFICE/OUTPATIENT VISIT, EST + + + + Mar-04-2020 +
+ OFFICE/OUTPATIENT VISIT, EST + + + + Feb-28-2020 +
+ + + + + + + + + + + + + +
Procedure Clinical NoteDate
+ Dr Albert Davis examined Ms Alice Newman and found that + the pacemaker is operating properly and the + breathlessness is due to high fever and + anxiety. + + Jan-25-2021 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
From b7ae425beb2c019a6155b1791784508aefaf85aa Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Wed, 20 Oct 2021 15:01:54 -0400 Subject: [PATCH 4/8] Update RefCCDATest.java --- .../java/org/sitenv/referenceccda/test/tests/RefCCDATest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/sitenv/referenceccda/test/tests/RefCCDATest.java b/src/test/java/org/sitenv/referenceccda/test/tests/RefCCDATest.java index 8ee6f6f..266b71b 100644 --- a/src/test/java/org/sitenv/referenceccda/test/tests/RefCCDATest.java +++ b/src/test/java/org/sitenv/referenceccda/test/tests/RefCCDATest.java @@ -57,7 +57,7 @@ public class RefCCDATest extends ReferenceValidationTester implements Validation private static final boolean LOG_RESULTS_TO_CONSOLE = true; - private static boolean SHOW_ERRORS_ONLY = true; + private static final boolean SHOW_ERRORS_ONLY = true; private static final boolean LOG_LOG4J = true; static { if (LOG_LOG4J) { From 90e47708a38497b505009c37cc8cadd6c76e5240 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Wed, 20 Oct 2021 15:05:00 -0400 Subject: [PATCH 5/8] Remove notes irrelevant to test --- src/test/resources/ConsolNoteActivity.xml | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/test/resources/ConsolNoteActivity.xml b/src/test/resources/ConsolNoteActivity.xml index 92e4fbe..e046a5f 100644 --- a/src/test/resources/ConsolNoteActivity.xml +++ b/src/test/resources/ConsolNoteActivity.xml @@ -417,12 +417,11 @@ - + - @@ -432,19 +431,8 @@ - - - - - + -