Search in sources :

Example 1 with EhrbaseBloodPressureSimpleDeV0Composition

use of org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition in project openEHR_SDK by ehrbase.

the class DefaultRestAqlEndpointTestIT method testExecuteEntityQueryWithList.

@Test
public void testExecuteEntityQueryWithList() {
    ehr = openEhrClient.ehrEndpoint().createEhr();
    EhrbaseBloodPressureSimpleDeV0Composition comp1 = openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(TestData.buildEhrbaseBloodPressureSimpleDeV0());
    EhrbaseBloodPressureSimpleDeV0Composition comp2 = openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(TestData.buildEhrbaseBloodPressureSimpleDeV0());
    EhrbaseBloodPressureSimpleDeV0CompositionContainment containmentComposition = EhrbaseBloodPressureSimpleDeV0CompositionContainment.getInstance();
    EntityQuery<Record2<TemporalAccessor, List<BloodPressureTrainingSampleObservation>>> entityQuery = Query.buildEntityQuery(containmentComposition, containmentComposition.START_TIME_VALUE, containmentComposition.BLOOD_PRESSURE_TRAINING_SAMPLE);
    Parameter<UUID> ehrIdParameter = entityQuery.buildParameter();
    entityQuery.where(Condition.equal(EhrFields.EHR_ID(), ehrIdParameter));
    List<Record2<TemporalAccessor, List<BloodPressureTrainingSampleObservation>>> actual = openEhrClient.aqlEndpoint().execute(entityQuery, ehrIdParameter.setValue(ehr));
    assertThat(actual).size().isEqualTo(2);
}
Also used : BloodPressureTrainingSampleObservation(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.definition.BloodPressureTrainingSampleObservation) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) UUID(java.util.UUID) Record2(org.ehrbase.client.aql.record.Record2) EhrbaseBloodPressureSimpleDeV0CompositionContainment(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0CompositionContainment) Test(org.junit.Test)

Example 2 with EhrbaseBloodPressureSimpleDeV0Composition

use of org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition in project openEHR_SDK by ehrbase.

the class DefaultRestAqlEndpointTestIT method testExecuteEntityQuery.

@Test
public void testExecuteEntityQuery() {
    ehr = openEhrClient.ehrEndpoint().createEhr();
    EhrbaseBloodPressureSimpleDeV0Composition comp1 = openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(TestData.buildEhrbaseBloodPressureSimpleDeV0());
    EhrbaseBloodPressureSimpleDeV0Composition comp2 = openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(TestData.buildEhrbaseBloodPressureSimpleDeV0());
    EhrbaseBloodPressureSimpleDeV0CompositionContainment containmentComposition = EhrbaseBloodPressureSimpleDeV0CompositionContainment.getInstance();
    BloodPressureTrainingSampleObservationContainment containmentObservation = BloodPressureTrainingSampleObservationContainment.getInstance();
    containmentComposition.setContains(containmentObservation);
    EntityQuery<Record3<TemporalAccessor, BloodPressureTrainingSampleObservation, CuffSizeDefiningCode>> entityQuery = Query.buildEntityQuery(containmentComposition, containmentComposition.START_TIME_VALUE, containmentObservation.BLOOD_PRESSURE_TRAINING_SAMPLE_OBSERVATION, containmentObservation.CUFF_SIZE_DEFINING_CODE);
    Parameter<UUID> ehrIdParameter = entityQuery.buildParameter();
    entityQuery.where(Condition.equal(EhrFields.EHR_ID(), ehrIdParameter));
    List<Record3<TemporalAccessor, BloodPressureTrainingSampleObservation, CuffSizeDefiningCode>> actual = openEhrClient.aqlEndpoint().execute(entityQuery, ehrIdParameter.setValue(ehr));
    assertThat(actual).size().isEqualTo(2);
    Record3<TemporalAccessor, BloodPressureTrainingSampleObservation, CuffSizeDefiningCode> record1 = actual.get(0);
    assertThat(record1.value1()).isEqualTo(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
    assertThat(record1.value2().getKorotkoffSoundsDefiningCode()).isEqualTo(KorotkoffSoundsDefiningCode.FIFTH_SOUND);
    assertThat(record1.value3()).isEqualTo(CuffSizeDefiningCode.ADULT);
}
Also used : BloodPressureTrainingSampleObservation(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.definition.BloodPressureTrainingSampleObservation) BloodPressureTrainingSampleObservationContainment(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.definition.BloodPressureTrainingSampleObservationContainment) TemporalAccessor(java.time.temporal.TemporalAccessor) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) UUID(java.util.UUID) CuffSizeDefiningCode(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.definition.CuffSizeDefiningCode) Record3(org.ehrbase.client.aql.record.Record3) EhrbaseBloodPressureSimpleDeV0CompositionContainment(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0CompositionContainment) Test(org.junit.Test)

