Search in sources :

Example 1 with AlternativeEventsComposition

use of org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition in project openEHR_SDK by ehrbase.

the class UnflattenerTest method testUnflattenAltEvent.

@Test
public void testUnflattenAltEvent() {
    AlternativeEventsComposition alternativeEventsComposition = buildAlternativeEventsComposition();
    Unflattener cut = new Unflattener(new TestDataTemplateProvider());
    Composition actual = (Composition) cut.unflatten(alternativeEventsComposition);
    assertThat(actual).isNotNull();
    assertThat(actual.getContent()).size().isEqualTo(1);
    Observation actualObservation = (Observation) actual.getContent().get(0);
    assertThat(actualObservation.getData().getEvents()).size().isEqualTo(3);
    assertThat(actualObservation.getData().getEvents()).extracting(e -> (Class) e.getClass()).containsExactlyInAnyOrder(PointEvent.class, PointEvent.class, IntervalEvent.class);
    List<PointEvent> pointEvents = actualObservation.getData().getEvents().stream().filter(e -> PointEvent.class.isAssignableFrom(e.getClass())).map(e -> (PointEvent) e).collect(Collectors.toList());
    assertThat(pointEvents).extracting(p -> p.getTime().getValue(), p -> ((DvQuantity) ((Element) p.getData().getItems().get(0)).getValue()).getMagnitude(), p -> ((DvQuantity) ((Element) p.getData().getItems().get(0)).getValue()).getUnits()).containsExactlyInAnyOrder(new Tuple(OffsetDateTime.of(1990, 11, 02, 12, 00, 00, 00, ZoneOffset.UTC), 30d, "kg"), new Tuple(OffsetDateTime.of(2013, 11, 02, 12, 00, 00, 00, ZoneOffset.UTC), 55d, "kg"));
    List<IntervalEvent> intervalEvents = actualObservation.getData().getEvents().stream().filter(e -> IntervalEvent.class.isAssignableFrom(e.getClass())).map(e -> (IntervalEvent) e).collect(Collectors.toList());
    assertThat(intervalEvents).extracting(p -> p.getTime().getValue(), p -> ((DvQuantity) ((Element) p.getData().getItems().get(0)).getValue()).getMagnitude(), p -> ((DvQuantity) ((Element) p.getData().getItems().get(0)).getValue()).getUnits(), p -> p.getMathFunction().getValue(), p -> p.getWidth().getValue()).containsExactlyInAnyOrder(new Tuple(OffsetDateTime.of(2015, 11, 02, 12, 00, 00, 00, ZoneOffset.UTC), 60d, "kg", "mean", Duration.ofDays(30)));
}
Also used : Composition(com.nedap.archie.rm.composition.Composition) TerminologyId(com.nedap.archie.rm.support.identification.TerminologyId) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) LaborergebnisObservation(org.ehrbase.client.classgenerator.examples.befundderblutgasanalysecomposition.definition.LaborergebnisObservation) EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) GrosseLangeObservation(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.definition.GrosseLangeObservation) Element(com.nedap.archie.rm.datastructures.Element) Duration(java.time.Duration) Locatable(com.nedap.archie.rm.archetyped.Locatable) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) URI(java.net.URI) ZoneOffset(java.time.ZoneOffset) CodePhrase(com.nedap.archie.rm.datatypes.CodePhrase) DvQuantity(com.nedap.archie.rm.datavalues.quantity.DvQuantity) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier) PartySelf(com.nedap.archie.rm.generic.PartySelf) Tuple(org.assertj.core.groups.Tuple) KorpergrosseComposition(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.KorpergrosseComposition) CanonicalJson(org.ehrbase.serialisation.jsonencoding.CanonicalJson) CompositionTestDataCanonicalJson(org.ehrbase.test_data.composition.CompositionTestDataCanonicalJson) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) DvText(com.nedap.archie.rm.datavalues.DvText) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) Test(org.junit.Test) IOException(java.io.IOException) PointEvent(com.nedap.archie.rm.datastructures.PointEvent) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) WebTemplate(org.ehrbase.webtemplate.model.WebTemplate) IOUtils(org.apache.commons.io.IOUtils) KohlendioxidpartialdruckCluster(org.ehrbase.client.classgenerator.examples.befundderblutgasanalysecomposition.definition.KohlendioxidpartialdruckCluster) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) Observation(com.nedap.archie.rm.composition.Observation) List(java.util.List) AlternativeEventsComposition(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition) OffsetDateTime(java.time.OffsetDateTime) BefundDerBlutgasanalyseComposition(org.ehrbase.client.classgenerator.examples.befundderblutgasanalysecomposition.BefundDerBlutgasanalyseComposition) Assert.assertFalse(org.junit.Assert.assertFalse) Optional(java.util.Optional) TestData(org.ehrbase.client.TestData) IntervalEvent(com.nedap.archie.rm.datastructures.IntervalEvent) TestAllTypesEnV1Composition(org.ehrbase.client.classgenerator.examples.testalltypesenv1composition.TestAllTypesEnV1Composition) AdminEntry(com.nedap.archie.rm.composition.AdminEntry) DvURI(com.nedap.archie.rm.datavalues.DvURI) TestAllTypesEvaluation(org.ehrbase.client.classgenerator.examples.testalltypesenv1composition.definition.TestAllTypesEvaluation) CoronaAnamneseComposition(org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.CoronaAnamneseComposition) 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) IntervalEvent(com.nedap.archie.rm.datastructures.IntervalEvent) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) DvQuantity(com.nedap.archie.rm.datavalues.quantity.DvQuantity) PointEvent(com.nedap.archie.rm.datastructures.PointEvent) LaborergebnisObservation(org.ehrbase.client.classgenerator.examples.befundderblutgasanalysecomposition.definition.LaborergebnisObservation) GrosseLangeObservation(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.definition.GrosseLangeObservation) Observation(com.nedap.archie.rm.composition.Observation) AlternativeEventsComposition(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition) Tuple(org.assertj.core.groups.Tuple) Test(org.junit.Test)

