Search in sources :

Example 1 with KorpergrosseComposition

use of org.ehrbase.client.classgenerator.examples.korpergrossecomposition.KorpergrosseComposition in project openEHR_SDK by ehrbase.

the class FlattenerTest method testFlattenSingleEventPointEvent.

@Test
public void testFlattenSingleEventPointEvent() {
    Unflattener unflattener = new Unflattener(new TestDataTemplateProvider());
    KorpergrosseComposition dto = new KorpergrosseComposition();
    dto.setGrosseLange(new GrosseLangeObservation());
    dto.getGrosseLange().setGrosseLangeMagnitude(22d);
    Composition rmObject = (Composition) unflattener.unflatten(dto);
    assertThat(rmObject).isNotNull();
    Flattener cut = new Flattener(new TestDataTemplateProvider());
    KorpergrosseComposition actual = cut.flatten(rmObject, KorpergrosseComposition.class);
    assertThat(actual.getGrosseLange().getGrosseLangeMagnitude()).isEqualTo(22d);
}
Also used : KorpergrosseComposition(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.KorpergrosseComposition) GrosseLangeObservation(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.definition.GrosseLangeObservation) Composition(com.nedap.archie.rm.composition.Composition) TestData.buildEpisodeOfCareComposition(org.ehrbase.client.TestData.buildEpisodeOfCareComposition) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) CoronaAnamneseComposition(org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.CoronaAnamneseComposition) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) TestData.buildAlternativeEventsComposition(org.ehrbase.client.TestData.buildAlternativeEventsComposition) KorpergrosseComposition(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.KorpergrosseComposition) AlternativeEventsComposition(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) Test(org.junit.Test)

Example 2 with KorpergrosseComposition

use of org.ehrbase.client.classgenerator.examples.korpergrossecomposition.KorpergrosseComposition in project openEHR_SDK by ehrbase.

the class UnflattenerTest method testUnflattenSingleEvent.

@Test
public void testUnflattenSingleEvent() {
    Unflattener cut = new Unflattener(new TestDataTemplateProvider());
    KorpergrosseComposition dto = new KorpergrosseComposition();
    dto.setGrosseLange(new GrosseLangeObservation());
    dto.getGrosseLange().setGrosseLangeMagnitude(22d);
    Composition rmObject = (Composition) cut.unflatten(dto);
    assertThat(rmObject).isNotNull();
    Object event = rmObject.itemAtPath("/content[openEHR-EHR-OBSERVATION.height.v2]/data[at0001]/events[at0002]");
    assertThat(event).isNotNull();
    assertThat(event.getClass()).isEqualTo(PointEvent.class);
    Object quantity = ((PointEvent) event).itemAtPath("/data[at0003]/items[at0004]/value");
    assertThat(quantity).isNotNull();
    assertThat(quantity.getClass()).isEqualTo(DvQuantity.class);
    assertThat(((DvQuantity) quantity).getMagnitude()).isEqualTo(22d);
}
Also used : KorpergrosseComposition(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.KorpergrosseComposition) GrosseLangeObservation(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.definition.GrosseLangeObservation) Composition(com.nedap.archie.rm.composition.Composition) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) KorpergrosseComposition(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.KorpergrosseComposition) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) AlternativeEventsComposition(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition) BefundDerBlutgasanalyseComposition(org.ehrbase.client.classgenerator.examples.befundderblutgasanalysecomposition.BefundDerBlutgasanalyseComposition) TestAllTypesEnV1Composition(org.ehrbase.client.classgenerator.examples.testalltypesenv1composition.TestAllTypesEnV1Composition) CoronaAnamneseComposition(org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.CoronaAnamneseComposition) DvQuantity(com.nedap.archie.rm.datavalues.quantity.DvQuantity) PointEvent(com.nedap.archie.rm.datastructures.PointEvent) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) Test(org.junit.Test)

Example 3 with KorpergrosseComposition

use of org.ehrbase.client.classgenerator.examples.korpergrossecomposition.KorpergrosseComposition in project openEHR_SDK by ehrbase.

the class FlattenerTest method testFlattenSingleEventIntervallEvent.

