Search in sources :

Example 81 with ConceptDefinitionComponent

use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent in project kindling by HL7.

the class ValueSetValidator method checkCodesForDisplayAndDefinition.

private void checkCodesForDisplayAndDefinition(List<ValidationMessage> errors, String path, List<ConceptDefinitionComponent> concept, CodeSystem cs, String nameForErrors) {
    int i = 0;
    for (ConceptDefinitionComponent cc : concept) {
        String p = path + "[" + Integer.toString(i) + "]";
        if (!suppressedwarning(errors, IssueType.BUSINESSRULE, p, !CodeSystemUtilities.isNotSelectable(cs, cc) || !cc.hasCode() || cc.hasDisplay(), "Code System '" + cs.getUrl() + "' has a code without a display ('" + cc.getCode() + "')", "<a href=\"" + cs.getUserString("path") + "\">Value set " + nameForErrors + " (" + cs.getName() + ")</a>: Code System '" + cs.getUrl() + "' has a code without a display ('" + cc.getCode() + "')"))
            return;
        if (!suppressedwarning(errors, IssueType.BUSINESSRULE, p, cc.hasDefinition() && (!cc.getDefinition().toLowerCase().equals("todo") || cc.getDefinition().toLowerCase().equals("to do")), "Code System '" + cs.getUrl() + "' has a code without a definition ('" + cc.getCode() + "')", "<a href=\"" + cs.getUserString("path") + "\">Value set " + nameForErrors + " (" + cs.getName() + ")</a>: Code System '" + cs.getUrl() + "' has a code without a definition ('" + cc.getCode() + "')"))
            return;
        checkCodesForDisplayAndDefinition(errors, p + ".concept", cc.getConcept(), cs, nameForErrors);
        i++;
    }
}
Also used : ConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent)

Example 82 with ConceptDefinitionComponent

use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent in project kindling by HL7.

the class BindingsFixer method processCodes.

private static void processCodes(CodeSystem cs, Sheet sheet) throws Exception {
    Map<String, ConceptDefinitionComponent> concepts = new HashMap<>();
    for (int row = 0; row < sheet.rows.size(); row++) {
        if (Utilities.noString(sheet.getColumn(row, "System"))) {
            ConceptDefinitionComponent cc = new ConceptDefinitionComponent();
            cc.setUserData("id", sheet.getColumn(row, "Id"));
            cc.setCode(sheet.getColumn(row, "Code"));
            concepts.put(cc.getCode(), cc);
            cc.setDisplay(sheet.getColumn(row, "Display"));
            if (sheet.getColumn(row, "Abstract").toUpperCase().equals("Y"))
                CodeSystemUtilities.setNotSelectable(cs, cc);
            if (cc.hasCode() && !cc.hasDisplay())
                cc.setDisplay(Utilities.humanize(cc.getCode()));
            cc.setDefinition(Utilities.appendPeriod(sheet.getColumn(row, "Definition")));
            if (!Utilities.noString(sheet.getColumn(row, "Comment")))
                ToolingExtensions.addCSComment(cc, sheet.getColumn(row, "Comment"));
            String parent = sheet.getColumn(row, "Parent");
            if (Utilities.noString(parent))
                cs.addConcept(cc);
            else {
                concepts.get(parent).addConcept(cc);
            }
        }
    }
}
Also used : ConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent) HashMap(java.util.HashMap)

Example 83 with ConceptDefinitionComponent

use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent in project kindling by HL7.

the class XSDBaseGenerator method genIncludedCode.

