Search in sources :

Example 16 with ConceptDefinitionDesignationComponent

use of org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent in project org.hl7.fhir.core by hapifhir.

the class CodeSystemRenderer method addLanguageRow.

private void addLanguageRow(ConceptDefinitionComponent c, XhtmlNode t, List<String> langs) {
    XhtmlNode tr = t.tr();
    tr.td().addText(c.getCode());
    for (String lang : langs) {
        ConceptDefinitionDesignationComponent d = null;
        for (ConceptDefinitionDesignationComponent designation : c.getDesignation()) {
            if (designation.hasLanguage()) {
                if (lang.equals(designation.getLanguage()))
                    d = designation;
            }
        }
        tr.td().addText(d == null ? "" : d.getValue());
    }
}
Also used : ConceptDefinitionDesignationComponent(org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionDesignationComponent) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 17 with ConceptDefinitionDesignationComponent

use of org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent in project org.hl7.fhir.core by hapifhir.

the class BaseWorkerContext method verifyCodeInCodeSystem.

private ValidationResult verifyCodeInCodeSystem(ValueSet vs, String system, String code, String display) {
    ConceptDefinitionComponent cc = findCodeInConcept(vs.getCodeSystem().getConcept(), code);
    if (cc == null)
        return new ValidationResult(IssueSeverity.ERROR, "Unknown Code " + code + " in " + vs.getCodeSystem().getSystem());
    if (display == null)
        return new ValidationResult(cc);
    CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
    if (cc.hasDisplay()) {
        b.append(cc.getDisplay());
        if (display.equalsIgnoreCase(cc.getDisplay()))
            return new ValidationResult(cc);
    }
    for (ConceptDefinitionDesignationComponent ds : cc.getDesignation()) {
        b.append(ds.getValue());
        if (display.equalsIgnoreCase(ds.getValue()))
            return new ValidationResult(cc);
    }
    return new ValidationResult(IssueSeverity.ERROR, "Display Name for " + code + " must be one of '" + b.toString() + "'");
}
Also used : ConceptDefinitionComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent) ConceptDefinitionDesignationComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 18 with ConceptDefinitionDesignationComponent

use of org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent in project org.hl7.fhir.core by hapifhir.

the class NarrativeGenerator method addLanguageRow.

private void addLanguageRow(ConceptDefinitionComponent c, XhtmlNode t, List<String> langs) {
    XhtmlNode tr = t.addTag("tr");
    tr.addTag("td").addText(c.getCode());
    for (String lang : langs) {
        ConceptDefinitionDesignationComponent d = null;
        for (ConceptDefinitionDesignationComponent designation : c.getDesignation()) {
            if (lang.equals(designation.getLanguage()))
                d = designation;
        }
        tr.addTag("td").addText(d == null ? "" : d.getValue());
    }
}
Also used : ConceptDefinitionDesignationComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 19 with ConceptDefinitionDesignationComponent

use of org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent in project org.hl7.fhir.core by hapifhir.

the class BaseWorkerContext method verifyCodeInCodeSystem.

private ValidationResult verifyCodeInCodeSystem(CodeSystem cs, String system, String code, String display) throws Exception {
    ConceptDefinitionComponent cc = findCodeInConcept(cs.getConcept(), code);
    if (cc == null) {
        if (cs.getContent().equals(CodeSystem.CodeSystemContentMode.COMPLETE)) {
            return new ValidationResult(IssueSeverity.ERROR, "Unknown Code " + code + " in " + cs.getUrl());
        } else if (!cs.getContent().equals(CodeSystem.CodeSystemContentMode.NOTPRESENT)) {
            return new ValidationResult(IssueSeverity.WARNING, "Unknown Code " + code + " in partial code list of " + cs.getUrl());
        } else {
            return verifyCodeExternal(null, new Coding().setSystem(system).setCode(code).setDisplay(display), false);
        }
    }
    // return new ValidationResult(IssueSeverity.ERROR, "Unknown Code "+code+" in "+cs.getUrl());
    if (display == null) {
        return new ValidationResult(cc);
    }
    CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
    if (cc.hasDisplay()) {
        b.append(cc.getDisplay());
        if (display.equalsIgnoreCase(cc.getDisplay())) {
            return new ValidationResult(cc);
        }
    }
    for (ConceptDefinitionDesignationComponent ds : cc.getDesignation()) {
        b.append(ds.getValue());
        if (display.equalsIgnoreCase(ds.getValue())) {
            return new ValidationResult(cc);
        }
    }
    return new ValidationResult(IssueSeverity.WARNING, "Display Name for " + code + " must be one of '" + b.toString() + "'", cc);
}
Also used : ConceptDefinitionComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent) Coding(org.hl7.fhir.dstu3.model.Coding) ConceptDefinitionDesignationComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 20 with ConceptDefinitionDesignationComponent

use of org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent in project org.hl7.fhir.core by hapifhir.

the class ValueSetExpanderSimple method addCode.

private ValueSetExpansionContainsComponent addCode(String system, String code, String display, ValueSetExpansionContainsComponent parent, List<ConceptDefinitionDesignationComponent> designations, Parameters expParams, boolean isAbstract, boolean inactive, List<ValueSet> filters) {
    if (filters != null && !filters.isEmpty() && !filterContainsCode(filters, system, code))
        return null;
    ValueSetExpansionContainsComponent n = new ValueSet.ValueSetExpansionContainsComponent();
    n.setSystem(system);
    n.setCode(code);
    if (isAbstract)
        n.setAbstract(true);
    if (inactive)
        n.setInactive(true);
    if (expParams.getParameterBool("includeDesignations") && designations != null) {
        for (ConceptDefinitionDesignationComponent t : designations) {
            ToolingExtensions.addLanguageTranslation(n, t.getLanguage(), t.getValue());
        }
    }
    ConceptDefinitionDesignationComponent t = expParams.hasLanguage() ? getMatchingLang(designations, expParams.getLanguage()) : null;
    if (t == null)
        n.setDisplay(display);
    else
        n.setDisplay(t.getValue());
    String s = key(n);
    if (map.containsKey(s) || excludeKeys.contains(s)) {
        canBeHeirarchy = false;
    } else {
        codes.add(n);
        map.put(s, n);
        total++;
    }
    if (canBeHeirarchy && parent != null) {
        parent.getContains().add(n);
    } else {
        roots.add(n);
    }
    return n;
}
Also used : ValueSetExpansionContainsComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent) ConceptDefinitionDesignationComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent)

Aggregations

ConceptDefinitionDesignationComponent (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent)11 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)10 ConceptDefinitionComponent (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent)7 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)7 ArrayList (java.util.ArrayList)6 ConceptDefinitionDesignationComponent (org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionDesignationComponent)6 ConceptDefinitionDesignationComponent (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent)4 ConceptDefinitionDesignationComponent (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent)4 CodeSystem (org.hl7.fhir.r5.model.CodeSystem)4 ConceptReferenceDesignationComponent (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent)4 ConceptReferenceDesignationComponent (org.hl7.fhir.r4b.model.ValueSet.ConceptReferenceDesignationComponent)3 ConceptDefinitionDesignationComponent (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent)2 ConceptDefinitionDesignationComponent (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent)2 ConceptReferenceDesignationComponent (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent)2 ConceptDefinitionComponent (org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent)2 Extension (org.hl7.fhir.r5.model.Extension)2 ConceptDefinitionComponent (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent)1 ConceptDefinitionComponent (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent)1 ConceptDefinitionComponent (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent)1 Coding (org.hl7.fhir.dstu3.model.Coding)1