Search in sources :

Example 1 with VirologischerBefundComposition

use of org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition in project openEHR_SDK by ehrbase.

the class TestData method buildTestVirologischerBefundComposition.

public static VirologischerBefundComposition buildTestVirologischerBefundComposition() {
    // openEHR-EHR-COMPOSITION.report-result.v1
    VirologischerBefundComposition virologischerBefundComposition = new VirologischerBefundComposition();
    virologischerBefundComposition.setComposer(new PartyIdentified(null, "Test", null));
    virologischerBefundComposition.setCategoryDefiningCode(Category.EVENT);
    virologischerBefundComposition.setLanguage(Language.DE);
    virologischerBefundComposition.setTerritory(Territory.DE);
    virologischerBefundComposition.setStartTimeValue(OffsetDateTime.now());
    virologischerBefundComposition.setSettingDefiningCode(Setting.SECONDARY_MEDICAL_CARE);
    // context, other_context
    FallidentifikationCluster fallidentifikationCluster = new FallidentifikationCluster();
    fallidentifikationCluster.setFallKennungValue("9251377");
    virologischerBefundComposition.setFallidentifikation(fallidentifikationCluster);
    virologischerBefundComposition.setBerichtIdValue("15a69a62-1ea7-4111-98a5-28aeae854bcd");
    virologischerBefundComposition.setStatusValue("Endbefund");
    // openEHR-EHR-CLUSTER.specimen.v1
    ProbeCluster probeCluster = new ProbeCluster();
    probeCluster.setZeitpunktDerProbenentnahmeValue(new DvDateTime("2020-04-01T12:00:00Z").getValue());
    probeCluster.setProbenartValue("Blut");
    probeCluster.setZeitpunktDesProbeneingangsValue(new DvDateTime("2020-04-02T09:00:00Z").getValue());
    probeCluster.setKommentarDesProbennehmersValue("Kommentar zur Probe");
    probeCluster.setKommentarValue("Kommentar");
    // openEHR-EHR-CLUSTER.laboratory_test_analyte.v1
    ProVirusCluster proVirusCluster1 = new ProVirusCluster();
    proVirusCluster1.setVirusValue("SARS-Cov-2");
    proVirusCluster1.setAnalyseergebnisReihenfolgeMagnitude(Long.valueOf(32));
    DvIdentifier identifier = new DvIdentifier();
    identifier.setIssuer("Issuer");
    identifier.setAssigner("Assigner");
    identifier.setId("9a0e5173-07c8-443d-b414-24432b9d95ca");
    identifier.setType("Prescription");
    proVirusCluster1.setZugehorigeLaborprobe(identifier);
    ProVirusCluster proVirusCluster2 = new ProVirusCluster();
    proVirusCluster2.setVirusValue("SARS-Cov-2");
    proVirusCluster2.setAnalyseergebnisReihenfolgeMagnitude(Long.valueOf(34));
    proVirusCluster2.setZugehorigeLaborprobe(identifier);
    // openEHR-EHR-CLUSTER.laboratory_test_panel.v0
    KulturCluster kulturCluster = new KulturCluster();
    kulturCluster.setProVirus(new ArrayList<>());
    kulturCluster.getProVirus().add(proVirusCluster1);
    kulturCluster.getProVirus().add(proVirusCluster2);
    // openEHR-EHR-OBSERVATION.laboratory_test_result.v1
    BefundObservation befundObservation = new BefundObservation();
    // set clusters in observation
    befundObservation.setKultur(new ArrayList<>());
    befundObservation.getKultur().add(kulturCluster);
    befundObservation.setProbe(new ArrayList<>());
    befundObservation.getProbe().add(probeCluster);
    befundObservation.setOriginValue(new DvDateTime("2020-04-02T12:00:00Z").getValue());
    befundObservation.setTimeValue(new DvDateTime("2020-04-02T14:00:00Z").getValue());
    befundObservation.setLabortestBezeichnungValue("Virologische Untersuchung");
    befundObservation.setSubject(new PartySelf());
    befundObservation.setLanguage(Language.DE);
    virologischerBefundComposition.setBefund(befundObservation);
    return virologischerBefundComposition;
}
Also used : BefundObservation(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.BefundObservation) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) ProbeCluster(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.ProbeCluster) VirologischerBefundComposition(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition) FallidentifikationCluster(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.FallidentifikationCluster) KulturCluster(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.KulturCluster) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) ProVirusCluster(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.ProVirusCluster) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier) PartySelf(com.nedap.archie.rm.generic.PartySelf)

Example 2 with VirologischerBefundComposition

use of org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition in project openEHR_SDK by ehrbase.

the class CoronaTestIT method testNUMResearchCase_8.