Example 3 with EhrbaseBloodPressureSimpleDeV0Composition

use of org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition in project openEHR_SDK by ehrbase.

the class DefaultRestCompositionEndpointIT method testDeleteCompositionInvalidPrecedingVersionUid.

@Test
public void testDeleteCompositionInvalidPrecedingVersionUid() {
    ehr = openEhrClient.ehrEndpoint().createEhr();
    CompositionEndpoint compositionEndpoint = openEhrClient.compositionEndpoint(ehr);
    EhrbaseBloodPressureSimpleDeV0Composition composition = TestData.buildEhrbaseBloodPressureSimpleDeV0();
    composition = compositionEndpoint.mergeCompositionEntity(composition);
    composition = compositionEndpoint.mergeCompositionEntity(composition);
    VersionUid precedingVersionUid = new VersionUid(composition.getVersionUid().getUuid(), composition.getVersionUid().getSystem(), 1);
    assertThrows(WrongStatusCodeException.class, () -> compositionEndpoint.delete(precedingVersionUid));
}
Also used : CompositionEndpoint(org.ehrbase.client.openehrclient.CompositionEndpoint) VersionUid(org.ehrbase.client.openehrclient.VersionUid) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) Test(org.junit.Test)

Example 4 with EhrbaseBloodPressureSimpleDeV0Composition

use of org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition in project openEHR_SDK by ehrbase.

the class DefaultRestCompositionEndpointIT method testSaveCompositionEntityCgiProxy.

@Test
public void testSaveCompositionEntityCgiProxy() {
    ehr = openEhrClient.ehrEndpoint().createEhr();
    EhrbaseBloodPressureSimpleDeV0Composition bloodPressureSimpleDeV0 = TestData.buildEhrbaseBloodPressureSimpleDeV0();
    Enhancer enhancer = new Enhancer();
    enhancer.setSuperclass(EhrbaseBloodPressureSimpleDeV0Composition.class);
    enhancer.setCallback((MethodInterceptor) (obj, method, args, proxy) -> {
        if (method.getDeclaringClass() != Object.class && method.getName().equals("getLanguage")) {
            return Language.EN;
        } else {
            return proxy.invokeSuper(obj, args);
        }
    });
    EhrbaseBloodPressureSimpleDeV0Composition proxy = (EhrbaseBloodPressureSimpleDeV0Composition) enhancer.create();
    proxy.setStartTimeValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
    proxy.setEndTimeValue(OffsetDateTime.now());
    proxy.setBloodPressureTrainingSample(new ArrayList<>());
    proxy.setLanguage(Language.DE);
    proxy.setTerritory(Territory.DE);
    proxy.setCategoryDefiningCode(org.ehrbase.client.classgenerator.shareddefinition.Category.EVENT);
    proxy.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
    proxy.setComposer(new PartyIdentified(null, "Test", null));
    proxy.setParticipations(new ArrayList<>());
    proxy.getParticipations().add(new Participation(new PartyIdentified(null, "Test", null), new DvText("Pos1"), null, null));
    proxy.getParticipations().add(new Participation(new PartyIdentified(null, "Test2", null), new DvText("Pos2"), null, null));
    proxy.setBloodPressureTrainingSample(bloodPressureSimpleDeV0.getBloodPressureTrainingSample());
    openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(proxy);
    assertThat(proxy.getVersionUid()).isNotNull();
    assertThat(proxy.getVersionUid().getVersion()).isEqualTo(1L);
    EhrbaseBloodPressureSimpleDeV0Composition actual = openEhrClient.compositionEndpoint(ehr).find(proxy.getVersionUid().getUuid(), EhrbaseBloodPressureSimpleDeV0Composition.class).get();
    assertThat(actual.getLanguage()).isEqualTo(Language.EN);
}
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) Participation(com.nedap.archie.rm.generic.Participation) Enhancer(net.sf.cglib.proxy.Enhancer) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) DvText(com.nedap.archie.rm.datavalues.DvText) Test(org.junit.Test)

