use of org.ehrbase.client.openehrclient.CompositionEndpoint 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));
}
use of org.ehrbase.client.openehrclient.CompositionEndpoint in project openEHR_SDK by ehrbase.
the class DefaultRestCompositionEndpointIT method testDeleteCompositionUnknownPrecedingVersionUid.
@Test
public void testDeleteCompositionUnknownPrecedingVersionUid() {
ehr = openEhrClient.ehrEndpoint().createEhr();
CompositionEndpoint compositionEndpoint = openEhrClient.compositionEndpoint(ehr);
VersionUid precedingVersionUid = new VersionUid("bdd8e4f3-b587-479f-a2ff-d4143ef9ea06::local.ehrbase.org::1");
assertThatNoException().isThrownBy(() -> compositionEndpoint.delete(precedingVersionUid));
}
use of org.ehrbase.client.openehrclient.CompositionEndpoint 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");
}
use of org.ehrbase.client.openehrclient.CompositionEndpoint in project openEHR_SDK by ehrbase.
the class DefaultRestCompositionEndpointIT method testFind.
@Test
public void testFind() {
ehr = openEhrClient.ehrEndpoint().createEhr();
EhrbaseBloodPressureSimpleDeV0Composition bloodPressureSimpleDeV0 = TestData.buildEhrbaseBloodPressureSimpleDeV0();
CompositionEndpoint compositionEndpoint = openEhrClient.compositionEndpoint(ehr);
EhrbaseBloodPressureSimpleDeV0Composition version1 = compositionEndpoint.mergeCompositionEntity(bloodPressureSimpleDeV0);
Optional<EhrbaseBloodPressureSimpleDeV0Composition> actual = compositionEndpoint.find(version1.getVersionUid().getUuid(), EhrbaseBloodPressureSimpleDeV0Composition.class);
assertTrue(actual.isPresent());
assertThat(actual.get().getComposer()).isNotNull().extracting(Object::getClass).isEqualTo(PartyIdentified.class);
PartyIdentified composer = (PartyIdentified) actual.get().getComposer();
assertThat(composer.getName()).isEqualTo("Test");
assertThat(actual.get().getBloodPressureTrainingSample()).size().isEqualTo(1);
assertThat(actual.get().getBloodPressureTrainingSample().get(0).getSubject()).isNotNull().extracting(Object::getClass).isEqualTo(PartySelf.class);
assertThat(actual.get().getBloodPressureTrainingSample().get(0).getSystolicMagnitude()).isEqualTo(22d);
assertThat(actual.get().getBloodPressureTrainingSample().get(0).getSystolicUnits()).isEqualTo("mm[Hg]");
assertThat(actual.get().getBloodPressureTrainingSample().get(0).getKorotkoffSoundsDefiningCode()).isEqualTo(KorotkoffSoundsDefiningCode.FIFTH_SOUND);
}
use of org.ehrbase.client.openehrclient.CompositionEndpoint 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"));
}
Aggregations