Search in sources :

Example 1 with EhrbaseMultiOccurrenceDeV1Composition

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

the class DefaultRestCompositionEndpointIT method testEhrbaseMultiOccurrenceDeV1.

@Test
public void testEhrbaseMultiOccurrenceDeV1() {
    ehr = openEhrClient.ehrEndpoint().createEhr();
    EhrbaseMultiOccurrenceDeV1Composition bloodPressureSimpleDeV0 = TestData.buildEhrbaseMultiOccurrenceDeV1();
    CompositionEndpoint compositionEndpoint = openEhrClient.compositionEndpoint(ehr);
    EhrbaseMultiOccurrenceDeV1Composition version1 = compositionEndpoint.mergeCompositionEntity(bloodPressureSimpleDeV0);
    Optional<EhrbaseMultiOccurrenceDeV1Composition> actual = compositionEndpoint.find(version1.getVersionUid().getUuid(), EhrbaseMultiOccurrenceDeV1Composition.class);
    assertTrue(actual.isPresent());
    BodyTemperatureObservation bodyTemperature1 = actual.get().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.get().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) Language(org.ehrbase.client.classgenerator.shareddefinition.Language) Composition(com.nedap.archie.rm.composition.Composition) VersionUid(org.ehrbase.client.openehrclient.VersionUid) URISyntaxException(java.net.URISyntaxException) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) GECCOSerologischerBefundComposition(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.GECCOSerologischerBefundComposition) EpisodeofcareTeamElement(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareTeamElement) Assertions.assertThatNoException(org.assertj.core.api.Assertions.assertThatNoException) BefundJedesEreignisPointEvent(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.BefundJedesEreignisPointEvent) After(org.junit.After) URI(java.net.URI) ZoneOffset(java.time.ZoneOffset) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) MethodInterceptor(net.sf.cglib.proxy.MethodInterceptor) ProAnalytQuantitativesErgebnisDvCount(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.ProAnalytQuantitativesErgebnisDvCount) org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition) OpenEhrClient(org.ehrbase.client.openehrclient.OpenEhrClient) UUID(java.util.UUID) Category(org.junit.experimental.categories.Category) StandardCharsets(java.nio.charset.StandardCharsets) AnforderungDefiningCode(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.AnforderungDefiningCode) IOUtils(org.apache.commons.io.IOUtils) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) ParticipationMode(org.ehrbase.client.classgenerator.shareddefinition.ParticipationMode) LabortestBezeichnungDefiningCode(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.LabortestBezeichnungDefiningCode) OffsetDateTime(java.time.OffsetDateTime) OptimisticLockException(org.ehrbase.client.exception.OptimisticLockException) Optional(java.util.Optional) TestData(org.ehrbase.client.TestData) DefaultRestClientTestHelper.setupDefaultRestClientWithDefaultProvider(org.ehrbase.client.openehrclient.defaultrestclient.DefaultRestClientTestHelper.setupDefaultRestClientWithDefaultProvider) Territory(org.ehrbase.client.classgenerator.shareddefinition.Territory) BeforeClass(org.junit.BeforeClass) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) ArrayList(java.util.ArrayList) ProVirusCluster(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.ProVirusCluster) Flattener(org.ehrbase.client.flattener.Flattener) ClientException(org.ehrbase.client.exception.ClientException) Enhancer(net.sf.cglib.proxy.Enhancer) BefundObservation(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.BefundObservation) PartySelf(com.nedap.archie.rm.generic.PartySelf) Integration(org.ehrbase.client.Integration) Tuple(org.assertj.core.groups.Tuple) CanonicalJson(org.ehrbase.serialisation.jsonencoding.CanonicalJson) CompositionTestDataCanonicalJson(org.ehrbase.test_data.composition.CompositionTestDataCanonicalJson) DvText(com.nedap.archie.rm.datavalues.DvText) EpisodeofcareAdminEntry(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareAdminEntry) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) DefaultValuePath(org.ehrbase.serialisation.walker.defaultvalues.DefaultValuePath) WrongStatusCodeException(org.ehrbase.client.exception.WrongStatusCodeException) Test(org.junit.Test) IOException(java.io.IOException) Participation(com.nedap.archie.rm.generic.Participation) DefaultValues(org.ehrbase.serialisation.walker.defaultvalues.DefaultValues) KorotkoffSoundsDefiningCode(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.definition.KorotkoffSoundsDefiningCode) VirologischerBefundComposition(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition) VirusnachweistestDefiningCode(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.VirusnachweistestDefiningCode) CompositionEndpoint(org.ehrbase.client.openehrclient.CompositionEndpoint) Assert(org.junit.Assert) Collections(java.util.Collections) Setting(org.ehrbase.client.classgenerator.shareddefinition.Setting) CompositionEndpoint(org.ehrbase.client.openehrclient.CompositionEndpoint) Test(org.junit.Test)

