Search in sources :

Example 6 with PartyIdentified

use of com.nedap.archie.rm.generic.PartyIdentified in project openEHR_SDK by ehrbase.

the class UnflattenerTest method testUnflattenEhrbaseBloodPressureSimpleDeV0.

@Test
public void testUnflattenEhrbaseBloodPressureSimpleDeV0() {
    Unflattener cut = new Unflattener(new TestDataTemplateProvider());
    EhrbaseBloodPressureSimpleDeV0Composition dto = buildEhrbaseBloodPressureSimpleDeV0();
    Composition rmObject = (Composition) cut.unflatten(dto);
    assertThat(rmObject).isNotNull();
    assertThat(rmObject.getContext().getParticipations()).extracting(p -> ((PartyIdentified) p.getPerformer()).getName(), p -> p.getFunction().getValue()).containsExactlyInAnyOrder(new Tuple("Test", "Pos1"), new Tuple("Test2", "Pos2"));
    assertThat(rmObject.getLanguage()).extracting(CodePhrase::getCodeString, c -> c.getTerminologyId().getValue()).containsExactly("de", "ISO_639-1");
    assertThat(rmObject.getArchetypeDetails().getTemplateId().getValue()).isEqualTo("ehrbase_blood_pressure_simple.de.v0");
    assertThat(rmObject.itemAtPath("/context/start_time/value")).isEqualTo(dto.getStartTimeValue());
    List<Object> observationList = rmObject.itemsAtPath("/content[openEHR-EHR-OBSERVATION.sample_blood_pressure.v1]");
    assertThat(observationList).size().isEqualTo(1);
    Observation observation = (Observation) observationList.get(0);
    DvCodedText expected = new DvCodedText("Fifth sound", new CodePhrase(new TerminologyId("local"), "at1012"));
    assertThat(observation.itemAtPath("/protocol[at0011]/items[at1010]/value")).isEqualTo(expected);
    assertThat(observation.getSubject()).isNotNull().extracting(Object::getClass).isEqualTo(PartySelf.class);
}
Also used : Composition(com.nedap.archie.rm.composition.Composition) TerminologyId(com.nedap.archie.rm.support.identification.TerminologyId) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) LaborergebnisObservation(org.ehrbase.client.classgenerator.examples.befundderblutgasanalysecomposition.definition.LaborergebnisObservation) EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) GrosseLangeObservation(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.definition.GrosseLangeObservation) Element(com.nedap.archie.rm.datastructures.Element) Duration(java.time.Duration) Locatable(com.nedap.archie.rm.archetyped.Locatable) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) URI(java.net.URI) ZoneOffset(java.time.ZoneOffset) CodePhrase(com.nedap.archie.rm.datatypes.CodePhrase) DvQuantity(com.nedap.archie.rm.datavalues.quantity.DvQuantity) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier) PartySelf(com.nedap.archie.rm.generic.PartySelf) Tuple(org.assertj.core.groups.Tuple) KorpergrosseComposition(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.KorpergrosseComposition) CanonicalJson(org.ehrbase.serialisation.jsonencoding.CanonicalJson) CompositionTestDataCanonicalJson(org.ehrbase.test_data.composition.CompositionTestDataCanonicalJson) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) DvText(com.nedap.archie.rm.datavalues.DvText) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) Test(org.junit.Test) IOException(java.io.IOException) PointEvent(com.nedap.archie.rm.datastructures.PointEvent) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) WebTemplate(org.ehrbase.webtemplate.model.WebTemplate) IOUtils(org.apache.commons.io.IOUtils) KohlendioxidpartialdruckCluster(org.ehrbase.client.classgenerator.examples.befundderblutgasanalysecomposition.definition.KohlendioxidpartialdruckCluster) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) Observation(com.nedap.archie.rm.composition.Observation) List(java.util.List) AlternativeEventsComposition(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition) OffsetDateTime(java.time.OffsetDateTime) BefundDerBlutgasanalyseComposition(org.ehrbase.client.classgenerator.examples.befundderblutgasanalysecomposition.BefundDerBlutgasanalyseComposition) Assert.assertFalse(org.junit.Assert.assertFalse) Optional(java.util.Optional) TestData(org.ehrbase.client.TestData) IntervalEvent(com.nedap.archie.rm.datastructures.IntervalEvent) TestAllTypesEnV1Composition(org.ehrbase.client.classgenerator.examples.testalltypesenv1composition.TestAllTypesEnV1Composition) AdminEntry(com.nedap.archie.rm.composition.AdminEntry) DvURI(com.nedap.archie.rm.datavalues.DvURI) TestAllTypesEvaluation(org.ehrbase.client.classgenerator.examples.testalltypesenv1composition.definition.TestAllTypesEvaluation) CoronaAnamneseComposition(org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.CoronaAnamneseComposition) TerminologyId(com.nedap.archie.rm.support.identification.TerminologyId) Composition(com.nedap.archie.rm.composition.Composition) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) KorpergrosseComposition(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.KorpergrosseComposition) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) AlternativeEventsComposition(org.ehrbase.client.classgenerator.examples.alternativeeventscomposition.AlternativeEventsComposition) BefundDerBlutgasanalyseComposition(org.ehrbase.client.classgenerator.examples.befundderblutgasanalysecomposition.BefundDerBlutgasanalyseComposition) TestAllTypesEnV1Composition(org.ehrbase.client.classgenerator.examples.testalltypesenv1composition.TestAllTypesEnV1Composition) CoronaAnamneseComposition(org.ehrbase.client.classgenerator.examples.coronaanamnesecomposition.CoronaAnamneseComposition) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) CodePhrase(com.nedap.archie.rm.datatypes.CodePhrase) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider) LaborergebnisObservation(org.ehrbase.client.classgenerator.examples.befundderblutgasanalysecomposition.definition.LaborergebnisObservation) GrosseLangeObservation(org.ehrbase.client.classgenerator.examples.korpergrossecomposition.definition.GrosseLangeObservation) Observation(com.nedap.archie.rm.composition.Observation) EhrbaseBloodPressureSimpleDeV0Composition(org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition) Tuple(org.assertj.core.groups.Tuple) Test(org.junit.Test)