@Test
public void testFlattenSingleEventIntervallEvent() {
    Unflattener unflattener = new Unflattener(new TestDataTemplateProvider());
    KorpergrosseComposition dto = new KorpergrosseComposition();
    dto.setGrosseLange(new GrosseLangeObservation());
    dto.getGrosseLange().setGrosseLangeMagnitude(22d);
    Composition rmObject = (Composition) unflattener.unflatten(dto);
    Observation observation = (Observation) rmObject.getContent().get(0);
    Event<ItemStructure> event = observation.getData().getEvents().get(0);
    observation.getData().getEvents().remove(event);
    IntervalEvent<ItemStructure> intervalEvent = new IntervalEvent<>();
    intervalEvent.setData(event.getData());
    intervalEvent.setArchetypeNodeId(event.getArchetypeNodeId());
    intervalEvent.setSampleCount(10L);
    observation.getData().getEvents().add(intervalEvent);
    assertThat(rmObject).isNotNull();
    Flattener cut = new Flattener(new TestDataTemplateProvider());
    KorpergrosseComposition actual = cut.flatten(rmObject, KorpergrosseComposition.class);
    assertThat(actual.getGrosseLange().getGrosseLangeMagnitude()).isEqualTo(22d);
}
Also used : KorpergrosseComposition(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.KorpergrosseComposition) GrosseLangeObservation(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.definition.GrosseLangeObservation) Composition(com.nedap.archie.rm.composition.Composition) TestData.buildEpisodeOfCareComposition(org.ehrbase.client.TestData.buildEpisodeOfCareComposition) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) CoronaAnamneseComposition(org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.CoronaAnamneseComposition) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) TestData.buildAlternativeEventsComposition(org.ehrbase.client.TestData.buildAlternativeEventsComposition) KorpergrosseComposition(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.KorpergrosseComposition) AlternativeEventsComposition(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition) Observation(com.nedap.archie.rm.composition.Observation) BodyTemperatureObservation(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureObservation) GrosseLangeObservation(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.definition.GrosseLangeObservation) KorpergewichtAnyEventEnIntervalEvent(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.definition.KorpergewichtAnyEventEnIntervalEvent) IntervalEvent(com.nedap.archie.rm.datastructures.IntervalEvent) ItemStructure(com.nedap.archie.rm.datastructures.ItemStructure) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) Test(org.junit.Test)

Aggregations

Composition (com.nedap.archie.rm.composition.Composition)3 AlternativeEventsComposition (org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition)3 CoronaAnamneseComposition (org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.CoronaAnamneseComposition)3 EhrbaseBloodPressureSimpleDeV0Composition (org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition)3 EhrbaseMultiOccurrenceDeV1Composition (org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition)3 EpisodeOfCareComposition (org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition)3 KorpergrosseComposition (org.ehrbase.client.classgenerator.examples.korpergrossecomposition.KorpergrosseComposition)3 GrosseLangeObservation (org.ehrbase.client.classgenerator.examples.korpergrossecomposition.definition.GrosseLangeObservation)3 TestDataTemplateProvider (org.ehrbase.client.templateprovider.TestDataTemplateProvider)3 Test (org.junit.Test)3 TestData.buildAlternativeEventsComposition (org.ehrbase.client.TestData.buildAlternativeEventsComposition)2 TestData.buildEpisodeOfCareComposition (org.ehrbase.client.TestData.buildEpisodeOfCareComposition)2 Observation (com.nedap.archie.rm.composition.Observation)1 IntervalEvent (com.nedap.archie.rm.datastructures.IntervalEvent)1 ItemStructure (com.nedap.archie.rm.datastructures.ItemStructure)1 PointEvent (com.nedap.archie.rm.datastructures.PointEvent)1 DvQuantity (com.nedap.archie.rm.datavalues.quantity.DvQuantity)1 KorpergewichtAnyEventEnIntervalEvent (org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.definition.KorpergewichtAnyEventEnIntervalEvent)1 BefundDerBlutgasanalyseComposition (org.ehrbase.client.classgenerator.examples.befundderblutgasanalysecomposition.BefundDerBlutgasanalyseComposition)1 BodyTemperatureObservation (org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureObservation)1