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