Search in sources :

Example 1 with EpisodeOfCareComposition

use of org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition in project openEHR_SDK by ehrbase.

the class DefaultRestCompositionEndpointIT method testEpisodeOfCare.

@Test
public void testEpisodeOfCare() {
    ehr = openEhrClient.ehrEndpoint().createEhr();
    EpisodeOfCareComposition bloodPressureSimpleDeV0 = TestData.buildEpisodeOfCareComposition();
    CompositionEndpoint compositionEndpoint = openEhrClient.compositionEndpoint(ehr);
    EpisodeOfCareComposition version1 = compositionEndpoint.mergeCompositionEntity(bloodPressureSimpleDeV0);
    Optional<EpisodeOfCareComposition> actual = compositionEndpoint.find(version1.getVersionUid().getUuid(), EpisodeOfCareComposition.class);
    assertTrue(actual.isPresent());
    assertThat(actual.get().getVersionUid()).extracting(v -> v.getUuid().toString(), VersionUid::getVersion).containsExactly(version1.getVersionUid().getUuid().toString(), 1L);
    assertThat(actual.get().getFeederAudit()).isNotNull().extracting(feederAudit -> feederAudit.getFeederSystemAudit().getSystemId(), feederAudit1 -> feederAudit1.getOriginatingSystemAudit().getSystemId()).containsExactly("System 1", "System 2");
    assertThat(actual.get().getEpisodeofcare()).size().isEqualTo(1);
    EpisodeofcareAdminEntry episodeofcareAdminEntry = actual.get().getEpisodeofcare().get(0);
    assertThat(episodeofcareAdminEntry.getIdentifier()).extracting(e -> e.getValue().getId()).containsExactlyInAnyOrder("123", "456");
    assertThat(episodeofcareAdminEntry.getTeam()).extracting(EpisodeofcareTeamElement::getValue).containsExactlyInAnyOrder(URI.create("https://github.com/ehrbase"));
}
Also used : 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) EpisodeofcareAdminEntry(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareAdminEntry) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) Test(org.junit.Test)

Example 2 with EpisodeOfCareComposition

use of org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition in project openEHR_SDK by ehrbase.

the class DefaultRestVersionedCompositionEndpointIT method testFindVersionByIdWrongVersionedObjectUid.

@Test
public void testFindVersionByIdWrongVersionedObjectUid() {
    ehrId = openEhrClient.ehrEndpoint().createEhr();
    EpisodeOfCareComposition composition = TestData.buildEpisodeOfCareComposition();
    openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition);
    Optional<OriginalVersion<EpisodeOfCareComposition>> originalVersion = openEhrClient.versionedCompositionEndpoint(ehrId).findVersionById(UUID.randomUUID(), composition.getVersionUid(), EpisodeOfCareComposition.class);
    Assert.assertTrue(originalVersion.isEmpty());
}
Also used : OriginalVersion(com.nedap.archie.rm.changecontrol.OriginalVersion) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) Test(org.junit.Test)

Example 3 with EpisodeOfCareComposition

use of org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition in project openEHR_SDK by ehrbase.

the class DefaultRestVersionedCompositionEndpointIT method testFindVersionById.

@Test
public void testFindVersionById() {
    ehrId = openEhrClient.ehrEndpoint().createEhr();
    EpisodeOfCareComposition composition = TestData.buildEpisodeOfCareComposition();
    openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition);
    VersionUid v2 = openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition).getVersionUid();
    openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition);
    Optional<OriginalVersion<EpisodeOfCareComposition>> originalVersion = openEhrClient.versionedCompositionEndpoint(ehrId).findVersionById(v2.getUuid(), v2, EpisodeOfCareComposition.class);
    Assert.assertTrue(originalVersion.isPresent());
    Assert.assertEquals(v2.toString(), originalVersion.get().getUid().getValue());
    Assert.assertEquals(composition.getLanguage(), originalVersion.get().getData().getLanguage());
}
Also used : OriginalVersion(com.nedap.archie.rm.changecontrol.OriginalVersion) VersionUid(org.ehrbase.client.openehrclient.VersionUid) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) Test(org.junit.Test)

Example 4 with EpisodeOfCareComposition

use of org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition in project openEHR_SDK by ehrbase.

the class DefaultRestVersionedCompositionEndpointIT method testFindVersionAtTimeNull.

@Test
public void testFindVersionAtTimeNull() {
    ehrId = openEhrClient.ehrEndpoint().createEhr();
    EpisodeOfCareComposition composition = TestData.buildEpisodeOfCareComposition();
    openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition);
    openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition);
    openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition);
    Optional<OriginalVersion<EpisodeOfCareComposition>> originalVersion = openEhrClient.versionedCompositionEndpoint(ehrId).findVersionAtTime(composition.getVersionUid().getUuid(), null, EpisodeOfCareComposition.class);
    Assert.assertTrue(originalVersion.isPresent());
    Assert.assertEquals(composition.getVersionUid().toString(), originalVersion.get().getUid().getValue());
    Assert.assertEquals(composition.getLanguage(), originalVersion.get().getData().getLanguage());
}
Also used : OriginalVersion(com.nedap.archie.rm.changecontrol.OriginalVersion) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) Test(org.junit.Test)

Example 5 with EpisodeOfCareComposition

use of org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition in project openEHR_SDK by ehrbase.

the class UnflattenerTest method testUnflattenEpsiode.

@Test
public void testUnflattenEpsiode() {
    EpisodeOfCareComposition episode = buildEpisodeOfCareComposition();
    Unflattener cut = new Unflattener(new TestDataTemplateProvider());
    Composition actual = (Composition) cut.unflatten(episode);
    assertThat(actual).isNotNull();
    assertThat(actual.getContent()).size().isEqualTo(1);
    AdminEntry actualAdminEntry = (AdminEntry) actual.getContent().get(0);
    List<Object> identifiers = actualAdminEntry.itemsAtPath("/data[at0001]/items[at0002]/value");
    assertThat(identifiers).extracting(i -> ((DvIdentifier) i).getId()).containsExactlyInAnyOrder("123", "456");
    List<Object> uris = actualAdminEntry.itemsAtPath("/data[at0001]/items[at0013]/value");
    assertThat(uris).extracting(u -> ((DvURI) u).getValue()).containsExactlyInAnyOrder(URI.create("https://github.com/ehrbase"));
}
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) AdminEntry(com.nedap.archie.rm.composition.AdminEntry) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier) DvURI(com.nedap.archie.rm.datavalues.DvURI) Test(org.junit.Test)

Aggregations

EpisodeOfCareComposition (org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition)9 Test (org.junit.Test)8 OriginalVersion (com.nedap.archie.rm.changecontrol.OriginalVersion)5 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)4 PartySelf (com.nedap.archie.rm.generic.PartySelf)4 Composition (com.nedap.archie.rm.composition.Composition)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 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 DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)2