@SuppressWarnings("rawtypes") private String describeValidationParameters(Parameters pin) { CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); for (ParametersParameterComponent p : pin.getParameter()) { if (p.hasValue() && p.getValue() instanceof PrimitiveType) { b.append(p.getName() + "=" + ((PrimitiveType) p.getValue()).asStringValue()); } else if (p.hasValue() && p.getValue() instanceof Coding) { b.append("system=" + ((Coding) p.getValue()).getSystem()); b.append("code=" + ((Coding) p.getValue()).getCode()); b.append("display=" + ((Coding) p.getValue()).getDisplay()); } else if (p.hasValue() && p.getValue() instanceof CodeableConcept) { if (((CodeableConcept) p.getValue()).hasCoding()) { Coding c = ((CodeableConcept) p.getValue()).getCodingFirstRep(); b.append("system=" + c.getSystem()); b.append("code=" + c.getCode()); b.append("display=" + c.getDisplay()); } else if (((CodeableConcept) p.getValue()).hasText()) { b.append("text=" + ((CodeableConcept) p.getValue()).getText()); } } else if (p.hasResource() && (p.getResource() instanceof ValueSet)) { b.append("valueset=" + getVSSummary((ValueSet) p.getResource())); } } return b.toString(); }
protected void codedTriple(Subject subject, String predicate, CodeableConcept cc) { for (Coding c : cc.getCoding()) { String s = getLinkedForm(c); if (s != null) subject.predicate( predicate, new StringType(s), c.hasDisplay() ? c.getDisplay() : cc.getText()); } }
protected void codedTriple( Section section, String subject, String predicate, CodeableConcept cc) { for (Coding c : cc.getCoding()) { String s = getLinkedForm(c); if (s != null) section.triple(subject, predicate, s, c.hasDisplay() ? c.getDisplay() : cc.getText()); } }
@Override public ValidationResult validateCode(Coding code, ValueSet vs) { if (codeSystems.containsKey(code.getSystem()) && codeSystems.get(code.getSystem()) != null) try { return verifyCodeInCodeSystem( codeSystems.get(code.getSystem()), code.getSystem(), code.getCode(), code.getDisplay()); } catch (Exception e) { return new ValidationResult( IssueSeverity.FATAL, "Error validating code \"" + code + "\" in system \"" + code.getSystem() + "\": " + e.getMessage()); } else if (vs.hasExpansion()) try { return verifyCodeInternal(vs, code.getSystem(), code.getCode(), code.getDisplay()); } catch (Exception e) { return new ValidationResult( IssueSeverity.FATAL, "Error validating code \"" + code + "\" in system \"" + code.getSystem() + "\": " + e.getMessage()); } else try { return verifyCodeExternal(vs, code, true); } catch (Exception e) { return new ValidationResult( IssueSeverity.WARNING, "Error validating code \"" + code + "\" in system \"" + code.getSystem() + "\": " + e.getMessage()); } }
private String cacheId(Coding coding) { return "|" + coding.getSystem() + "|" + coding.getVersion() + "|" + coding.getCode() + "|" + coding.getDisplay(); }
private ValidationResult verifyCodeInternal(ValueSet vs, CodeableConcept code) throws Exception { for (Coding c : code.getCoding()) { ValidationResult res = verifyCodeInternal(vs, c.getSystem(), c.getCode(), c.getDisplay()); if (res.isOk()) return res; } if (code.getCoding().isEmpty()) return new ValidationResult(IssueSeverity.ERROR, "None code provided"); else return new ValidationResult( IssueSeverity.ERROR, "None of the codes are in the specified value set"); }