Example 7 with PartyIdentified

use of com.nedap.archie.rm.generic.PartyIdentified in project openEHR_SDK by ehrbase.

the class EntryMarshalPostprocessor method process.

/**
 * {@inheritDoc} Adds the encoding information
 */
@Override
public void process(String term, Entry rmObject, Map<String, Object> values, Context<Map<String, Object>> context) {
    values.put(term + PATH_DIVIDER + "encoding|code", "UTF-8");
    values.put(term + PATH_DIVIDER + "encoding|terminology", "IANA_character-sets");
    if (rmObject.getProvider() != null) {
        PartyIdentifiedStdConfig partyIdentifiedStdConfig = new PartyIdentifiedStdConfig();
        values.putAll(partyIdentifiedStdConfig.buildChildValues(term + PATH_DIVIDER + "_provider", (PartyIdentified) rmObject.getProvider(), null));
    }
    if (rmObject.getOtherParticipations() != null) {
        IntStream.range(0, rmObject.getOtherParticipations().size()).forEach(i -> {
            callMarshal(term, "_other_participation:" + i, rmObject.getOtherParticipations().get(i), values, context, context.getNodeDeque().peek().findChildById("participation").orElse(null));
            callPostprocess(term, "_other_participation:" + i, rmObject.getOtherParticipations().get(i), values, context, context.getNodeDeque().peek().findChildById("participation").orElse(null));
        });
    }
    if (rmObject.getWorkflowId() != null) {
        addValue(values, term + "/_work_flow_id", "id", Optional.of(rmObject.getWorkflowId()).map(ObjectRef::getId).map(ObjectId::getValue).orElse(null));
        addValue(values, term + "/_work_flow_id", "id_scheme", Optional.of(rmObject.getWorkflowId()).map(ObjectRef::getId).filter(i -> GenericId.class.isAssignableFrom(i.getClass())).map(GenericId.class::cast).map(GenericId::getScheme).orElse(null));
        addValue(values, term + "/_work_flow_id", "namespace", rmObject.getWorkflowId().getNamespace());
        addValue(values, term + "/_work_flow_id", "type", rmObject.getWorkflowId().getType());
    }
}
Also used : GenericId(com.nedap.archie.rm.support.identification.GenericId) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) ObjectId(com.nedap.archie.rm.support.identification.ObjectId) PartyIdentifiedStdConfig(org.ehrbase.serialisation.flatencoding.std.marshal.config.PartyIdentifiedStdConfig)

Example 8 with PartyIdentified