Example 2 with AlternativeEventsComposition

use of org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition in project openEHR_SDK by ehrbase.

the class FlattenerTest method testFlattenAltEvents.

@Test
public void testFlattenAltEvents() {
    Composition composition = (Composition) new Unflattener(new TestDataTemplateProvider()).unflatten(buildAlternativeEventsComposition());
    Flattener cut = new Flattener(new TestDataTemplateProvider());
    AlternativeEventsComposition actual = cut.flatten(composition, AlternativeEventsComposition.class);
    assertThat(actual).isNotNull();
    assertThat(actual.getKorpergewicht()).size().isEqualTo(1);
    KorpergewichtBirthEnPointEvent birthEn = actual.getKorpergewicht().get(0).getBirthEn();
    assertThat(birthEn.getTimeValue()).isEqualTo(OffsetDateTime.of(1990, 11, 2, 12, 0, 0, 0, ZoneOffset.UTC));
    assertThat(birthEn.getGewichtMagnitude()).isEqualTo(30d);
    assertThat(birthEn.getGewichtUnits()).isEqualTo("kg");
    List<KorpergewichtAnyEventEnPointEvent> eventEnPointEvents = actual.getKorpergewicht().get(0).getAnyEventEn().stream().filter(e -> KorpergewichtAnyEventEnPointEvent.class.isAssignableFrom(e.getClass())).map(e -> (KorpergewichtAnyEventEnPointEvent) e).collect(Collectors.toList());
    assertThat(eventEnPointEvents).size().isEqualTo(1);
    assertThat(eventEnPointEvents.get(0).getTimeValue()).isEqualTo(OffsetDateTime.of(2013, 11, 2, 12, 0, 0, 0, ZoneOffset.UTC));
    assertThat(eventEnPointEvents.get(0).getGewichtMagnitude()).isEqualTo(55d);
    assertThat(eventEnPointEvents.get(0).getGewichtUnits()).isEqualTo("kg");
    List<KorpergewichtAnyEventEnIntervalEvent> anyEventEnIntervalEvents = actual.getKorpergewicht().get(0).getAnyEventEn().stream().filter(e -> KorpergewichtAnyEventEnIntervalEvent.class.isAssignableFrom(e.getClass())).map(e -> (KorpergewichtAnyEventEnIntervalEvent) e).collect(Collectors.toList());
    assertThat(eventEnPointEvents).size().isEqualTo(1);
    assertThat(anyEventEnIntervalEvents.get(0).getTimeValue()).isEqualTo(OffsetDateTime.of(2015, 11, 2, 12, 0, 0, 0, ZoneOffset.UTC));
    assertThat(anyEventEnIntervalEvents.get(0).getGewichtMagnitude()).isEqualTo(60d);
    assertThat(anyEventEnIntervalEvents.get(0).getGewichtUnits()).isEqualTo("kg");
    assertThat(anyEventEnIntervalEvents.get(0).getMathFunctionDefiningCode()).isEqualTo(MathFunction.MEAN);
    assertThat(anyEventEnIntervalEvents.get(0).getWidthValue()).isEqualTo(Duration.ofDays(30));
}
Also used : Composition(com.nedap.archie.rm.composition.Composition) MathFunction(org.ehrbase.client.classgenerator.shareddefinition.MathFunction) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) EpisodeofcareTeamElement(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareTeamElement) Duration(java.time.Duration) Locatable(com.nedap.archie.rm.archetyped.Locatable) URI(java.net.URI) ZoneOffset(java.time.ZoneOffset) LocationOfMeasurementDefiningCode(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.LocationOfMeasurementDefiningCode) TestData.buildEpisodeOfCareComposition(org.ehrbase.client.TestData.buildEpisodeOfCareComposition) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) IOUtils(org.apache.commons.io.IOUtils) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) Observation(com.nedap.archie.rm.composition.Observation) List(java.util.List) OffsetDateTime(java.time.OffsetDateTime) BodyTemperatureLocationOfMeasurementChoice(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureLocationOfMeasurementChoice) Event(com.nedap.archie.rm.datastructures.Event) KorpergewichtBirthEnPointEvent(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.definition.KorpergewichtBirthEnPointEvent) TestData(org.ehrbase.client.TestData) CoronaAnamneseComposition(org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.CoronaAnamneseComposition) BodyTemperatureObservation(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureObservation) BodyTemperatureLocationOfMeasurementDvText(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureLocationOfMeasurementDvText) KorpergewichtAnyEventEnIntervalEvent(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.definition.KorpergewichtAnyEventEnIntervalEvent) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) GrosseLangeObservation(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.definition.GrosseLangeObservation) TestData.buildAlternativeEventsComposition(org.ehrbase.client.TestData.buildAlternativeEventsComposition) ContentItem(com.nedap.archie.rm.composition.ContentItem) ItemStructure(com.nedap.archie.rm.datastructures.ItemStructure) KorpergewichtAnyEventEnPointEvent(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.definition.KorpergewichtAnyEventEnPointEvent) BodyTemperatureAnyEventPointEvent(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureAnyEventPointEvent) DvQuantity(com.nedap.archie.rm.datavalues.quantity.DvQuantity) PartySelf(com.nedap.archie.rm.generic.PartySelf) Tuple(org.assertj.core.groups.Tuple) KorpergrosseComposition(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.KorpergrosseComposition) CanonicalJson(org.ehrbase.serialisation.jsonencoding.CanonicalJson) CompositionTestDataCanonicalJson(org.ehrbase.test_data.composition.CompositionTestDataCanonicalJson) EpisodeofcareAdminEntry(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareAdminEntry) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) NullFlavour(org.ehrbase.client.classgenerator.shareddefinition.NullFlavour) BodyTemperatureLocationOfMeasurementDvCodedText(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureLocationOfMeasurementDvCodedText) IOException(java.io.IOException) Test(org.junit.Test) VorhandenDefiningCode(org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.definition.VorhandenDefiningCode) KorotkoffSoundsDefiningCode(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.definition.KorotkoffSoundsDefiningCode) PointEvent(com.nedap.archie.rm.datastructures.PointEvent) AlternativeEventsComposition(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition) RMObject(com.nedap.archie.rm.RMObject) IntervalEvent(com.nedap.archie.rm.datastructures.IntervalEvent) 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) KorpergewichtBirthEnPointEvent(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.definition.KorpergewichtBirthEnPointEvent) KorpergewichtAnyEventEnIntervalEvent(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.definition.KorpergewichtAnyEventEnIntervalEvent) KorpergewichtAnyEventEnPointEvent(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.definition.KorpergewichtAnyEventEnPointEvent) TestData.buildAlternativeEventsComposition(org.ehrbase.client.TestData.buildAlternativeEventsComposition) AlternativeEventsComposition(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) Test(org.junit.Test)

