Search in sources :

Example 11 with DvIdentifier

use of com.nedap.archie.rm.datavalues.DvIdentifier in project fhir-bridge by ehrbase.

the class DvIdentifierParser method parseObservationIntoDvIdentifier.

public static Optional<DvIdentifier> parseObservationIntoDvIdentifier(Observation observation) {
    DvIdentifier dvIdentifier = new DvIdentifier();
    mapAssigner(observation).ifPresent(dvIdentifier::setAssigner);
    mapId(observation).ifPresent(dvIdentifier::setId);
    mapType(observation).ifPresent(dvIdentifier::setType);
    return Optional.of(dvIdentifier);
}
Also used : DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier)

Example 12 with DvIdentifier

use of com.nedap.archie.rm.datavalues.DvIdentifier in project fhir-bridge by ehrbase.

the class AbstractConverter method buildFeederAudit.

protected FeederAudit buildFeederAudit(@NonNull S resource) {
    FeederAudit result = new FeederAudit();
    String systemId = resource.getMeta().hasSource() ? resource.getMeta().getSource() : DEFAULT_SYSTEM_ID;
    result.setOriginatingSystemAudit(new FeederAuditDetails(systemId, null, null, null, null, null, null));
    List<DvIdentifier> identifiers = new ArrayList<>();
    if (resource.hasId()) {
        DvIdentifier identifier = new DvIdentifier();
        identifier.setId(resource.getId());
        identifier.setType("fhir_logical_id");
        identifiers.add(identifier);
    }
    identifiers.addAll(subjectIdentifiers(resource));
    result.setOriginatingSystemItemIds(identifiers);
    return result;
}
Also used : FeederAudit(com.nedap.archie.rm.archetyped.FeederAudit) FeederAuditDetails(com.nedap.archie.rm.archetyped.FeederAuditDetails) ArrayList(java.util.ArrayList) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier)

Example 13 with DvIdentifier

use of com.nedap.archie.rm.datavalues.DvIdentifier in project fhir-bridge by ehrbase.

the class DocumentReferenceToHipDocumentConverter method getIdentifiers.

private Optional<List<HipMetadataIdentifikatorElement>> getIdentifiers(DocumentReference documentReference) {
    if (!documentReference.hasMasterIdentifier()) {
        return Optional.empty();
    }
    DvIdentifier id = new DvIdentifier();
    id.setAssigner(documentReference.getMasterIdentifier().getSystem());
    id.setId(documentReference.getMasterIdentifier().getValue());
    HipMetadataIdentifikatorElement idElem = new HipMetadataIdentifikatorElement();
    idElem.setValue(id);
    return Optional.of(List.of(idElem));
}
Also used : HipMetadataIdentifikatorElement(org.ehrbase.fhirbridge.ehr.opt.hipdocumentcomposition.definition.HipMetadataIdentifikatorElement) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier)

Example 14 with DvIdentifier

use of com.nedap.archie.rm.datavalues.DvIdentifier in project openEHR_SDK by ehrbase.

the class ParticipationConfig method buildChildValues.

/**
 * {@inheritDoc}
 */
