Search in sources :

Example 11 with PartySelf

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

the class DefaultRestEhrFieldsEndpointIT method testCreateEhrWithStatus.

@Test
public void testCreateEhrWithStatus() {
    EhrStatus ehrStatus = new EhrStatus();
    ehrStatus.setQueryable(false);
    ehrStatus.setModifiable(false);
    HierObjectId subjectId = new HierObjectId(UUID.randomUUID().toString());
    ehrStatus.setSubject(new PartySelf(new PartyRef(subjectId, "default", "PERSON")));
    ehrStatus.setArchetypeNodeId("just-a-status");
    ehrStatus.setName(new DvText("Status"));
    ehr = openEhrClient.ehrEndpoint().createEhr(ehrStatus);
    assertThat(ehr).isNotNull();
    EhrStatus actual = openEhrClient.ehrEndpoint().getEhrStatus(ehr).get();
    assertThat(actual.getSubject().getExternalRef().getId()).isEqualTo(subjectId);
}
Also used : PartyRef(com.nedap.archie.rm.support.identification.PartyRef) EhrStatus(com.nedap.archie.rm.ehr.EhrStatus) HierObjectId(com.nedap.archie.rm.support.identification.HierObjectId) PartySelf(com.nedap.archie.rm.generic.PartySelf) DvText(com.nedap.archie.rm.datavalues.DvText) Test(org.junit.Test)

Example 12 with PartySelf

use of com.nedap.archie.rm.generic.PartySelf 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 13 with PartySelf

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

the class TestData method buildTestPatientenaufenthaltComposition.

public static PatientenaufenthaltComposition buildTestPatientenaufenthaltComposition() {
    PatientenaufenthaltComposition patientenaufenthaltComposition = new PatientenaufenthaltComposition();
    patientenaufenthaltComposition.setComposer(new PartyIdentified(null, "Test", null));
    patientenaufenthaltComposition.setCategoryDefiningCode(Category.EVENT);
    patientenaufenthaltComposition.setLanguage(Language.DE);
    patientenaufenthaltComposition.setTerritory(Territory.DE);
    patientenaufenthaltComposition.setStartTimeValue(OffsetDateTime.now());
    patientenaufenthaltComposition.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
    VersorgungsortAdminEntry versorgungsortAdminEntry = new VersorgungsortAdminEntry();
    StandortCluster standortCluster = new StandortCluster();
    standortCluster.setStandorttypValue("Test");
    standortCluster.setStandortbeschreibungValue("Beschreibung");
    standortCluster.setStandortschlusselDefiningCode(StandortschlusselDefiningCode.ANGIOLOGIE.ANGIOLOGIE);
    standortCluster.setBettplatzkennungValue("Platz 2");
    versorgungsortAdminEntry.setStandort(standortCluster);
    versorgungsortAdminEntry.setBeginnValue(new DvDateTime("2020-01-01T10:00Z").getValue());
    versorgungsortAdminEntry.setEndeValue(new DvDateTime("2020-01-01T12:00Z").getValue());
    versorgungsortAdminEntry.setGrundDesAufenthaltesValue("test value");
    versorgungsortAdminEntry.setLanguage(Language.DE);
    versorgungsortAdminEntry.setSubject(new PartySelf());
    patientenaufenthaltComposition.setVersorgungsort(versorgungsortAdminEntry);
    return patientenaufenthaltComposition;
}
Also used : PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) PatientenaufenthaltComposition(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.PatientenaufenthaltComposition) VersorgungsortAdminEntry(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.VersorgungsortAdminEntry) StandortCluster(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.StandortCluster) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) PartySelf(com.nedap.archie.rm.generic.PartySelf)

Example 14 with PartySelf

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

the class EntryPostprocessor method process.

/**
 * {@inheritDoc}
 */