/**
 * see https://wiki.vitagroup.ag/display/NUM/Research+Repository
 *
 * Containment test UC 8:
 *
 * contains COMPOSITION c
 * contains OBSERVATION v[openEHR-EHR-OBSERVATION.laboratory_test_result.v1]
 * contains (
 * CLUSTER h[openEHR-EHR-CLUSTER.laboratory_test_panel.v0] and
 * CLUSTER x[openEHR-EHR-CLUSTER.specimen.v1] and
 * CLUSTER q[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1])
 */
@Test
public void testNUMResearchCase_8() {
    VirologischerBefundComposition virologischerBefundComposition = TestData.buildTestVirologischerBefundComposition();
    assertThat(virologischerBefundComposition.getBefund()).isNotNull();
    ehr = openEhrClient.ehrEndpoint().createEhr();
    openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(virologischerBefundComposition);
    // build AQL expression
    Containment compositionContainment = new Containment("COMPOSITION");
    BefundObservationContainment befundObservationContainment = BefundObservationContainment.getInstance();
    ProbeClusterContainment probeClusterContainment = ProbeClusterContainment.getInstance();
    KulturClusterContainment kulturClusterContainment = KulturClusterContainment.getInstance();
    ProVirusClusterContainment proVirusClusterContainment = ProVirusClusterContainment.getInstance();
    ContainmentExpression containmentExpression = compositionContainment.contains(befundObservationContainment.contains(kulturClusterContainment.and(probeClusterContainment.and(proVirusClusterContainment))));
    EntityQuery<Record2<String, Long>> entityQuery = Query.buildEntityQuery(containmentExpression, proVirusClusterContainment.VIRUS_VALUE, proVirusClusterContainment.ANALYSEERGEBNIS_REIHENFOLGE_MAGNITUDE);
    Parameter<UUID> ehrIdParameter = entityQuery.buildParameter();
    entityQuery.where(Condition.equal(EhrFields.EHR_ID(), ehrIdParameter).and(Condition.equal(new NativeSelectAqlField<>(compositionContainment, "/name/value", String.class), "Virologischer Befund")));
    List<Record2<String, Long>> actual = openEhrClient.aqlEndpoint().execute(entityQuery, ehrIdParameter.setValue(ehr));
    // NB. At the moment, we cannot specify DISTINCT with SDK
    assertThat(actual).extracting(Record2::value1, Record2::value2).containsExactlyInAnyOrder(new Tuple("SARS-Cov-2", 32L), new Tuple("SARS-Cov-2", 34L), new Tuple("SARS-Cov-2", 32L), new Tuple("SARS-Cov-2", 34L));
}
Also used : ContainmentExpression(org.ehrbase.client.aql.containment.ContainmentExpression) VirologischerBefundComposition(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition) ProVirusClusterContainment(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.ProVirusClusterContainment) ProbeClusterContainment(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.ProbeClusterContainment) KulturClusterContainment(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.KulturClusterContainment) UUID(java.util.UUID) Record2(org.ehrbase.client.aql.record.Record2) Tuple(org.assertj.core.groups.Tuple) FieberOderErhohteKorpertemperaturObservationContainment(org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.definition.FieberOderErhohteKorpertemperaturObservationContainment) Containment(org.ehrbase.client.aql.containment.Containment) BefundObservationContainment(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.BefundObservationContainment) VirologischerBefundCompositionContainment(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundCompositionContainment) ReisefallObservationContainment(org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.definition.ReisefallObservationContainment) KulturClusterContainment(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.KulturClusterContainment) ProbeClusterContainment(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.ProbeClusterContainment) RisikogebietSectionContainment(org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.definition.RisikogebietSectionContainment) SymptomeSectionContainment(org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.definition.SymptomeSectionContainment) AufnahmedatenAdminEntryContainment(org.ehrbase.client.classgenerator.examples.stationarerversorgungsfallcomposition.definition.AufnahmedatenAdminEntryContainment) EntlassungsdatenAdminEntryContainment(org.ehrbase.client.classgenerator.examples.stationarerversorgungsfallcomposition.definition.EntlassungsdatenAdminEntryContainment) HustenObservationContainment(org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.definition.HustenObservationContainment) PatientenaufenthaltCompositionContainment(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.PatientenaufenthaltCompositionContainment) VersorgungsortAdminEntryContainment(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.VersorgungsortAdminEntryContainment) StandortClusterContainment(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.StandortClusterContainment) CoronaAnamneseCompositionContainment(org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.CoronaAnamneseCompositionContainment) ProVirusClusterContainment(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.ProVirusClusterContainment) HeiserkeitObservationContainment(org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.definition.HeiserkeitObservationContainment) StationarerVersorgungsfallCompositionContainment(org.ehrbase.client.classgenerator.examples.stationarerversorgungsfallcomposition.StationarerVersorgungsfallCompositionContainment) AbteilungsfallClusterContainment(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.AbteilungsfallClusterContainment) BefundObservationContainment(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.BefundObservationContainment) Test(org.junit.Test)

