Updates to stdc test
modified XML
updated unit test
fixed build issue
diff --git a/cda/tests/org.eclipse.mdht.uml.cda.test/resources/CCDA_CCD_b1_Amb_SDTC.xml b/cda/tests/org.eclipse.mdht.uml.cda.test/resources/CCDA_CCD_b1_Amb_SDTC.xml
index 948fdb7..c346bcb 100644
--- a/cda/tests/org.eclipse.mdht.uml.cda.test/resources/CCDA_CCD_b1_Amb_SDTC.xml
+++ b/cda/tests/org.eclipse.mdht.uml.cda.test/resources/CCDA_CCD_b1_Amb_SDTC.xml
@@ -252,8 +252,6 @@
<family>Seven</family>
</name>
- <!--base model placement of sdtc:birthTime-->
- <sdtc:birthTime value="19880907"/>
</assignedPerson>
</assignedAuthor>
@@ -649,6 +647,23 @@
******************************************************** -->
<component>
<structuredBody>
+
+ <component>
+ <section>
+ <entry>
+ <observation>
+ <participant>
+ <participantRole>
+ <playingEntity>
+ <sdtc:birthTime value="19880907"/>
+ </playingEntity>
+ </participantRole>
+ </participant>
+ </observation>
+ </entry>
+ </section>
+ </component>
+
<!-- *********************** -->
<!--
diff --git a/cda/tests/org.eclipse.mdht.uml.cda.test/src/test/java/org/eclipse/mdht/uml/cda/tests/SDTCExtensionTest.java b/cda/tests/org.eclipse.mdht.uml.cda.test/src/test/java/org/eclipse/mdht/uml/cda/tests/SDTCExtensionTest.java
index 33974f1..ee33708 100644
--- a/cda/tests/org.eclipse.mdht.uml.cda.test/src/test/java/org/eclipse/mdht/uml/cda/tests/SDTCExtensionTest.java
+++ b/cda/tests/org.eclipse.mdht.uml.cda.test/src/test/java/org/eclipse/mdht/uml/cda/tests/SDTCExtensionTest.java
@@ -30,6 +30,7 @@
import org.eclipse.mdht.uml.cda.LegalAuthenticator;
import org.eclipse.mdht.uml.cda.Observation;
import org.eclipse.mdht.uml.cda.Organizer;
+import org.eclipse.mdht.uml.cda.Participant2;
import org.eclipse.mdht.uml.cda.Patient;
import org.eclipse.mdht.uml.cda.PatientRole;
import org.eclipse.mdht.uml.cda.Person;
@@ -272,20 +273,37 @@
}
/**
+ *
+ * <component>
+ <section>
+ <entry>
+ <observation>
+ <participant>
+ <participantRole>
+ <playingEntity>
+ <sdtc:birthTime value="2021"/>
+ </playingEntity>
+ </participantRole>
+ </participant>
+ </observation>
+ </entry>
+ </section>
+ </component>
* Helper method: Locates sdtc:birthTime in a deserialized document and extracts the TS data.
*/
private TS extractBirthTimeTSData(ClinicalDocument doc) {
TS tsToReturn = null;
-
- for (Author auth : doc.getAuthors()) {
- if (auth.getAssignedAuthor() != null) {
- AssignedAuthor aAuth = auth.getAssignedAuthor();
- if (aAuth.getAssignedPerson() != null) {
- Person aPers = aAuth.getAssignedPerson();
- if (aPers.getSDTCBirthTime() != null) {
- tsToReturn = aPers.getSDTCBirthTime();
- break;
+ for (Section section : doc.getSections()) {
+ for (Observation obsevation : section.getObservations()) {
+ for (Participant2 p2 : obsevation.getParticipants()) {
+ if (p2.getParticipantRole() != null) {
+ if (p2.getParticipantRole().getPlayingEntity() != null) {
+ if (p2.getParticipantRole().getPlayingEntity().getSDTCBirthTime() != null) {
+ return p2.getParticipantRole().getPlayingEntity().getSDTCBirthTime();
+ }
+ }
}
+
}
}
}
@@ -607,34 +625,34 @@
/**
* Ensures a generated document instance with sdtc:birthTime can be properly serialized.
*/
- @Test
- public void testBirthTimeSerializationOfGeneratedDoc() {
- ClinicalDocument clinicalDocument = CDAFactory.eINSTANCE.createClinicalDocument();
- Section section = CDAFactory.eINSTANCE.createSection();
-
- Observation obs = CDAFactory.eINSTANCE.createObservation();
- Author auth = CDAFactory.eINSTANCE.createAuthor();
- AssignedAuthor asAuth = CDAFactory.eINSTANCE.createAssignedAuthor();
- Person asPerson = CDAFactory.eINSTANCE.createPerson();
-
- TS birthTS = DatatypesFactory.eINSTANCE.createTS();
- birthTS.setValue("19820607");
- asPerson.setSDTCBirthTime(birthTS);
- asAuth.setAssignedPerson(asPerson);
- auth.setAssignedAuthor(asAuth);
- obs.getAuthors().add(auth);
- section.addObservation(obs);
- clinicalDocument.addSection(section);
-
- if (!serializeDocument(
- clinicalDocument, "\n\n---testBirthTimeSerializationOfGeneratedDoc extension document serialization---")) {
- fail("Unable to save/serialize sdtc:birthTime within a generated document.");
- }
-
- // check after serialization that sdtc specific properties are the same
- assertEquals(
- "The TS value has changed after serialization.", "19820607", asPerson.getSDTCBirthTime().getValue());
- }
+ // @Test
+ // public void testBirthTimeSerializationOfGeneratedDoc() {
+ // ClinicalDocument clinicalDocument = CDAFactory.eINSTANCE.createClinicalDocument();
+ // Section section = CDAFactory.eINSTANCE.createSection();
+ //
+ // Observation obs = CDAFactory.eINSTANCE.createObservation();
+ // Author auth = CDAFactory.eINSTANCE.createAuthor();
+ // AssignedAuthor asAuth = CDAFactory.eINSTANCE.createAssignedAuthor();
+ // Person asPerson = CDAFactory.eINSTANCE.createPerson();
+ //
+ // TS birthTS = DatatypesFactory.eINSTANCE.createTS();
+ // birthTS.setValue("19820607");
+ // // asPerson.setSDTCBirthTime(birthTS);
+ // asAuth.setAssignedPerson(asPerson);
+ // auth.setAssignedAuthor(asAuth);
+ // obs.getAuthors().add(auth);
+ // section.addObservation(obs);
+ // clinicalDocument.addSection(section);
+ //
+ // if (!serializeDocument(
+ // clinicalDocument, "\n\n---testBirthTimeSerializationOfGeneratedDoc extension document serialization---")) {
+ // fail("Unable to save/serialize sdtc:birthTime within a generated document.");
+ // }
+ //
+ // // check after serialization that sdtc specific properties are the same
+ // assertEquals(
+ // "The TS value has changed after serialization.", "19820607", asPerson.getSDTCBirthTime().getValue());
+ // }
@Test
public void testPersonAsPatientRelationshipSerializationOfGeneratedDoc() {
@@ -659,9 +677,11 @@
fail("Unable to save/serialize sdtc:birthTime within a generated document.");
}
+ System.out.println(asPerson.getSDTCAsPatientRelationship().getText());
// check after serialization that sdtc specific properties are the same
assertEquals(
- "The TS value has changed after serialization.", "RELATIONSHOP", asPerson.getSDTCAsPatientRelationship());
+ "The TS value has changed after serialization.", "RELATIONSHOP",
+ asPerson.getSDTCAsPatientRelationship().getText());
}
@Test
@@ -688,8 +708,7 @@
}
// check after serialization that sdtc specific properties are the same
- assertEquals(
- "The TS value has changed after serialization.", "19820607", asPerson.getSDTCAsPatientRelationship());
+ assertEquals("The TS value has changed after serialization.", "DESCRIPTION", asPerson.getSDTCDesc().getText());
}
/**