use of org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.AbteilungsfallClusterContainment in project openEHR_SDK by ehrbase.
the class CoronaTestIT method testNUMResearchCase_5.
/**
* see https://wiki.vitagroup.ag/display/NUM/Research+Repository
*
* Containment test:
*
* contains COMPOSITION c[openEHR-EHR-COMPOSITION.event_summary.v0]
* contains
* (CLUSTER n[openEHR-EHR-CLUSTER.case_identification.v0]
* and ADMIN_ENTRY u[openEHR-EHR-ADMIN_ENTRY.hospitalization.v0]
* contains (CLUSTER a[openEHR-EHR-CLUSTER.location.v1]))
*/
@Test
public void testNUMResearchCase_5() {
ehr = openEhrClient.ehrEndpoint().createEhr();
openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(TestData.buildTestPatientenaufenthaltComposition());
// build AQL
PatientenaufenthaltCompositionContainment patientenaufenthaltCompositionContainment = PatientenaufenthaltCompositionContainment.getInstance();
AbteilungsfallClusterContainment abteilungsfallClusterContainment = AbteilungsfallClusterContainment.getInstance();
VersorgungsortAdminEntryContainment versorgungsortAdminEntryContainment = VersorgungsortAdminEntryContainment.getInstance();
StandortClusterContainment standortClusterContainment = StandortClusterContainment.getInstance();
ContainmentExpression containmentExpression = patientenaufenthaltCompositionContainment.contains(abteilungsfallClusterContainment.and(versorgungsortAdminEntryContainment.contains(standortClusterContainment)));
// select set values from test data
EntityQuery<Record3<TemporalAccessor, TemporalAccessor, String>> entityQuery = Query.buildEntityQuery(containmentExpression, versorgungsortAdminEntryContainment.BEGINN_VALUE, versorgungsortAdminEntryContainment.ENDE_VALUE, versorgungsortAdminEntryContainment.GRUND_DES_AUFENTHALTES_VALUE);
Parameter<UUID> ehrIdParameter = entityQuery.buildParameter();
entityQuery.where(Condition.equal(EhrFields.EHR_ID(), ehrIdParameter));
List<Record3<TemporalAccessor, TemporalAccessor, String>> actual = openEhrClient.aqlEndpoint().execute(entityQuery, ehrIdParameter.setValue(ehr));
assertThat(actual).extracting(Record3::value1, Record3::value2, Record3::value3).containsExactlyInAnyOrder(new Tuple(new DvDateTime("2020-01-01T10:00Z").getValue(), new DvDateTime("2020-01-01T12:00Z").getValue(), "test value"));
}
Aggregations