Example 3 with VirologischerBefundComposition

use of org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition in project openEHR_SDK by ehrbase.

the class CoronaTestIT method testNUMResearchCase_3.

/**
 * see https://wiki.vitagroup.ag/display/NUM/Research+Repository
 *
 * Containment test:
 *
 * contains COMPOSITION c[openEHR-EHR-COMPOSITION.report-result.v1]
 * contains (
 * CLUSTER f[openEHR-EHR-CLUSTER.case_identification.v0] and
 * CLUSTER z[openEHR-EHR-CLUSTER.specimen.v1] and
 * CLUSTER j[openEHR-EHR-CLUSTER.laboratory_test_panel.v0]
 * contains CLUSTER g[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1])
 */
@Test
public void testNUMResearchCase_3() throws IOException {
    // Should use: TestData.buildTestVirologischerBefundComposition();
    // with the test data
    VirologischerBefundComposition virologischerBefundComposition = TestData.buildTestVirologischerBefundComposition();
    assertThat(virologischerBefundComposition.getBefund()).isNotNull();
    ehr = openEhrClient.ehrEndpoint().createEhr();
    openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(virologischerBefundComposition);
    // build AQL expression
    VirologischerBefundCompositionContainment virologischerBefundCompositionContainment = VirologischerBefundCompositionContainment.getInstance();
    ProbeClusterContainment probeClusterContainment = ProbeClusterContainment.getInstance();
    KulturClusterContainment kulturClusterContainment = KulturClusterContainment.getInstance();
    ProVirusClusterContainment proVirusClusterContainment = ProVirusClusterContainment.getInstance();
    // contains COMPOSITION c[openEHR-EHR-COMPOSITION.report-result.v1]
    // contains (
    // CLUSTER z[openEHR-EHR-CLUSTER.specimen.v1] and
    // CLUSTER j[openEHR-EHR-CLUSTER.laboratory_test_panel.v0]
    // contains CLUSTER g[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1])
    ContainmentExpression containmentExpression = virologischerBefundCompositionContainment.contains(probeClusterContainment.and(kulturClusterContainment.contains(proVirusClusterContainment)));
    EntityQuery<Record2<String, Long>> entityQuery = Query.buildEntityQuery(containmentExpression, proVirusClusterContainment.VIRUS_VALUE, proVirusClusterContainment.ANALYSEERGEBNIS_REIHENFOLGE_MAGNITUDE);
    Parameter<UUID> ehrIdParameter = entityQuery.buildParameter();
    entityQuery.where(Condition.equal(EhrFields.EHR_ID(), ehrIdParameter));
    List<Record2<String, Long>> actual = openEhrClient.aqlEndpoint().execute(entityQuery, ehrIdParameter.setValue(ehr));
    // NB. At the moment, we cannot specify DISTINCT with SDK
    assertThat(actual).extracting(Record2::value1, Record2::value2).containsExactlyInAnyOrder(new Tuple("SARS-Cov-2", 32L), new Tuple("SARS-Cov-2", 34L), new Tuple("SARS-Cov-2", 32L), new Tuple("SARS-Cov-2", 34L));
}
Also used : ProbeClusterContainment(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.ProbeClusterContainment) VirologischerBefundCompositionContainment(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundCompositionContainment) KulturClusterContainment(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.KulturClusterContainment) ContainmentExpression(org.ehrbase.client.aql.containment.ContainmentExpression) VirologischerBefundComposition(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition) UUID(java.util.UUID) Record2(org.ehrbase.client.aql.record.Record2) Tuple(org.assertj.core.groups.Tuple) ProVirusClusterContainment(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.ProVirusClusterContainment) Test(org.junit.Test)

Example 4 with VirologischerBefundComposition

use of org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition in project openEHR_SDK by ehrbase.

the class DefaultRestCompositionEndpointIT method testVirologischerBefund.