Example 2 with EhrbaseMultiOccurrenceDeV1Composition

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

the class DefaultRestVersionedCompositionEndpointIT method testFindRevisionHistoryValid.

@Test
public void testFindRevisionHistoryValid() {
    ehrId = openEhrClient.ehrEndpoint().createEhr();
    EhrbaseMultiOccurrenceDeV1Composition composition = TestData.buildEhrbaseMultiOccurrenceDeV1();
    VersionUid v1 = openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition).getVersionUid();
    VersionUid v2 = openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition).getVersionUid();
    VersionUid v3 = openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition).getVersionUid();
    List<RevisionHistoryItem> revisionHistory = openEhrClient.versionedCompositionEndpoint(ehrId).findRevisionHistory(composition.getVersionUid().getUuid());
    Assert.assertEquals(3, revisionHistory.size());
    Assert.assertEquals(v1.toString(), revisionHistory.get(0).getVersionId().getValue());
    Assert.assertEquals(v2.toString(), revisionHistory.get(1).getVersionId().getValue());
    Assert.assertEquals(v3.toString(), revisionHistory.get(2).getVersionId().getValue());
}
Also used : EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) VersionUid(org.ehrbase.client.openehrclient.VersionUid) RevisionHistoryItem(com.nedap.archie.rm.generic.RevisionHistoryItem) Test(org.junit.Test)

Example 3 with EhrbaseMultiOccurrenceDeV1Composition

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

the class TestData method buildEhrbaseMultiOccurrenceDeV1.

public static EhrbaseMultiOccurrenceDeV1Composition buildEhrbaseMultiOccurrenceDeV1() {
    EhrbaseMultiOccurrenceDeV1Composition dto = new EhrbaseMultiOccurrenceDeV1Composition();
    dto.setStartTimeValue(OffsetDateTime.now());
    dto.setEndTimeValue(OffsetDateTime.now());
    dto.setLanguage(Language.DE);
    dto.setTerritory(Territory.DE);
    dto.setSettingDefiningCode(Setting.DENTAL_CARE);
    dto.setCategoryDefiningCode(Category.EVENT);
    dto.setComposer(new PartyIdentified(null, "Test", null));
    dto.setBodyTemperature(new ArrayList<>());
    dto.getBodyTemperature().add(buildBodyTemperature1());
    dto.getBodyTemperature().add(buildBodyTemperature2());
    return dto;
}
Also used : EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified)

Example 4 with EhrbaseMultiOccurrenceDeV1Composition

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

the class DefaultRestDirectoryEndpointIT method testSaveEntity.

