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"));
}
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());
}
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());
}
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());
}
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"));
}
Aggregations