Search in sources :

Example 1 with OptSkeletonBuilder

use of org.ehrbase.building.OptSkeletonBuilder in project openEHR_SDK by ehrbase.

the class NormalizerTest method normalize.

@Test
public void normalize() throws IOException, XmlException {
    OPERATIONALTEMPLATE template = TemplateDocument.Factory.parse(OperationalTemplateTestData.ALL_TYPES.getStream()).getTemplate();
    OptSkeletonBuilder skeletonBuilder = new OptSkeletonBuilder();
    RMObject rmObject = skeletonBuilder.generate(template);
    Normalizer cut = new Normalizer();
    Composition actual = (Composition) cut.normalize(rmObject);
    assertThat(actual).isNotNull();
    assertThat(actual.getContent()).size().isEqualTo(0);
}
Also used : OPERATIONALTEMPLATE(org.openehr.schemas.v1.OPERATIONALTEMPLATE) Composition(com.nedap.archie.rm.composition.Composition) Normalizer(org.ehrbase.normalizer.Normalizer) OptSkeletonBuilder(org.ehrbase.building.OptSkeletonBuilder) RMObject(com.nedap.archie.rm.RMObject) Test(org.junit.Test)

Example 2 with OptSkeletonBuilder

use of org.ehrbase.building.OptSkeletonBuilder 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");
}
Also used : OPERATIONALTEMPLATE(org.openehr.schemas.v1.OPERATIONALTEMPLATE) Composition(com.nedap.archie.rm.composition.Composition) OptSkeletonBuilder(org.ehrbase.building.OptSkeletonBuilder) Locatable(com.nedap.archie.rm.archetyped.Locatable) Test(org.junit.Test)

Example 3 with OptSkeletonBuilder

use of org.ehrbase.building.OptSkeletonBuilder 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");
}
Also used : OPERATIONALTEMPLATE(org.openehr.schemas.v1.OPERATIONALTEMPLATE) Composition(com.nedap.archie.rm.composition.Composition) DvText(com.nedap.archie.rm.datavalues.DvText) OptSkeletonBuilder(org.ehrbase.building.OptSkeletonBuilder) OperationalTemplateTestData(org.ehrbase.test_data.operationaltemplate.OperationalTemplateTestData) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Locatable(com.nedap.archie.rm.archetyped.Locatable) Test(org.junit.Test) OPERATIONALTEMPLATE(org.openehr.schemas.v1.OPERATIONALTEMPLATE) Composition(com.nedap.archie.rm.composition.Composition) OptSkeletonBuilder(org.ehrbase.building.OptSkeletonBuilder) DvText(com.nedap.archie.rm.datavalues.DvText) Test(org.junit.Test)

Example 4 with OptSkeletonBuilder

use of org.ehrbase.building.OptSkeletonBuilder 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();
}
Also used : OPERATIONALTEMPLATE(org.openehr.schemas.v1.OPERATIONALTEMPLATE) Composition(com.nedap.archie.rm.composition.Composition) OptSkeletonBuilder(org.ehrbase.building.OptSkeletonBuilder) Test(org.junit.Test)

Aggregations

Composition (com.nedap.archie.rm.composition.Composition)4 OptSkeletonBuilder (org.ehrbase.building.OptSkeletonBuilder)4 Test (org.junit.Test)4 OPERATIONALTEMPLATE (org.openehr.schemas.v1.OPERATIONALTEMPLATE)4 Locatable (com.nedap.archie.rm.archetyped.Locatable)2 RMObject (com.nedap.archie.rm.RMObject)1 DvText (com.nedap.archie.rm.datavalues.DvText)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Normalizer (org.ehrbase.normalizer.Normalizer)1 OperationalTemplateTestData (org.ehrbase.test_data.operationaltemplate.OperationalTemplateTestData)1