Example 5 with EhrbaseBloodPressureSimpleDeV0Composition

use of org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition in project openEHR_SDK by ehrbase.

the class DefaultRestCompositionEndpointIT method testSaveCompositionEntityNative.

@Test
public void testSaveCompositionEntityNative() {
    ehr = openEhrClient.ehrEndpoint().createEhr();
    EhrbaseBloodPressureSimpleDeV0Composition bloodPressureSimpleDeV0 = TestData.buildEhrbaseBloodPressureSimpleDeV0();
    openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(bloodPressureSimpleDeV0);
    assertThat(bloodPressureSimpleDeV0.getVersionUid()).isNotNull();
    assertThat(bloodPressureSimpleDeV0.getVersionUid().getVersion()).isEqualTo(1L);
    Optional<Composition> aNative = openEhrClient.compositionEndpoint(ehr).findRaw(bloodPressureSimpleDeV0.getVersionUid().getUuid());
    assertThat(aNative).isPresent();
    assertThat(aNative.get().getUid().getExtension()).isEqualTo("local.ehrbase.org::1");
    VersionUid versionUid = openEhrClient.compositionEndpoint(ehr).mergeRaw(aNative.get());
    assertThat(versionUid.getVersion()).isEqualTo(2l);
    aNative.get().setUid(null);
    versionUid = openEhrClient.compositionEndpoint(ehr).mergeRaw(aNative.get());
    assertThat(versionUid.getVersion()).isEqualTo(1L);
}
Also used : Composition(com.nedap.archie.rm.composition.Composition) GECCOSerologischerBefundComposition(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.GECCOSerologischerBefundComposition) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) VirologischerBefundComposition(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition) VersionUid(org.ehrbase.client.openehrclient.VersionUid) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) Test(org.junit.Test)

Aggregations

EhrbaseBloodPressureSimpleDeV0Composition (org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition)32 Test (org.junit.Test)30 Record2 (org.ehrbase.client.aql.record.Record2)14 ParameterValue (org.ehrbase.client.aql.parameter.ParameterValue)12 VersionUid (org.ehrbase.client.openehrclient.VersionUid)11 UUID (java.util.UUID)10 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)8 EhrbaseBloodPressureSimpleDeV0CompositionContainment (org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0CompositionContainment)7 OffsetDateTime (java.time.OffsetDateTime)6 ZoneOffset (java.time.ZoneOffset)6 ArrayList (java.util.ArrayList)6 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)6 Tuple (org.assertj.core.groups.Tuple)6 TestData (org.ehrbase.client.TestData)6 EhrbaseMultiOccurrenceDeV1Composition (org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition)6 Composition (com.nedap.archie.rm.composition.Composition)5 DvText (com.nedap.archie.rm.datavalues.DvText)5 Condition (org.ehrbase.client.aql.condition.Condition)5 Record1 (org.ehrbase.client.aql.record.Record1)5 BloodPressureTrainingSampleObservationContainment (org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.definition.BloodPressureTrainingSampleObservationContainment)5