@Override
public Map<String, Object> buildChildValues(String currentTerm, Participation rmObject, Context<Map<String, Object>> context) {
    Map<String, Object> result = new HashMap<>();
    addValue(result, currentTerm, "id", Optional.of(rmObject).map(Participation::getPerformer).map(PartyProxy::getExternalRef).map(ObjectRef::getId).map(ObjectId::getValue).orElse(null));
    addValue(result, currentTerm, "id_namespace", Optional.of(rmObject).map(Participation::getPerformer).map(PartyProxy::getExternalRef).map(ObjectRef::getNamespace).orElse(null));
    addValue(result, currentTerm, "id_scheme", Optional.of(rmObject).map(Participation::getPerformer).map(PartyProxy::getExternalRef).map(PartyRef::getId).filter(cls -> GenericId.class.isAssignableFrom(cls.getClass())).map(GenericId.class::cast).map(GenericId::getScheme).orElse(null));
    addValue(result, currentTerm, "name", Optional.of(rmObject).map(Participation::getPerformer).filter(p -> PartyIdentified.class.isAssignableFrom(p.getClass())).map(PartyIdentified.class::cast).map(PartyIdentified::getName).orElse(null));
    addValue(result, currentTerm, "mode", Optional.of(rmObject).map(Participation::getMode).map(DvText::getValue).orElse(null));
    addValue(result, currentTerm, "function", Optional.of(rmObject).map(Participation::getFunction).map(DvText::getValue).orElse(null));
    List<DvIdentifier> dvIdentifiers = Optional.of(rmObject).map(Participation::getPerformer).filter(p -> PartyIdentified.class.isAssignableFrom(p.getClass())).map(PartyIdentified.class::cast).map(PartyIdentified::getIdentifiers).orElse(Collections.emptyList());
    IntStream.range(0, dvIdentifiers.size()).forEach(i -> {
        DvIdentifier identifier = dvIdentifiers.get(i);
        addValue(result, currentTerm, "identifiers_id:" + i, identifier.getId());
        addValue(result, currentTerm, "identifiers_issuer:" + i, identifier.getIssuer());
        addValue(result, currentTerm, "identifiers_assigner:" + i, identifier.getAssigner());
        addValue(result, currentTerm, "identifiers_type:" + i, identifier.getType());
    });
    return result;
}
Also used : DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier) PartyProxy(com.nedap.archie.rm.generic.PartyProxy) IntStream(java.util.stream.IntStream) ObjectRef(com.nedap.archie.rm.support.identification.ObjectRef) Context(org.ehrbase.serialisation.walker.Context) java.util(java.util) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) PartyRef(com.nedap.archie.rm.support.identification.PartyRef) DvText(com.nedap.archie.rm.datavalues.DvText) GenericId(com.nedap.archie.rm.support.identification.GenericId) Participation(com.nedap.archie.rm.generic.Participation) ObjectId(com.nedap.archie.rm.support.identification.ObjectId) Participation(com.nedap.archie.rm.generic.Participation) GenericId(com.nedap.archie.rm.support.identification.GenericId) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) ObjectId(com.nedap.archie.rm.support.identification.ObjectId) DvText(com.nedap.archie.rm.datavalues.DvText) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier) PartyProxy(com.nedap.archie.rm.generic.PartyProxy) ObjectRef(com.nedap.archie.rm.support.identification.ObjectRef)

Example 15 with DvIdentifier

use of com.nedap.archie.rm.datavalues.DvIdentifier in project openEHR_SDK by ehrbase.

the class DefaultValues method toDvIdentifier.

public static DvIdentifier toDvIdentifier(Map<String, String> valueMap) {
    DvIdentifier dvIdentifier = new DvIdentifier();
    dvIdentifier.setId(valueMap.get("id"));
    if (StringUtils.isBlank(dvIdentifier.getId())) {
        dvIdentifier.setId(valueMap.get(""));
    }
    dvIdentifier.setAssigner(valueMap.get("assigner"));
    dvIdentifier.setIssuer(valueMap.get("issuer"));
    dvIdentifier.setType(valueMap.get("type"));
    return dvIdentifier;
}
Also used : DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier)

Aggregations

DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)21 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)10 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)6 Composition (com.nedap.archie.rm.composition.Composition)4 Observation (com.nedap.archie.rm.composition.Observation)3 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)3 DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)3 PartySelf (com.nedap.archie.rm.generic.PartySelf)3 GenericId (com.nedap.archie.rm.support.identification.GenericId)3 IOException (java.io.IOException)3 StandardCharsets (java.nio.charset.StandardCharsets)3 OffsetDateTime (java.time.OffsetDateTime)3 ZoneOffset (java.time.ZoneOffset)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 IOUtils (org.apache.commons.io.IOUtils)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 Tuple (org.assertj.core.groups.Tuple)3 PersistedPartyProxy (org.ehrbase.dao.access.jooq.party.PersistedPartyProxy)3