use of com.nedap.archie.rm.composition.Composition in project openEHR_SDK by ehrbase.
the class DBEncodeTest method testOtherParticipationsPartyRef.
@Test
public void testOtherParticipationsPartyRef() throws IOException {
Composition composition = new CanonicalJson().unmarshal(IOUtils.toString(CompositionTestDataCanonicalJson.OTHER_PARTICIPATIONS.getStream(), UTF_8), Composition.class);
assertNotNull(composition);
CompositionSerializer compositionSerializerRawJson = new CompositionSerializer();
String db_encoded = compositionSerializerRawJson.dbEncode(composition);
assertNotNull(db_encoded);
JsonElement converted = new LightRawJsonEncoder(db_encoded).encodeContentAsJson("composition");
// see if this can be interpreted by Archie
Composition composition2 = new CanonicalJson().unmarshal(converted.toString(), Composition.class);
assertNotNull(composition2);
assertEquals("PERSON", composition2.itemsAtPath("/content[openEHR-EHR-ACTION.minimal.v1]/other_participations/performer/external_ref/type").get(0));
}
use of com.nedap.archie.rm.composition.Composition in project openEHR_SDK by ehrbase.
the class DBEncodeTest method testDBEncodeDecodeInstruction.
@Test
public void testDBEncodeDecodeInstruction() throws IOException {
Composition composition = new CanonicalJson().unmarshal(IOUtils.toString(CompositionTestDataCanonicalJson.NESTED_EN_V1.getStream(), UTF_8), Composition.class);
CompositionSerializer compositionSerializer = new CompositionSerializer();
String encoded = compositionSerializer.dbEncode(composition);
Assert.assertTrue(encoded.contains(CompositionSerializer.TAG_EXPIRY_TIME));
String json = new LightRawJsonEncoder(encoded).encodeCompositionAsString();
Composition result = new CanonicalJson().unmarshal(json, Composition.class);
DvDateTime expiryTime = ((Instruction) ((Section) result.getContent().get(0)).getItems().get(0)).getExpiryTime();
Assert.assertNotNull(expiryTime);
Assert.assertEquals(OffsetDateTime.parse("2021-05-18T13:13:09.780+03:00"), expiryTime.getValue());
}
use of com.nedap.archie.rm.composition.Composition in project openEHR_SDK by ehrbase.
the class DBEncodeTest method testDateTimeEncodeDecode.
@Test
public void testDateTimeEncodeDecode() throws IOException {
Composition composition = new CanonicalJson().unmarshal(IOUtils.toString(CompositionTestDataCanonicalJson.DATE_TIME_TESTS.getStream(), UTF_8), Composition.class);
assertNotNull(composition);
CompositionSerializer compositionSerializerRawJson = new CompositionSerializer();
String db_encoded = compositionSerializerRawJson.dbEncode(composition);
assertNotNull(db_encoded);
JsonElement converted = new LightRawJsonEncoder(db_encoded).encodeContentAsJson("composition");
// see if this can be interpreted by Archie
Composition composition2 = new CanonicalJson().unmarshal(converted.toString(), Composition.class);
assertNotNull(composition2);
String dvtestPrefix = "/content[openEHR-EHR-OBSERVATION.test_all_types.v1]/data[at0001]/events[at0002]/data[at0003]";
assertEquals("2019-01-28", composition2.itemsAtPath(dvtestPrefix + "/items[at0010.1]/value/value").get(0).toString());
assertEquals("2019-01-28T10:00", composition2.itemsAtPath(dvtestPrefix + "/items[at0010.2]/value/value").get(0).toString());
assertEquals("2019-01-28T10:00+07:00", composition2.itemsAtPath(dvtestPrefix + "/items[at0010.21]/value/value").get(0).toString());
assertEquals("2019-01", composition2.itemsAtPath(dvtestPrefix + "/items[at0010.3]/value/value").get(0).toString());
assertEquals("2019", composition2.itemsAtPath(dvtestPrefix + "/items[at0010.4]/value/value").get(0).toString());
assertEquals("2019-01-28T21:22:49.427+07:00", composition2.itemsAtPath(dvtestPrefix + "/items[at0011]/value/value").get(0).toString());
assertEquals("18:36:49", composition2.itemsAtPath(dvtestPrefix + "/items[at0012.1]/value/value").get(0).toString());
assertEquals("18:36", composition2.itemsAtPath(dvtestPrefix + "/items[at0012.2]/value/value").get(0).toString());
assertEquals("18:00", composition2.itemsAtPath(dvtestPrefix + "/items[at0012.3]/value/value").get(0).toString());
assertEquals("18:36+07:00", composition2.itemsAtPath(dvtestPrefix + "/items[at0012.4]/value/value").get(0).toString());
}
use of com.nedap.archie.rm.composition.Composition in project openEHR_SDK by ehrbase.
the class DBEncodeTest method testNestedLanguage.
@Test
public void testNestedLanguage() throws IOException {
Composition composition = new CanonicalJson().unmarshal(IOUtils.toString(CompositionTestDataCanonicalJson.SUBJECT_PARTY_SELF.getStream(), UTF_8), Composition.class);
assertNotNull(composition);
CompositionSerializer compositionSerializerRawJson = new CompositionSerializer();
String db_encoded = compositionSerializerRawJson.dbEncode(composition);
assertNotNull(db_encoded);
JsonElement converted = new LightRawJsonEncoder(db_encoded).encodeContentAsJson("composition");
// see if this can be interpreted by Archie
Composition composition2 = new CanonicalJson().unmarshal(converted.toString(), Composition.class);
assertNotNull(composition2);
assertEquals("de", composition2.itemsAtPath("/content[openEHR-EHR-SECTION.allgemeine_angaben.v1]/items[openEHR-EHR-EVALUATION.problem_diagnosis_covid.v1]/language/code_string").get(0).toString());
}
use of com.nedap.archie.rm.composition.Composition in project openEHR_SDK by ehrbase.
the class DBEncodeTest method testNestedLanguageSubjectPartyIdentified.
@Test
public void testNestedLanguageSubjectPartyIdentified() throws IOException {
Composition composition = new CanonicalJson().unmarshal(IOUtils.toString(CompositionTestDataCanonicalJson.SUBJECT_PARTY_IDENTIFIED.getStream(), UTF_8), Composition.class);
assertNotNull(composition);
CompositionSerializer compositionSerializerRawJson = new CompositionSerializer();
String db_encoded = compositionSerializerRawJson.dbEncode(composition);
assertNotNull(db_encoded);
JsonElement converted = new LightRawJsonEncoder(db_encoded).encodeContentAsJson("composition");
// see if this can be interpreted by Archie
Composition composition2 = new CanonicalJson().unmarshal(converted.toString(), Composition.class);
assertNotNull(composition2);
assertEquals("1", composition2.itemsAtPath("/content[openEHR-EHR-SECTION.allgemeine_angaben.v1]/items[openEHR-EHR-EVALUATION.problem_diagnosis_covid.v1]/subject/external_ref/id/value").get(0).toString());
}
Aggregations