Search in sources :

Example 1 with AbteilungsfallClusterContainment

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"));
}
Also used : AbteilungsfallClusterContainment(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.AbteilungsfallClusterContainment) StandortClusterContainment(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.StandortClusterContainment) VersorgungsortAdminEntryContainment(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.VersorgungsortAdminEntryContainment) ContainmentExpression(org.ehrbase.client.aql.containment.ContainmentExpression) PatientenaufenthaltCompositionContainment(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.PatientenaufenthaltCompositionContainment) UUID(java.util.UUID) Record3(org.ehrbase.client.aql.record.Record3) Tuple(org.assertj.core.groups.Tuple) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) Test(org.junit.Test)

Aggregations

DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)1 UUID (java.util.UUID)1 Tuple (org.assertj.core.groups.Tuple)1 ContainmentExpression (org.ehrbase.client.aql.containment.ContainmentExpression)1 Record3 (org.ehrbase.client.aql.record.Record3)1 PatientenaufenthaltCompositionContainment (org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.PatientenaufenthaltCompositionContainment)1 AbteilungsfallClusterContainment (org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.AbteilungsfallClusterContainment)1 StandortClusterContainment (org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.StandortClusterContainment)1 VersorgungsortAdminEntryContainment (org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.VersorgungsortAdminEntryContainment)1 Test (org.junit.Test)1