@Test
public void testSaveEntity() {
    ehr = openEhrClient.ehrEndpoint().createEhr();
    FolderDAO root = openEhrClient.folder(ehr, "");
    FolderDAO visit = root.getSubFolder("case1/visit1");
    EhrbaseBloodPressureSimpleDeV0Composition bloodPressureSimpleDeV01 = TestData.buildEhrbaseBloodPressureSimpleDeV0();
    visit.addCompositionEntity(bloodPressureSimpleDeV01);
    EhrbaseBloodPressureSimpleDeV0Composition bloodPressureSimpleDeV02 = TestData.buildEhrbaseBloodPressureSimpleDeV0();
    visit.addCompositionEntity(bloodPressureSimpleDeV02);
    EhrbaseMultiOccurrenceDeV1Composition ehrbaseMultiOccurrenceDeV1 = TestData.buildEhrbaseMultiOccurrenceDeV1();
    visit.addCompositionEntity(ehrbaseMultiOccurrenceDeV1);
    List<EhrbaseBloodPressureSimpleDeV0Composition> actual = visit.find(EhrbaseBloodPressureSimpleDeV0Composition.class);
    assertThat(actual).size().isEqualTo(2);
    List<EhrbaseMultiOccurrenceDeV1Composition> actual2 = visit.find(EhrbaseMultiOccurrenceDeV1Composition.class);
    assertThat(actual2).size().isEqualTo(1);
}
Also used : EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) FolderDAO(org.ehrbase.client.openehrclient.FolderDAO) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) Test(org.junit.Test)

Example 5 with EhrbaseMultiOccurrenceDeV1Composition

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

the class UnflattenerTest method testUnflattenEhrbaseMultiOccurrenceDeV1.

@Test
public void testUnflattenEhrbaseMultiOccurrenceDeV1() {
    Unflattener cut = new Unflattener(new TestDataTemplateProvider());
    EhrbaseMultiOccurrenceDeV1Composition dto = TestData.buildEhrbaseMultiOccurrenceDeV1();
    Composition rmObject = (Composition) cut.unflatten(dto);
    assertThat(rmObject).isNotNull();
    assertThat(rmObject.getArchetypeDetails().getTemplateId().getValue()).isEqualTo("ehrbase_multi_occurrence.de.v1");
    List<Object> observationList = rmObject.itemsAtPath("/content[openEHR-EHR-OBSERVATION.body_temperature.v2]");
    assertThat(observationList).size().isEqualTo(2);
    Observation observation1 = (Observation) observationList.get(0);
    List<Object> objects = observation1.itemsAtPath("/data[at0002]/events");
    assertThat(objects).extracting(o -> ((PointEvent) o)).extracting(p -> (DvQuantity) p.itemAtPath("/data[at0001]/items[at0004]/value")).extracting(DvQuantity::getMagnitude).containsExactlyInAnyOrder(11d, 22d);
    DvCodedText dvCodedText = (DvCodedText) observation1.itemAtPath("/protocol[at0020]/items[at0021]/value");
    assertThat(dvCodedText.getValue()).isEqualTo("Forehead");
    Observation observation2 = (Observation) observationList.get(1);
    DvText dvText = (DvText) observation2.itemAtPath("/protocol[at0020]/items[at0021]/value");
    assertFalse(dvText instanceof DvCodedText);
    assertThat(dvText.getValue()).isEqualTo("location");
}
Also used : EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) 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) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) 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) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) DvText(com.nedap.archie.rm.datavalues.DvText) Test(org.junit.Test)

Aggregations

EhrbaseMultiOccurrenceDeV1Composition (org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition)6 Test (org.junit.Test)5 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)4 EhrbaseBloodPressureSimpleDeV0Composition (org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition)4 Composition (com.nedap.archie.rm.composition.Composition)3 PartySelf (com.nedap.archie.rm.generic.PartySelf)3 IOException (java.io.IOException)3 URI (java.net.URI)3 StandardCharsets (java.nio.charset.StandardCharsets)3 OffsetDateTime (java.time.OffsetDateTime)3 ZoneOffset (java.time.ZoneOffset)3 IOUtils (org.apache.commons.io.IOUtils)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 Tuple (org.assertj.core.groups.Tuple)3 TestData (org.ehrbase.client.TestData)3 EpisodeOfCareComposition (org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition)3 Locatable (com.nedap.archie.rm.archetyped.Locatable)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