Example 3 with AlternativeEventsComposition

use of org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition in project openEHR_SDK by ehrbase.

the class DefaultRestVersionedCompositionEndpointIT method testFindVersionAtTime.

@Test
public void testFindVersionAtTime() {
    ehrId = openEhrClient.ehrEndpoint().createEhr();
    LocalDateTime versionAtTime;
    Optional<OriginalVersion<AlternativeEventsComposition>> result;
    // Before
    versionAtTime = LocalDateTime.now();
    AlternativeEventsComposition composition1 = TestData.buildAlternativeEventsComposition();
    openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition1);
    result = openEhrClient.versionedCompositionEndpoint(ehrId).findVersionAtTime(composition1.getVersionUid().getUuid(), versionAtTime, AlternativeEventsComposition.class);
    Assert.assertTrue(result.isEmpty());
    // Between
    AlternativeEventsComposition composition2 = TestData.buildAlternativeEventsComposition();
    openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition2);
    VersionUid v2 = openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition2).getVersionUid();
    versionAtTime = LocalDateTime.now();
    openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition2);
    openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition2);
    result = openEhrClient.versionedCompositionEndpoint(ehrId).findVersionAtTime(composition2.getVersionUid().getUuid(), versionAtTime, AlternativeEventsComposition.class);
    Assert.assertTrue(result.isPresent());
    Assert.assertEquals(v2.toString(), result.get().getUid().getValue());
    // Last
    AlternativeEventsComposition composition3 = TestData.buildAlternativeEventsComposition();
    openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition3);
    openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition3);
    openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition3);
    versionAtTime = LocalDateTime.now();
    result = openEhrClient.versionedCompositionEndpoint(ehrId).findVersionAtTime(composition3.getVersionUid().getUuid(), versionAtTime, AlternativeEventsComposition.class);
    Assert.assertTrue(result.isPresent());
    Assert.assertEquals(composition3.getVersionUid().toString(), result.get().getUid().getValue());
}
Also used : LocalDateTime(java.time.LocalDateTime) OriginalVersion(com.nedap.archie.rm.changecontrol.OriginalVersion) VersionUid(org.ehrbase.client.openehrclient.VersionUid) AlternativeEventsComposition(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition) Test(org.junit.Test)

