Search in sources :

Example 1 with StandortClusterContainment

use of org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.StandortClusterContainment in project openEHR_SDK by ehrbase.

the class CoronaTestIT method testNUMResearchCase_1_2.

/**
 * see https://wiki.vitagroup.ag/display/NUM/Research+Repository
 * containment test:
 *     contains COMPOSITION c[openEHR-EHR-COMPOSITION.event_summary.v0]
 *         contains ADMIN_ENTRY m[openEHR-EHR-ADMIN_ENTRY.hospitalization.v0]
 *              contains CLUSTER k[openEHR-EHR-CLUSTER.location.v1]
 */
@Test
public void testNUMResearchCase_1_2() {
    ehr = openEhrClient.ehrEndpoint().createEhr();
    openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(TestData.buildTestPatientenaufenthaltComposition());
    // build AQL
    PatientenaufenthaltCompositionContainment patientenaufenthaltCompositionContainment = PatientenaufenthaltCompositionContainment.getInstance();
    VersorgungsortAdminEntryContainment versorgungsortAdminEntryContainment = VersorgungsortAdminEntryContainment.getInstance();
    StandortClusterContainment standortClusterContainment = StandortClusterContainment.getInstance();
    versorgungsortAdminEntryContainment.setContains(standortClusterContainment);
    patientenaufenthaltCompositionContainment.setContains(versorgungsortAdminEntryContainment);
    // select set values from test data
    EntityQuery<Record3<String, String, StandortschlusselDefiningCode>> entityQuery = Query.buildEntityQuery(patientenaufenthaltCompositionContainment, standortClusterContainment.STANDORTTYP_VALUE, standortClusterContainment.STANDORTBESCHREIBUNG_VALUE, standortClusterContainment.STANDORTSCHLUSSEL_DEFINING_CODE);
    Parameter<UUID> ehrIdParameter = entityQuery.buildParameter();
    entityQuery.where(Condition.equal(EhrFields.EHR_ID(), ehrIdParameter));
    List<Record3<String, String, StandortschlusselDefiningCode>> actual = openEhrClient.aqlEndpoint().execute(entityQuery, ehrIdParameter.setValue(ehr));
    assertThat(actual).extracting(Record3::value1, Record3::value2, Record3::value3).containsExactlyInAnyOrder(new Tuple("Test", "Beschreibung", StandortschlusselDefiningCode.ANGIOLOGIE));
}
Also used : StandortClusterContainment(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.StandortClusterContainment) VersorgungsortAdminEntryContainment(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.VersorgungsortAdminEntryContainment) 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) Test(org.junit.Test)

Example 2 with StandortClusterContainment

use of org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.StandortClusterContainment 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)

Example 3 with StandortClusterContainment

use of org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.StandortClusterContainment in project openEHR_SDK by ehrbase.

the class ContainmentNUMResearchTest method test_1.

@Test
public void test_1() {
    PatientenaufenthaltCompositionContainment patientenaufenthaltCompositionContainment = PatientenaufenthaltCompositionContainment.getInstance();
    // build AQL expression
    VersorgungsortAdminEntryContainment versorgungsortAdminEntryContainment = VersorgungsortAdminEntryContainment.getInstance();
    StandortClusterContainment standortClusterContainment = StandortClusterContainment.getInstance();
    versorgungsortAdminEntryContainment.setContains(standortClusterContainment);
    patientenaufenthaltCompositionContainment.setContains(versorgungsortAdminEntryContainment);
    Query.buildEntityQuery(patientenaufenthaltCompositionContainment);
    String aql = patientenaufenthaltCompositionContainment.buildAQL();
    assertNotNull(aql);
}
Also used : StandortClusterContainment(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.StandortClusterContainment) VersorgungsortAdminEntryContainment(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.VersorgungsortAdminEntryContainment) PatientenaufenthaltCompositionContainment(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.PatientenaufenthaltCompositionContainment) Test(org.junit.Test)

Aggregations

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