@Test
public void testVirologischerBefund() throws IOException {
    Composition composition = new CanonicalJson().unmarshal(IOUtils.toString(CompositionTestDataCanonicalJson.VIROLOGY_FINDING_WITH_SPECIMEN.getStream(), StandardCharsets.UTF_8), Composition.class);
    assertThat(composition.itemsAtPath("/content[openEHR-EHR-OBSERVATION.laboratory_test_result.v1]/data[at0001]/events[at0002]/data[at0003]")).isNotNull();
    Flattener flattener = new Flattener(new TestDataTemplateProvider());
    VirologischerBefundComposition virologischerBefundComposition = flattener.flatten(composition, VirologischerBefundComposition.class);
    assertThat(virologischerBefundComposition.getBefund()).isNotNull();
    // with the test data
    virologischerBefundComposition = TestData.buildTestVirologischerBefundComposition();
    assertThat(virologischerBefundComposition.getBefund()).isNotNull();
    ehr = openEhrClient.ehrEndpoint().createEhr();
    VirologischerBefundComposition version1 = openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(virologischerBefundComposition);
    Optional<VirologischerBefundComposition> actual = openEhrClient.compositionEndpoint(ehr).find(version1.getVersionUid().getUuid(), VirologischerBefundComposition.class);
    assertThat(actual).isPresent();
    assertThat(actual.get().getBefund()).isNotNull();
    assertThat(actual.get().getBefund().getKultur().get(0).getProVirus()).extracting(ProVirusCluster::getVirusValue, ProVirusCluster::getAnalyseergebnisReihenfolgeMagnitude).containsExactlyInAnyOrder(new Tuple("SARS-Cov-2", 32L), new Tuple("SARS-Cov-2", 34L));
}
Also used : Composition(com.nedap.archie.rm.composition.Composition) GECCOSerologischerBefundComposition(org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.GECCOSerologischerBefundComposition) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) VirologischerBefundComposition(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition) CanonicalJson(org.ehrbase.serialisation.jsonencoding.CanonicalJson) CompositionTestDataCanonicalJson(org.ehrbase.test_data.composition.CompositionTestDataCanonicalJson) Flattener(org.ehrbase.client.flattener.Flattener) VirologischerBefundComposition(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition) Tuple(org.assertj.core.groups.Tuple) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) Test(org.junit.Test)

Example 5 with VirologischerBefundComposition

use of org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition in project openEHR_SDK by ehrbase.

the class ArbitraryQueryOtherContextIT method setUp.

@Before
public void setUp() throws IOException {
    // normal test run
    ehrUUID = openEhrClient.ehrEndpoint().createEhr();
    compositionEndpoint = openEhrClient.compositionEndpoint(ehrUUID);
    aComposition = new CanonicalJson().unmarshal(IOUtils.toString(CompositionTestDataCanonicalJson.VIROLOGY_FINDING_WITH_SPECIMEN_NO_UPDATE.getStream(), StandardCharsets.UTF_8), Composition.class);
    Flattener flattener = new Flattener(new TestDataTemplateProvider());
    VirologischerBefundComposition virologischerBefundComposition = flattener.flatten(aComposition, VirologischerBefundComposition.class);
    // create the composition
    VirologischerBefundComposition comp = compositionEndpoint.mergeCompositionEntity(virologischerBefundComposition);
    compositionUUID = comp.getVersionUid().getUuid();
    arbitraryQuery = new ArbitraryQuery(ehrUUID, openEhrClient);
    simpleSelectQueryEngine = new SimpleSelectQuery(ehrUUID, compositionUUID, openEhrClient);
}
Also used : ArbitraryQuery(org.ehrbase.client.openehrclient.defaultrestclient.systematic.compositionquery.queries.arbitrary.ArbitraryQuery) CanonicalJson(org.ehrbase.serialisation.jsonencoding.CanonicalJson) CompositionTestDataCanonicalJson(org.ehrbase.test_data.composition.CompositionTestDataCanonicalJson) Composition(com.nedap.archie.rm.composition.Composition) VirologischerBefundComposition(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition) Flattener(org.ehrbase.client.flattener.Flattener) VirologischerBefundComposition(org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition) SimpleSelectQuery(org.ehrbase.client.openehrclient.defaultrestclient.systematic.compositionquery.queries.simple.SimpleSelectQuery) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) Before(org.junit.Before)

Aggregations

VirologischerBefundComposition (org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition)5 Tuple (org.assertj.core.groups.Tuple)3 Test (org.junit.Test)3 Composition (com.nedap.archie.rm.composition.Composition)2 UUID (java.util.UUID)2 ContainmentExpression (org.ehrbase.client.aql.containment.ContainmentExpression)2 Record2 (org.ehrbase.client.aql.record.Record2)2 VirologischerBefundCompositionContainment (org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundCompositionContainment)2 KulturClusterContainment (org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.KulturClusterContainment)2 ProVirusClusterContainment (org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.ProVirusClusterContainment)2 ProbeClusterContainment (org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.ProbeClusterContainment)2 Flattener (org.ehrbase.client.flattener.Flattener)2 TestDataTemplateProvider (org.ehrbase.client.templateprovider.TestDataTemplateProvider)2 CanonicalJson (org.ehrbase.serialisation.jsonencoding.CanonicalJson)2 CompositionTestDataCanonicalJson (org.ehrbase.test_data.composition.CompositionTestDataCanonicalJson)2 DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)1 DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)1 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)1 PartySelf (com.nedap.archie.rm.generic.PartySelf)1 Containment (org.ehrbase.client.aql.containment.Containment)1