Example 4 with AlternativeEventsComposition

use of org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition in project openEHR_SDK by ehrbase.

the class TestData method buildAlternativeEventsComposition.

public static AlternativeEventsComposition buildAlternativeEventsComposition() {
    AlternativeEventsComposition alternativeEventsComposition = new AlternativeEventsComposition();
    alternativeEventsComposition.setStartTimeValue(OffsetDateTime.of(2010, 11, 02, 12, 00, 00, 00, ZoneOffset.UTC));
    alternativeEventsComposition.setComposer(new PartyIdentified(null, "Test", null));
    alternativeEventsComposition.setLanguage(Language.EN);
    alternativeEventsComposition.setTerritory(Territory.DE);
    alternativeEventsComposition.setCategoryDefiningCode(Category.EVENT);
    alternativeEventsComposition.setSettingDefiningCode(Setting.COMPLEMENTARY_HEALTH_CARE);
    alternativeEventsComposition.setKorpergewicht(new ArrayList<>());
    KorpergewichtObservation korpergewichtObservation = new KorpergewichtObservation();
    korpergewichtObservation.setLanguage(Language.EN);
    korpergewichtObservation.setSubject(new PartySelf());
    korpergewichtObservation.setOriginValue(OffsetDateTime.of(1990, 11, 02, 12, 00, 00, 00, ZoneOffset.UTC));
    alternativeEventsComposition.getKorpergewicht().add(korpergewichtObservation);
    KorpergewichtBirthEnPointEvent birthEnEvent = new KorpergewichtBirthEnPointEvent();
    birthEnEvent.setGewichtMagnitude(30d);
    birthEnEvent.setGewichtUnits("kg");
    birthEnEvent.setTimeValue(OffsetDateTime.of(1990, 11, 02, 12, 00, 00, 00, ZoneOffset.UTC));
    korpergewichtObservation.setBirthEn(birthEnEvent);
    korpergewichtObservation.setAnyEventEn(new ArrayList<>());
    KorpergewichtAnyEventEnPointEvent pointEvent = new KorpergewichtAnyEventEnPointEvent();
    pointEvent.setGewichtMagnitude(55d);
    pointEvent.setGewichtUnits("kg");
    pointEvent.setTimeValue(OffsetDateTime.of(2013, 11, 02, 12, 00, 00, 00, ZoneOffset.UTC));
    korpergewichtObservation.getAnyEventEn().add(pointEvent);
    KorpergewichtAnyEventEnIntervalEvent intervalEvent = new KorpergewichtAnyEventEnIntervalEvent();
    intervalEvent.setGewichtMagnitude(60d);
    intervalEvent.setGewichtUnits("kg");
    intervalEvent.setTimeValue(OffsetDateTime.of(2015, 11, 02, 12, 00, 00, 00, ZoneOffset.UTC));
    intervalEvent.setWidthValue(Duration.ofDays(30));
    intervalEvent.setMathFunctionDefiningCode(MathFunction.MEAN);
    korpergewichtObservation.getAnyEventEn().add(intervalEvent);
    return alternativeEventsComposition;
}
Also used : KorpergewichtObservation(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.definition.KorpergewichtObservation) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) KorpergewichtBirthEnPointEvent(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.definition.KorpergewichtBirthEnPointEvent) KorpergewichtAnyEventEnIntervalEvent(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.definition.KorpergewichtAnyEventEnIntervalEvent) KorpergewichtAnyEventEnPointEvent(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.definition.KorpergewichtAnyEventEnPointEvent) AlternativeEventsComposition(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition) PartySelf(com.nedap.archie.rm.generic.PartySelf)

Aggregations

AlternativeEventsComposition (org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition)4 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)3 PartySelf (com.nedap.archie.rm.generic.PartySelf)3 Test (org.junit.Test)3 Locatable (com.nedap.archie.rm.archetyped.Locatable)2 Composition (com.nedap.archie.rm.composition.Composition)2 Observation (com.nedap.archie.rm.composition.Observation)2 IntervalEvent (com.nedap.archie.rm.datastructures.IntervalEvent)2 PointEvent (com.nedap.archie.rm.datastructures.PointEvent)2 DvQuantity (com.nedap.archie.rm.datavalues.quantity.DvQuantity)2 IOException (java.io.IOException)2 URI (java.net.URI)2 StandardCharsets (java.nio.charset.StandardCharsets)2 Duration (java.time.Duration)2 OffsetDateTime (java.time.OffsetDateTime)2 ZoneOffset (java.time.ZoneOffset)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 IOUtils (org.apache.commons.io.IOUtils)2 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2