@Override
public void process(String term, Entry rmObject, Map<FlatPathDto, String> values, Set<String> consumedPaths, Context<Map<FlatPathDto, String>> context) {
    consumedPaths.add(term + PATH_DIVIDER + "encoding|code");
    consumedPaths.add(term + PATH_DIVIDER + "encoding|terminology");
    Map<FlatPathDto, String> subjectValues = FlatHelper.filter(values, term + "/subject", false);
    if (!subjectValues.isEmpty()) {
        if (rmObject.getSubject() == null) {
            // If it was PartyRelated it would be set by now do to the relationship  and if it was
            // PartySelf subjectValues would be empty
            rmObject.setSubject(new PartyIdentified());
        }
        callUnmarshal(term, "subject", rmObject.getSubject(), values, consumedPaths, context, context.getNodeDeque().peek().findChildById("subject").orElse(buildDummyChild("subject", context.getNodeDeque().peek())));
    }
    PartyProxy subject = rmObject.getSubject();
    if (subject == null || (subject instanceof PartyIdentified && ((PartyIdentified) subject).getName() == null && CollectionUtils.isEmpty(((PartyIdentified) subject).getIdentifiers()) && subject.getExternalRef() == null && (!(subject instanceof PartyRelated) || ((PartyRelated) subject).getRelationship() == null || StringUtils.isEmpty(((PartyRelated) subject).getRelationship().getValue())))) {
        rmObject.setSubject(new PartySelf());
    }
    Map<FlatPathDto, String> providerList = values.entrySet().stream().filter(e -> e.getKey().startsWith(term + PATH_DIVIDER + "_provider")).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
    if (!MapUtils.isEmpty(providerList)) {
        if (!(rmObject.getProvider() instanceof PartyIdentified)) {
            rmObject.setProvider(new PartyIdentified());
        }
        PartyIdentifiedRMUnmarshaller partyIdentifiedRMUnmarshaller = new PartyIdentifiedRMUnmarshaller();
        partyIdentifiedRMUnmarshaller.handle(term + PATH_DIVIDER + "_provider", (PartyIdentified) rmObject.getProvider(), providerList, null, consumedPaths);
    }
    Map<Integer, Map<String, String>> other = extractMultiValued(term, "_other_participation", values);
    other.values().stream().map(Map::entrySet).map(s -> s.stream().collect(Collectors.toMap(e -> "ctx/" + DefaultValuePath.PARTICIPATION.getPath() + "_" + e.getKey().replace("identifiers_", "identifiers|"), e -> StringUtils.wrap(e.getValue(), '"'))).entrySet()).map(DefaultValues::buildParticipation).forEach(rmObject::addOtherParticipant);
    consumeAllMatching(term + PATH_DIVIDER + "_other_participation", values, consumedPaths, false);
    Map<FlatPathDto, String> workflowIdValues = filter(values, term + "/_work_flow_id", false);
    if (!workflowIdValues.isEmpty()) {
        ObjectRef<GenericId> ref = new ObjectRef<>();
        ref.setId(new GenericId());
        rmObject.setWorkflowId(ref);
        setValue(term + "/_work_flow_id", "id", workflowIdValues, s -> ref.getId().setValue(s), String.class, consumedPaths);
        setValue(term + "/_work_flow_id", "id_scheme", workflowIdValues, s -> ref.getId().setScheme(s), String.class, consumedPaths);
        setValue(term + "/_work_flow_id", "namespace", workflowIdValues, ref::setNamespace, String.class, consumedPaths);
        setValue(term + "/_work_flow_id", "type", workflowIdValues, ref::setType, String.class, consumedPaths);
    }
}
Also used : Entry(com.nedap.archie.rm.composition.Entry) PartyProxy(com.nedap.archie.rm.generic.PartyProxy) PartySelf(com.nedap.archie.rm.generic.PartySelf) MapUtils(org.apache.commons.collections4.MapUtils) ObjectRef(com.nedap.archie.rm.support.identification.ObjectRef) Context(org.ehrbase.serialisation.walker.Context) FlatHelper(org.ehrbase.serialisation.walker.FlatHelper) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) DefaultValuePath(org.ehrbase.serialisation.walker.defaultvalues.DefaultValuePath) FlatPathDto(org.ehrbase.webtemplate.path.flat.FlatPathDto) Set(java.util.Set) DefaultValues(org.ehrbase.serialisation.walker.defaultvalues.DefaultValues) StringUtils(org.apache.commons.lang3.StringUtils) Collectors(java.util.stream.Collectors) CollectionUtils(org.apache.commons.collections4.CollectionUtils) PartyIdentifiedRMUnmarshaller(org.ehrbase.serialisation.flatencoding.std.umarshal.rmunmarshaller.PartyIdentifiedRMUnmarshaller) PATH_DIVIDER(org.ehrbase.webtemplate.parser.OPTParser.PATH_DIVIDER) GenericId(com.nedap.archie.rm.support.identification.GenericId) Map(java.util.Map) PartyRelated(com.nedap.archie.rm.generic.PartyRelated) GenericId(com.nedap.archie.rm.support.identification.GenericId) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) FlatPathDto(org.ehrbase.webtemplate.path.flat.FlatPathDto) PartyRelated(com.nedap.archie.rm.generic.PartyRelated) PartySelf(com.nedap.archie.rm.generic.PartySelf) PartyIdentifiedRMUnmarshaller(org.ehrbase.serialisation.flatencoding.std.umarshal.rmunmarshaller.PartyIdentifiedRMUnmarshaller) PartyProxy(com.nedap.archie.rm.generic.PartyProxy) ObjectRef(com.nedap.archie.rm.support.identification.ObjectRef) Map(java.util.Map)

