use of com.nedap.archie.rm.composition.Composition in project openEHR_SDK by ehrbase.
the class OptSkeletonBuilderTest method testGenerateCorona.
@Test
public void testGenerateCorona() throws Exception {
org.openehr.schemas.v1.TemplateDocument document = org.openehr.schemas.v1.TemplateDocument.Factory.parse(OperationalTemplateTestData.CORONA_ANAMNESE.getStream());
OPERATIONALTEMPLATE operationaltemplate = document.getTemplate();
OptSkeletonBuilder cut = new OptSkeletonBuilder();
Composition generate = (Composition) cut.generate(operationaltemplate);
assertThat(generate.getContent()).extracting(Locatable::getName).extracting(DvText::getValue).containsExactlyInAnyOrder("Geschichte/Historie", "Symptome", "Kontakt", "Risikogebiet", "Allgemeine Angaben");
}
use of com.nedap.archie.rm.composition.Composition in project openEHR_SDK by ehrbase.
the class OptSkeletonBuilderTest method testGenerateEpisodeOfCare.
@Test
public void testGenerateEpisodeOfCare() throws Exception {
org.openehr.schemas.v1.TemplateDocument document = org.openehr.schemas.v1.TemplateDocument.Factory.parse(OperationalTemplateTestData.EPISODE_OF_CARE.getStream());
OPERATIONALTEMPLATE operationaltemplate = document.getTemplate();
OptSkeletonBuilder cut = new OptSkeletonBuilder();
Composition generate = (Composition) cut.generate(operationaltemplate);
assertThat(generate).isNotNull();
assertThat(generate.itemAtPath("/composer")).isNotNull();
assertThat(generate.itemAtPath("/context/end_time")).isNotNull();
assertThat(generate.itemAtPath("/name")).extracting(d -> ((DvText) d).getValue()).isEqualTo("EpisodeOfCare");
}
use of com.nedap.archie.rm.composition.Composition in project openEHR_SDK by ehrbase.
the class OptSkeletonBuilderTest method testGenerate.
@Test
public void testGenerate() throws Exception {
org.openehr.schemas.v1.TemplateDocument document = org.openehr.schemas.v1.TemplateDocument.Factory.parse(OperationalTemplateTestData.BLOOD_PRESSURE_SIMPLE.getStream());
OPERATIONALTEMPLATE operationaltemplate = document.getTemplate();
OptSkeletonBuilder cut = new OptSkeletonBuilder();
Composition generate = (Composition) cut.generate(operationaltemplate);
assertThat(generate).isNotNull();
assertThat(generate.itemAtPath("/composer")).isNotNull();
assertThat(generate.itemAtPath("/context/end_time")).isNotNull();
assertThat(generate.itemAtPath("/content[openEHR-EHR-OBSERVATION.sample_blood_pressure.v1]/data[at0001]/events[at0002]/state[at0007]/items[at1005]/value")).isNotNull();
}
use of com.nedap.archie.rm.composition.Composition in project openEHR_SDK by ehrbase.
the class ItemStructureVisitorTest method elementVisitorTest.
@Test
public void elementVisitorTest() throws Throwable {
Unmarshaller unmarshaller = JAXBUtil.createRMContext().createUnmarshaller();
Composition composition = (Composition) unmarshaller.unmarshal(new FileInputStream(new File("./src/test/resources/composition/test_all_types.fixed.v1.xml")));
itemStructureVisitor.validate(composition);
// 25 ELEMENTs + 1 ITEM_SINGLE!
assertEquals(26, itemStructureVisitor.getElementOccurrences());
}
use of com.nedap.archie.rm.composition.Composition in project openEHR_SDK by ehrbase.
the class AqlTestIT method testExecute11.
@Test
public void testExecute11() throws IOException {
ehr = openEhrClient.ehrEndpoint().createEhr();
Composition composition = new CanonicalJson().unmarshal(IOUtils.toString(CompositionTestDataCanonicalJson.CORONA.getStream(), StandardCharsets.UTF_8), Composition.class);
Flattener flattener = new Flattener(new TestDataTemplateProvider());
CoronaAnamneseComposition coronaAnamneseComposition = flattener.flatten(composition, CoronaAnamneseComposition.class);
coronaAnamneseComposition.setVersionUid(null);
openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(coronaAnamneseComposition);
Query<Record2<String, String>> query = Query.buildNativeQuery("Select DISTINCT" + " o/data[at0001]/events[at0002]/data[at0003]/items[at0022]/items[at0005]/value/value as var1," + " o/data[at0001]/events[at0002]/data[at0003]/items[at0022]/items[at0004]/value/value as var2" + " from EHR e[ehr_id/value = $ehr_id] " + " contains COMPOSITION c3[openEHR-EHR-COMPOSITION.report.v1]" + " contains SECTION s4[openEHR-EHR-SECTION.adhoc.v1]" + " contains OBSERVATION o[openEHR-EHR-OBSERVATION.symptom_sign_screening.v0] " + " WHERE" + " o/data[at0001]/events[at0002]/data[at0003]/items[at0022]/items[at0005]/value/value is not null " + " AND" + " o/data[at0001]/events[at0002]/data[at0003]/items[at0022]/items[at0004]/value/value is not null", String.class, String.class);
List<Record2<String, String>> result = openEhrClient.aqlEndpoint().execute(query, new ParameterValue("ehr_id", ehr));
assertThat(result).isNotNull();
assertThat(result).extracting(Record2::value1, Record2::value2).containsExactlyInAnyOrder(new Tuple("Nicht vorhanden", "Durchfall"), new Tuple("Nicht vorhanden", "Fieber oder erhöhte Körpertemperatur"), new Tuple("Nicht vorhanden", "gestörter Geruchssinn"), new Tuple("Nicht vorhanden", "gestörter Geschmackssinn"), new Tuple("Nicht vorhanden", "Heiserkeit"), new Tuple("Nicht vorhanden", "Husten"), new Tuple("Nicht vorhanden", "Schnupfen"), new Tuple("Vorhanden", "Durchfall"), new Tuple("Vorhanden", "Fieber oder erhöhte Körpertemperatur"), new Tuple("Vorhanden", "gestörter Geruchssinn"), new Tuple("Vorhanden", "gestörter Geschmackssinn"), new Tuple("Vorhanden", "Heiserkeit"), new Tuple("Vorhanden", "Husten"), new Tuple("Vorhanden", "Schnupfen"));
}
Aggregations