private void genIncludedCode(ValueSetExpansionContainsComponent cc) throws IOException {
    write("      <xs:enumeration value=\"" + Utilities.escapeXml(cc.getCode()) + "\">\r\n");
    write("        <xs:annotation>\r\n");
    // todo: do we need to look the definition up?
    write("          <xs:documentation xml:lang=\"en\">" + Utilities.escapeXml(cc.getDisplay()) + "</xs:documentation>\r\n");
    CodeSystem cs = workerContext.fetchCodeSystem(cc.getSystem());
    if (cs != null && cc.hasCode()) {
        ConceptDefinitionComponent c = getCodeDefinition(cc.getCode(), cs.getConcept());
        if (c != null && c.hasDesignation()) {
            for (ConceptDefinitionDesignationComponent l : c.getDesignation()) {
                if (l.hasLanguage()) {
                    write("          <xs:documentation xml:lang=\"" + l.getLanguage() + "\">" + Utilities.escapeXml(l.getValue()) + "</xs:documentation>\r\n");
                }
            }
        }
    }
    write("        </xs:annotation>\r\n");
    write("      </xs:enumeration>\r\n");
}
Also used : ConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent) ConceptDefinitionDesignationComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent) CodeSystem(org.hl7.fhir.r5.model.CodeSystem)

Example 84 with ConceptDefinitionComponent

use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent in project kindling by HL7.

the class XSDGenerator method genIncludedCode.

private void genIncludedCode(ValueSetExpansionContainsComponent cc) throws IOException {
    write("      <xs:enumeration value=\"" + Utilities.escapeXml(cc.getCode()) + "\">\r\n");
    write("        <xs:annotation>\r\n");
    // todo: do we need to look the definition up?
    write("          <xs:documentation xml:lang=\"en\">" + Utilities.escapeXml(cc.getDisplay()) + "</xs:documentation>\r\n");
    CodeSystem cs = workerContext.fetchCodeSystem(cc.getSystem());
    if (cs != null && cc.hasCode()) {
        ConceptDefinitionComponent c = getCodeDefinition(cc.getCode(), cs.getConcept());
        if (c != null)
            for (ConceptDefinitionDesignationComponent l : c.getDesignation()) if (l.hasLanguage())
                write("          <xs:documentation xml:lang=\"" + l.getLanguage() + "\">" + Utilities.escapeXml(l.getValue()) + "</xs:documentation>\r\n");
    }
    write("        </xs:annotation>\r\n");
    write("      </xs:enumeration>\r\n");
}
Also used : ConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent) ConceptDefinitionDesignationComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent) CodeSystem(org.hl7.fhir.r5.model.CodeSystem)

Example 85 with ConceptDefinitionComponent

use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent in project kindling by HL7.

the class BindingSpecification method processCode.

private void processCode(CodeSystem cs, ConceptDefinitionComponent c, String system, String parent) {
    DefinedCode code = new DefinedCode();
    code.setCode(c.getCode());
    code.setDisplay(c.getDisplay());
    code.setComment(ToolingExtensions.getCSComment(c));
    code.setDefinition(c.getDefinition());
    code.setParent(parent);
    code.setSystem(system);
    code.setAbstract(CodeSystemUtilities.isNotSelectable(cs, c));
    allCodes.add(code);
    for (ConceptDefinitionComponent cc : c.getConcept()) processCode(cs, cc, system, c.getCode());
}
Also used : ConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent)

Aggregations

ConceptDefinitionComponent (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent)54 ArrayList (java.util.ArrayList)26 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)26 ConceptDefinitionComponent (org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent)22 CodeSystem (org.hl7.fhir.r5.model.CodeSystem)21 ConceptDefinitionComponent (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent)17 ConceptDefinitionComponent (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent)16 ValueSet (org.hl7.fhir.dstu2.model.ValueSet)15 FHIRException (org.hl7.fhir.exceptions.FHIRException)14 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)12 ConceptPropertyComponent (org.hl7.fhir.r4b.model.CodeSystem.ConceptPropertyComponent)10 ConceptPropertyComponent (org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent)10 IOException (java.io.IOException)9 HashMap (java.util.HashMap)9 NotImplementedException (org.apache.commons.lang3.NotImplementedException)9 TerminologyServiceException (org.hl7.fhir.exceptions.TerminologyServiceException)9 FileNotFoundException (java.io.FileNotFoundException)8 ConceptDefinitionComponent (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent)8 ValidationResult (org.hl7.fhir.r5.context.IWorkerContext.ValidationResult)8 ConceptDefinitionDesignationComponent (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent)8