Search in sources :

Example 1 with EpisodeofcareTeamElement

use of org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareTeamElement 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 EpisodeofcareTeamElement

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

the class FlattenerTest method testFlattenEpisodeOfCare.

@Test
public void testFlattenEpisodeOfCare() {
    Composition composition = (Composition) new Unflattener(new TestDataTemplateProvider()).unflatten(buildEpisodeOfCareComposition());
    Flattener cut = new Flattener(new TestDataTemplateProvider());
    EpisodeOfCareComposition actual = cut.flatten(composition, EpisodeOfCareComposition.class);
    assertThat(actual).isNotNull();
    assertThat(actual.getEpisodeofcare()).size().isEqualTo(1);
    EpisodeofcareAdminEntry episodeofcareAdminEntry = actual.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 : 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) EpisodeofcareAdminEntry(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareAdminEntry) TestData.buildEpisodeOfCareComposition(org.ehrbase.client.TestData.buildEpisodeOfCareComposition) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) Test(org.junit.Test)

Example 3 with EpisodeofcareTeamElement

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

the class TestData method buildEpisodeOfCareComposition.

public static EpisodeOfCareComposition buildEpisodeOfCareComposition() {
    EpisodeOfCareComposition episode = new EpisodeOfCareComposition();
    episode.setComposer(new PartyIdentified(null, "Test", null));
    episode.setCategoryDefiningCode(Category.EVENT);
    episode.setLanguage(Language.DE);
    episode.setTerritory(Territory.DE);
    episode.setEpisodeofcare(new ArrayList<>());
    episode.setStartTimeValue(OffsetDateTime.now());
    episode.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
    FeederAudit audit = new FeederAudit();
    audit.setFeederSystemAudit(new FeederAuditDetails());
    audit.getFeederSystemAudit().setSystemId("System 1");
    audit.setOriginatingSystemAudit(new FeederAuditDetails());
    audit.getOriginatingSystemAudit().setSystemId("System 2");
    episode.setFeederAudit(audit);
    EpisodeofcareAdminEntry episodeofcareAdminEntry = new EpisodeofcareAdminEntry();
    episodeofcareAdminEntry.setUpperValue(OffsetDateTime.now());
    episodeofcareAdminEntry.setLowerValue(OffsetDateTime.now());
    episodeofcareAdminEntry.setLanguage(Language.DE);
    episodeofcareAdminEntry.setSubject(new PartySelf());
    episodeofcareAdminEntry.setIdentifier(new ArrayList<>());
    EpisodeofcareIdentifierElement identifierElement = new EpisodeofcareIdentifierElement();
    DvIdentifier value = new DvIdentifier();
    value.setId("123");
    identifierElement.setValue(value);
    episodeofcareAdminEntry.getIdentifier().add(identifierElement);
    EpisodeofcareIdentifierElement identifierElement2 = new EpisodeofcareIdentifierElement();
    DvIdentifier value2 = new DvIdentifier();
    value2.setId("456");
    identifierElement2.setValue(value2);
    episodeofcareAdminEntry.getIdentifier().add(identifierElement2);
    episodeofcareAdminEntry.setTeam(new ArrayList<>());
    EpisodeofcareTeamElement teamElement1 = new EpisodeofcareTeamElement();
    teamElement1.setValue(URI.create("https://github.com/ehrbase"));
    episodeofcareAdminEntry.getTeam().add(teamElement1);
    episode.getEpisodeofcare().add(episodeofcareAdminEntry);
    return episode;
}
Also used : FeederAudit(com.nedap.archie.rm.archetyped.FeederAudit) EpisodeofcareIdentifierElement(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareIdentifierElement) EpisodeofcareTeamElement(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareTeamElement) FeederAuditDetails(com.nedap.archie.rm.archetyped.FeederAuditDetails) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) EpisodeofcareAdminEntry(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareAdminEntry) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) PartySelf(com.nedap.archie.rm.generic.PartySelf) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier)

Aggregations

PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)3 PartySelf (com.nedap.archie.rm.generic.PartySelf)3 EpisodeOfCareComposition (org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition)3 EpisodeofcareAdminEntry (org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareAdminEntry)3 EpisodeofcareTeamElement (org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareTeamElement)3 Composition (com.nedap.archie.rm.composition.Composition)2 IOException (java.io.IOException)2 URI (java.net.URI)2 StandardCharsets (java.nio.charset.StandardCharsets)2 OffsetDateTime (java.time.OffsetDateTime)2 ZoneOffset (java.time.ZoneOffset)2 IOUtils (org.apache.commons.io.IOUtils)2 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2 Tuple (org.assertj.core.groups.Tuple)2 TestData (org.ehrbase.client.TestData)2 EhrbaseBloodPressureSimpleDeV0Composition (org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition)2 KorotkoffSoundsDefiningCode (org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.definition.KorotkoffSoundsDefiningCode)2 RMObject (com.nedap.archie.rm.RMObject)1 FeederAudit (com.nedap.archie.rm.archetyped.FeederAudit)1 FeederAuditDetails (com.nedap.archie.rm.archetyped.FeederAuditDetails)1