Example 15 with PartySelf

use of com.nedap.archie.rm.generic.PartySelf in project fhir-bridge by ehrbase.

the class WohnungsEvaluationConverter method convertInternal.

@Override
protected WohnsituationEvaluation convertInternal(QuestionnaireResponse.QuestionnaireResponseItemComponent questionnaireResponseItemComponent) {
    String housingSituation = getQuestionValueCodeToString(questionnaireResponseItemComponent);
    WohnsituationEvaluation wohnsituationEvaluation = new WohnsituationEvaluation();
    if (housingSituation.equals(WohnsituationDefiningCode.WOHNT_MIT_ANDEREN_ZUSAMMEN.getCode())) {
        wohnsituationEvaluation.setWohnsituationDefiningCode(WohnsituationDefiningCode.WOHNT_MIT_ANDEREN_ZUSAMMEN);
    } else if (housingSituation.equals(WohnsituationDefiningCode.ALLEIN_WOHNEND.getCode())) {
        wohnsituationEvaluation.setWohnsituationDefiningCode(WohnsituationDefiningCode.ALLEIN_WOHNEND);
    } else if (!housingSituation.equals("")) {
        throw new ConversionException("The code for Wohnungsituation:" + housingSituation + " cannot be mapped, please enter a valid code e.g. Wohnt mit anderen zusammen (LOINC: LA9996-5)");
    }
    wohnsituationEvaluation.setLanguage(Language.DE);
    wohnsituationEvaluation.setSubject(new PartySelf());
    return wohnsituationEvaluation;
}
Also used : ConversionException(org.ehrbase.fhirbridge.ehr.converter.ConversionException) WohnsituationEvaluation(org.ehrbase.fhirbridge.ehr.opt.d4lquestionnairecomposition.definition.WohnsituationEvaluation) PartySelf(com.nedap.archie.rm.generic.PartySelf)

Aggregations

PartySelf (com.nedap.archie.rm.generic.PartySelf)29 DvText (com.nedap.archie.rm.datavalues.DvText)9 EhrStatus (com.nedap.archie.rm.ehr.EhrStatus)9 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)8 PartyRef (com.nedap.archie.rm.support.identification.PartyRef)8 HierObjectId (com.nedap.archie.rm.support.identification.HierObjectId)7 UUID (java.util.UUID)5 Test (org.junit.Test)4 DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)3 URI (java.net.URI)3 ItemTree (com.nedap.archie.rm.datastructures.ItemTree)2 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)2 DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)2 GenericId (com.nedap.archie.rm.support.identification.GenericId)2 BodyTemperatureAnyEventPointEvent (org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureAnyEventPointEvent)2 BodyTemperatureObservation (org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureObservation)2 VirologischerBefundComposition (org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.VirologischerBefundComposition)2 ProVirusCluster (org.ehrbase.client.classgenerator.examples.virologischerbefundcomposition.definition.ProVirusCluster)2 DefaultValuePath (org.ehrbase.serialisation.walker.defaultvalues.DefaultValuePath)2 DefaultValues (org.ehrbase.serialisation.walker.defaultvalues.DefaultValues)2