Search in sources :

Example 1 with ReferenceRange

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

the class DvOrderedPostprocessor method process.

/**
 * {@inheritDoc} Adds the encoding information
 */
@Override
public void process(String term, DvOrdered rmObject, Map<String, Object> values, Context<Map<String, Object>> context) {
    if (rmObject.getNormalRange() != null) {
        handleRange(term + "/_normal_range", values, rmObject.getNormalRange(), context);
    }
    IntStream.range(0, rmObject.getOtherReferenceRanges().size()).forEach(i -> {
        ReferenceRange referenceRange = (ReferenceRange) rmObject.getOtherReferenceRanges().get(i);
        if (referenceRange.getMeaning() != null) {
            callMarshal(term, "_other_reference_ranges:" + i + "/meaning", referenceRange.getMeaning(), values, context, context.getNodeDeque().peek().findChildById("meaning").orElse(null));
            callPostprocess(term, "_other_reference_ranges:" + i + "/meaning", referenceRange.getMeaning(), values, context, context.getNodeDeque().peek().findChildById("meaning").orElse(null));
        }
        if (referenceRange.getRange() != null) {
            handleRange(term + "/_other_reference_ranges:" + i, values, referenceRange.getRange(), context);
        }
    });
    addValue(values, term, "normal_status", Optional.ofNullable(rmObject.getNormalStatus()).map(CodePhrase::getCodeString).orElse(null));
}
Also used : CodePhrase(com.nedap.archie.rm.datatypes.CodePhrase) ReferenceRange(com.nedap.archie.rm.datavalues.quantity.ReferenceRange)

Example 2 with ReferenceRange

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

the class DvOrderedPostprocessor method process.

/**
 * {@inheritDoc}
 */
@Override
public void process(String term, DvOrdered rmObject, Map<FlatPathDto, String> values, Set<String> consumedPaths, Context<Map<FlatPathDto, String>> context) {
    handleNormalRange(values, consumedPaths, context, term + "/_normal_range", rmObject::setNormalRange);
    FlatHelper.extractMultiValuedFullPath(term, "_other_reference_ranges", values).forEach((k, v) -> {
        ReferenceRange referenceRange = new ReferenceRange();
        rmObject.addOtherReferenceRange(referenceRange);
        Map<FlatPathDto, String> meaningValues = FlatHelper.filter(values, term + "/_other_reference_ranges:" + k + "/meaning", false);
        if (!meaningValues.isEmpty()) {
            final DvText meaning;
            String meaningAttributeName = "meaning";
            boolean isDvCodedText = isDvCodedText(meaningValues, term + "/_other_reference_ranges:" + k + "/meaning");
            if (isDvCodedText) {
                meaning = new DvCodedText();
            } else {
                meaning = new DvText();
            }
            referenceRange.setMeaning(meaning);
            callUnmarshal(term + "/_other_reference_ranges:" + k, meaningAttributeName, meaning, meaningValues, consumedPaths, context, context.getNodeDeque().peek().findChildById(meaningAttributeName).orElse(buildDummyChild(meaningAttributeName, context.getNodeDeque().peek())));
            callPostProcess(term + "/_other_reference_ranges:" + k, meaningAttributeName, meaning, meaningValues, consumedPaths, context, context.getNodeDeque().peek().findChildById(meaningAttributeName).orElse(buildDummyChild(meaningAttributeName, context.getNodeDeque().peek())));
        }
        handleNormalRange(v, consumedPaths, context, term + "/_other_reference_ranges:" + k, referenceRange::setRange);
    });
    setValue(term, "normal_status", values, s -> {
        if (s != null) {
            rmObject.setNormalStatus(new CodePhrase(new TerminologyId("openehr_normal_statuses"), s));
        }
    }, String.class, consumedPaths);
}
Also used : TerminologyId(com.nedap.archie.rm.support.identification.TerminologyId) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) FlatHelper.isDvCodedText(org.ehrbase.serialisation.walker.FlatHelper.isDvCodedText) CodePhrase(com.nedap.archie.rm.datatypes.CodePhrase) ReferenceRange(com.nedap.archie.rm.datavalues.quantity.ReferenceRange) FlatPathDto(org.ehrbase.webtemplate.path.flat.FlatPathDto) DvText(com.nedap.archie.rm.datavalues.DvText)

Aggregations

CodePhrase (com.nedap.archie.rm.datatypes.CodePhrase)2 ReferenceRange (com.nedap.archie.rm.datavalues.quantity.ReferenceRange)2 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)1 DvText (com.nedap.archie.rm.datavalues.DvText)1 TerminologyId (com.nedap.archie.rm.support.identification.TerminologyId)1 FlatHelper.isDvCodedText (org.ehrbase.serialisation.walker.FlatHelper.isDvCodedText)1 FlatPathDto (org.ehrbase.webtemplate.path.flat.FlatPathDto)1