use of com.nedap.archie.rm.generic.PartyIdentified in project openEHR_SDK by ehrbase.

the class DefaultValuesTest method unmarshal.

@Test
public void unmarshal() throws IOException, XmlException {
    OPERATIONALTEMPLATE template = TemplateDocument.Factory.parse(OperationalTemplateTestData.CORONA_ANAMNESE.getStream()).getTemplate();
    WebTemplate webTemplate = new OPTParser(template).parse();
    FlatJsonUnmarshaller cut = new FlatJsonUnmarshaller();
    String flat = IOUtils.toString(CompositionTestDataSimSDTJson.CORONA_WITH_CONTEXT.getStream(), StandardCharsets.UTF_8);
    Composition actual = cut.unmarshal(flat, webTemplate);
    assertThat(actual).isNotNull();
    assertThat(actual.getCategory()).isNotNull();
    assertThat(actual.getCategory().getValue()).isEqualTo("event");
    assertThat(actual.getLanguage()).isNotNull();
    assertThat(actual.getLanguage().getCodeString()).isEqualTo(Language.DE.getCode());
    assertThat(actual.getComposer()).isNotNull();
    assertThat(actual.getComposer()).getClass().isAssignableFrom(PartyIdentified.class);
    assertThat(((PartyIdentified) actual.getComposer()).getName()).isEqualTo("Silvia Blake");
    assertThat(actual.getComposer().getExternalRef().getNamespace()).isEqualTo("HOSPITAL-NS");
    assertThat(((GenericId) actual.getComposer().getExternalRef().getId()).getScheme()).isEqualTo("HOSPITAL-NS");
    assertThat(((GenericId) actual.getComposer().getExternalRef().getId()).getValue()).isEqualTo("123");
    assertThat(actual.getContext().getHealthCareFacility().getName()).isEqualTo("Hospital");
    assertThat(actual.getContext().getStartTime()).isNotNull();
    assertThat(actual.getContext().getStartTime().getValue()).isEqualTo(OffsetDateTime.of(2021, 4, 1, 12, 40, 31, 418954000, ZoneOffset.ofHours(2)));
    assertThat(actual.getContext().getParticipations()).extracting(p -> ((PartyIdentified) p.getPerformer())).flatExtracting(p -> p.getIdentifiers()).extracting(DvIdentifier::getAssigner, DvIdentifier::getId, DvIdentifier::getIssuer, DvIdentifier::getType).containsExactlyInAnyOrder(new Tuple("assigner1", "id1", "issuer1", "PERSON"), new Tuple("assigner2", "id2", "issuer2", "PERSON"), new Tuple("assigner3", "id3", "issuer3", "PERSON"), new Tuple("assigner4", "id4", "issuer4", "PERSON"));
    Observation observation = actual.getContent().stream().filter(c -> Observation.class.isAssignableFrom(c.getClass())).map(Observation.class::cast).findAny().orElse(null);
    assertThat(observation).isNotNull();
    assertThat(observation.getData()).isNotNull();
    assertThat(observation.getData().getOrigin().getValue()).isEqualTo(OffsetDateTime.of(2021, 4, 1, 12, 40, 31, 418954000, ZoneOffset.ofHours(2)));
    assertThat(observation.getData().getEvents().get(0).getTime().getValue()).isEqualTo(OffsetDateTime.of(2021, 4, 1, 12, 40, 31, 418954000, ZoneOffset.ofHours(2)));
    assertThat(observation.getOtherParticipations()).extracting(p -> p.getFunction().getValue(), p -> ((PartyIdentified) p.getPerformer()).getName(), p -> p.getPerformer().getExternalRef().getNamespace()).containsExactlyInAnyOrder(new Tuple("requester", "Dr. Marcus Johnson", "HOSPITAL-NS"), new Tuple("performer", "Lara Markham", "HOSPITAL-NS"));
    assertThat(observation.getOtherParticipations()).extracting(p -> ((PartyIdentified) p.getPerformer())).flatExtracting(p -> p.getIdentifiers()).extracting(DvIdentifier::getAssigner, DvIdentifier::getId, DvIdentifier::getIssuer, DvIdentifier::getType).containsExactlyInAnyOrder(new Tuple("assigner1", "id1", "issuer1", "PERSON"), new Tuple("assigner2", "id2", "issuer2", "PERSON"), new Tuple("assigner3", "id3", "issuer3", "PERSON"), new Tuple("assigner4", "id4", "issuer4", "PERSON"));
    assertThat(observation.getWorkflowId()).isNotNull();
    assertThat(observation.getWorkflowId().getNamespace()).isEqualTo("HOSPITAL-NS");
    assertThat(observation.getWorkflowId().getId().getValue()).isEqualTo("567");
    assertThat(observation.getWorkflowId().getType()).isEqualTo("ORGANISATION");
}
Also used : OPERATIONALTEMPLATE(org.openehr.schemas.v1.OPERATIONALTEMPLATE) Language(org.ehrbase.client.classgenerator.shareddefinition.Language) Composition(com.nedap.archie.rm.composition.Composition) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) HashMap(java.util.HashMap) GenericId(com.nedap.archie.rm.support.identification.GenericId) Map(java.util.Map) JsonNode(com.fasterxml.jackson.databind.JsonNode) ZoneOffset(java.time.ZoneOffset) FlatJsonUnmarshaller(org.ehrbase.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller) OPTParser(org.ehrbase.webtemplate.parser.OPTParser) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier) Tuple(org.assertj.core.groups.Tuple) TemplateDocument(org.openehr.schemas.v1.TemplateDocument) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) Iterator(java.util.Iterator) OperationalTemplateTestData(org.ehrbase.test_data.operationaltemplate.OperationalTemplateTestData) CompositionTestDataSimSDTJson(org.ehrbase.test_data.composition.CompositionTestDataSimSDTJson) Test(org.junit.Test) IOException(java.io.IOException) JacksonUtil(org.ehrbase.serialisation.jsonencoding.JacksonUtil) StandardCharsets(java.nio.charset.StandardCharsets) WebTemplate(org.ehrbase.webtemplate.model.WebTemplate) IOUtils(org.apache.commons.io.IOUtils) Observation(com.nedap.archie.rm.composition.Observation) XmlException(org.apache.xmlbeans.XmlException) OffsetDateTime(java.time.OffsetDateTime) OPERATIONALTEMPLATE(org.openehr.schemas.v1.OPERATIONALTEMPLATE) Composition(com.nedap.archie.rm.composition.Composition) GenericId(com.nedap.archie.rm.support.identification.GenericId) WebTemplate(org.ehrbase.webtemplate.model.WebTemplate) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) OPTParser(org.ehrbase.webtemplate.parser.OPTParser) Observation(com.nedap.archie.rm.composition.Observation) FlatJsonUnmarshaller(org.ehrbase.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller) Tuple(org.assertj.core.groups.Tuple) Test(org.junit.Test)

