Search in sources :

Example 1 with BodyTemperatureLocationOfMeasurementDvCodedText

use of org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureLocationOfMeasurementDvCodedText in project openEHR_SDK by ehrbase.

the class FlattenerTest method testFlattenEhrbaseMultiOccurrenceDeV1.

@Test
public void testFlattenEhrbaseMultiOccurrenceDeV1() {
    Flattener cut = new Flattener(new TestDataTemplateProvider());
    EhrbaseMultiOccurrenceDeV1Composition bloodPressureSimpleDeV0 = TestData.buildEhrbaseMultiOccurrenceDeV1();
    RMObject rmObject = new Unflattener(new TestDataTemplateProvider()).unflatten(bloodPressureSimpleDeV0);
    EhrbaseMultiOccurrenceDeV1Composition actual = cut.flatten((Locatable) rmObject, EhrbaseMultiOccurrenceDeV1Composition.class);
    assertThat(actual).isNotNull();
    assertThat(actual.getBodyTemperature()).size().isEqualTo(2);
    BodyTemperatureObservation bodyTemperature1 = actual.getBodyTemperature().get(0);
    assertThat(bodyTemperature1.getAnyEvent()).extracting(e -> ((BodyTemperatureAnyEventPointEvent) e).getTemperatureMagnitude()).containsExactlyInAnyOrder(11d, 22d);
    BodyTemperatureLocationOfMeasurementChoice locationOfMeasurement1 = bodyTemperature1.getLocationOfMeasurement();
    assertThat(locationOfMeasurement1.getClass()).isEqualTo(BodyTemperatureLocationOfMeasurementDvCodedText.class);
    assertThat(((BodyTemperatureLocationOfMeasurementDvCodedText) locationOfMeasurement1).getLocationOfMeasurementDefiningCode()).isEqualTo(LocationOfMeasurementDefiningCode.FOREHEAD);
    BodyTemperatureObservation bodyTemperature2 = actual.getBodyTemperature().get(1);
    BodyTemperatureLocationOfMeasurementChoice locationOfMeasurement2 = bodyTemperature2.getLocationOfMeasurement();
    assertThat(locationOfMeasurement2.getClass()).isEqualTo(BodyTemperatureLocationOfMeasurementDvText.class);
    assertThat(((BodyTemperatureLocationOfMeasurementDvText) locationOfMeasurement2).getLocationOfMeasurementValue()).isEqualTo("location");
}
Also used : EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) 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) BodyTemperatureLocationOfMeasurementDvCodedText(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureLocationOfMeasurementDvCodedText) BodyTemperatureObservation(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureObservation) BodyTemperatureLocationOfMeasurementChoice(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureLocationOfMeasurementChoice) BodyTemperatureLocationOfMeasurementDvText(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureLocationOfMeasurementDvText) BodyTemperatureAnyEventPointEvent(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureAnyEventPointEvent) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) RMObject(com.nedap.archie.rm.RMObject) Test(org.junit.Test)

Example 2 with BodyTemperatureLocationOfMeasurementDvCodedText

use of org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureLocationOfMeasurementDvCodedText in project openEHR_SDK by ehrbase.

the class TestData method buildBodyTemperature1.

private static BodyTemperatureObservation buildBodyTemperature1() {
    BodyTemperatureObservation bodyTemperature = new BodyTemperatureObservation();
    bodyTemperature.setLanguage(Language.DE);
    bodyTemperature.setSubject(new PartySelf());
    bodyTemperature.setOriginValue(OffsetDateTime.now());
    bodyTemperature.setAnyEvent(new ArrayList<>());
    BodyTemperatureLocationOfMeasurementDvCodedText locationOfMeasurement = new BodyTemperatureLocationOfMeasurementDvCodedText();
    locationOfMeasurement.setLocationOfMeasurementDefiningCode(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.LocationOfMeasurementDefiningCode.FOREHEAD);
    bodyTemperature.setLocationOfMeasurement(locationOfMeasurement);
    BodyTemperatureAnyEventPointEvent history1 = new BodyTemperatureAnyEventPointEvent();
    history1.setTemperatureMagnitude(22d);
    history1.setTemperatureUnits("Cel");
    history1.setCurrentDayOfMenstrualCycleMagnitude(3l);
    history1.setTimeValue(OffsetDateTime.now());
    bodyTemperature.getAnyEvent().add(history1);
    BodyTemperatureAnyEventPointEvent history2 = new BodyTemperatureAnyEventPointEvent();
    history2.setTemperatureMagnitude(11d);
    history2.setTemperatureUnits("Cel");
    history2.setCurrentDayOfMenstrualCycleMagnitude(3l);
    history2.setTimeValue(OffsetDateTime.now());
    bodyTemperature.getAnyEvent().add(history2);
    return bodyTemperature;
}
Also used : BodyTemperatureLocationOfMeasurementDvCodedText(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureLocationOfMeasurementDvCodedText) BodyTemperatureObservation(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureObservation) BodyTemperatureAnyEventPointEvent(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureAnyEventPointEvent) PartySelf(com.nedap.archie.rm.generic.PartySelf)

Aggregations

PartySelf (com.nedap.archie.rm.generic.PartySelf)2 BodyTemperatureAnyEventPointEvent (org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureAnyEventPointEvent)2 BodyTemperatureLocationOfMeasurementDvCodedText (org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureLocationOfMeasurementDvCodedText)2 BodyTemperatureObservation (org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureObservation)2 RMObject (com.nedap.archie.rm.RMObject)1 Locatable (com.nedap.archie.rm.archetyped.Locatable)1 Composition (com.nedap.archie.rm.composition.Composition)1 ContentItem (com.nedap.archie.rm.composition.ContentItem)1 Observation (com.nedap.archie.rm.composition.Observation)1 Event (com.nedap.archie.rm.datastructures.Event)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 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)1 IOException (java.io.IOException)1 URI (java.net.URI)1 StandardCharsets (java.nio.charset.StandardCharsets)1 Duration (java.time.Duration)1 OffsetDateTime (java.time.OffsetDateTime)1