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++;
}
}
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);
}
}
}
}
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");
}
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");
}
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());
}
Aggregations