Example 9 with PartyIdentified

use of com.nedap.archie.rm.generic.PartyIdentified in project openEHR_SDK by ehrbase.

the class DefaultValuesTest method test.

@Test
public void test() throws IOException {
    Map<String, String> currentValues = new HashMap<>();
    for (Iterator<Map.Entry<String, JsonNode>> it = JacksonUtil.getObjectMapper().readTree(IOUtils.toString(CompositionTestDataSimSDTJson.CORONA_WITH_CONTEXT.getStream(), StandardCharsets.UTF_8)).fields(); it.hasNext(); ) {
        Map.Entry<String, JsonNode> e = it.next();
        currentValues.put(e.getKey(), e.getValue().toString());
    }
    DefaultValues cut = new DefaultValues(currentValues);
    assertThat(cut).isNotNull();
    assertThat(cut.getDefaultValue(DefaultValuePath.LANGUAGE)).isEqualTo(Language.DE);
    assertThat(cut.getDefaultValue(DefaultValuePath.COMPOSER_NAME)).isEqualTo("Silvia Blake");
    assertThat(cut.getDefaultValue(DefaultValuePath.TIME)).isEqualTo(OffsetDateTime.of(2021, 4, 1, 12, 40, 31, 418954000, ZoneOffset.ofHours(2)));
    assertThat(cut.getDefaultValue(DefaultValuePath.HEALTHCARE_FACILITY_NAME)).isEqualTo("Hospital");
    assertThat(cut.getDefaultValue(DefaultValuePath.PARTICIPATION)).isNotNull();
    assertThat(cut.getDefaultValue(DefaultValuePath.PARTICIPATION)).extracting(p -> p.getFunction().getValue(), p -> ((PartyIdentified) p.getPerformer()).getName(), p -> p.getPerformer().getExternalRef().getNamespace()).containsExactlyInAnyOrder(new Tuple("requester", "Dr. Marcus Johnson", "HOSPITAL-NS"), new Tuple("performer", "Lara Markham", "HOSPITAL-NS"));
    assertThat(cut.getDefaultValue(DefaultValuePath.PARTICIPATION)).extracting(p -> ((PartyIdentified) p.getPerformer())).flatExtracting(p -> p.getIdentifiers()).extracting(DvIdentifier::getAssigner, DvIdentifier::getId, DvIdentifier::getIssuer, DvIdentifier::getType).containsExactlyInAnyOrder(new Tuple("assigner1", "id1", "issuer1", "PERSON"), new Tuple("assigner2", "id2", "issuer2", "PERSON"), new Tuple("assigner3", "id3", "issuer3", "PERSON"), new Tuple("assigner4", "id4", "issuer4", "PERSON"));
    assertThat(cut.getDefaultValue(DefaultValuePath.WORKFLOW_ID)).isNotNull();
    assertThat(cut.getDefaultValue(DefaultValuePath.WORKFLOW_ID).getNamespace()).isEqualTo("HOSPITAL-NS");
    assertThat(cut.getDefaultValue(DefaultValuePath.WORKFLOW_ID).getId().getValue()).isEqualTo("567");
    assertThat(cut.getDefaultValue(DefaultValuePath.WORKFLOW_ID).getType()).isEqualTo("ORGANISATION");
}
Also used : OPERATIONALTEMPLATE(org.openehr.schemas.v1.OPERATIONALTEMPLATE) Language(org.ehrbase.client.classgenerator.shareddefinition.Language) Composition(com.nedap.archie.rm.composition.Composition) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) HashMap(java.util.HashMap) GenericId(com.nedap.archie.rm.support.identification.GenericId) Map(java.util.Map) JsonNode(com.fasterxml.jackson.databind.JsonNode) ZoneOffset(java.time.ZoneOffset) FlatJsonUnmarshaller(org.ehrbase.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller) OPTParser(org.ehrbase.webtemplate.parser.OPTParser) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier) Tuple(org.assertj.core.groups.Tuple) TemplateDocument(org.openehr.schemas.v1.TemplateDocument) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) Iterator(java.util.Iterator) OperationalTemplateTestData(org.ehrbase.test_data.operationaltemplate.OperationalTemplateTestData) CompositionTestDataSimSDTJson(org.ehrbase.test_data.composition.CompositionTestDataSimSDTJson) Test(org.junit.Test) IOException(java.io.IOException) JacksonUtil(org.ehrbase.serialisation.jsonencoding.JacksonUtil) StandardCharsets(java.nio.charset.StandardCharsets) WebTemplate(org.ehrbase.webtemplate.model.WebTemplate) IOUtils(org.apache.commons.io.IOUtils) Observation(com.nedap.archie.rm.composition.Observation) XmlException(org.apache.xmlbeans.XmlException) OffsetDateTime(java.time.OffsetDateTime) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) HashMap(java.util.HashMap) JsonNode(com.fasterxml.jackson.databind.JsonNode) HashMap(java.util.HashMap) Map(java.util.Map) Tuple(org.assertj.core.groups.Tuple) Test(org.junit.Test)

Example 10 with PartyIdentified

use of com.nedap.archie.rm.generic.PartyIdentified 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)

Aggregations

PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)41 DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)12 PartySelf (com.nedap.archie.rm.generic.PartySelf)12 Participation (com.nedap.archie.rm.generic.Participation)11 GenericId (com.nedap.archie.rm.support.identification.GenericId)11 DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)10 Test (org.junit.Test)10 Composition (com.nedap.archie.rm.composition.Composition)9 DvText (com.nedap.archie.rm.datavalues.DvText)9 EhrbaseBloodPressureSimpleDeV0Composition (org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition)9 PartyProxy (com.nedap.archie.rm.generic.PartyProxy)8 IOException (java.io.IOException)8 StandardCharsets (java.nio.charset.StandardCharsets)8 IOUtils (org.apache.commons.io.IOUtils)8 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)8 Tuple (org.assertj.core.groups.Tuple)8 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)7 PartyRef (com.nedap.archie.rm.support.identification.PartyRef)6 Optional (java.util.Optional)6 TestData (org.ehrbase.client.TestData)6