use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent in project kindling by HL7.
the class BuildWorkerContext method verifyCode.
private ValidationResult verifyCode(CodeSystem cs, String code, String display) throws Exception {
ConceptDefinitionComponent cc = findCodeInConcept(cs.getConcept(), code);
if (cc == null)
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.ERROR, "Display Name for " + code + " must be one of '" + b.toString() + "'");
}
use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent in project kindling by HL7.
the class BuildWorkerContext method verifyUcum.
private ValidationResult verifyUcum(String code, String display) {
String s = ucum.validate(code);
if (s != null) {
System.out.println("UCUM eror: " + s);
return new ValidationResult(IssueSeverity.ERROR, s);
} else {
ConceptDefinitionComponent def = new ConceptDefinitionComponent();
def.setCode(code);
def.setDisplay(ucum.getCommonDisplay(code));
return new ValidationResult(def);
}
}
use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent in project kindling by HL7.
the class BuildWorkerContext method locateLoinc.
private ConceptDefinitionComponent locateLoinc(String code) throws Exception {
if (!loincCodes.containsKey(code))
return null;
ConceptDefinitionComponent cc = new ConceptDefinitionComponent();
cc.setCode(code);
String s = loincCodes.get(code).display;
cc.setDisplay(s);
return cc;
}
use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent in project kindling by HL7.
the class BuildWorkerContext method locateSnomed.
private ConceptDefinitionComponent locateSnomed(String code) throws Exception {
if (!snomedCodes.containsKey(code))
queryForTerm(code);
if (!snomedCodes.containsKey(code))
return null;
ConceptDefinitionComponent cc = new ConceptDefinitionComponent();
cc.setCode(code);
cc.setDisplay(snomedCodes.get(code).display);
return cc;
}
use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent in project kindling by HL7.
the class ValueSetValidator method checkCodeCaseDuplicates.
private void checkCodeCaseDuplicates(List<ValidationMessage> errors, String nameForErrors, CodeSystem cs, Set<String> codes, List<ConceptDefinitionComponent> concepts) {
for (ConceptDefinitionComponent c : concepts) {
if (c.hasCode()) {
String cc = c.getCode().toLowerCase();
rule(errors, IssueType.BUSINESSRULE, getWg(cs) + ":CodeSystem[" + cs.getId() + "].define", !codes.contains(cc), "Value set " + nameForErrors + " (" + cs.getName() + "): Code '" + cc + "' is defined twice, different by case - this is not allowed in a FHIR definition");
if (c.hasConcept())
checkCodeCaseDuplicates(errors, nameForErrors, cs, codes, c.getConcept());
}
}
}
Aggregations