/** * Only produce the v3 vocabulary for appending to rim.ttl * * @throws Exception */ public void executeV3(Map<String, ValueSet> valuesets, Map<String, CodeSystem> codeSystems) throws Exception { for (ValueSet vs : this.valuesets.values()) { valuesets.put("vs:" + tail(vs.getUrl()), vs); } // for (String n : sorted(valuesets.keySet())) // gen(n, valuesets.get(n)); commit(false); }
private ValidationResult verifyCodeInExpansion(ValueSet vs, String code) throws FHIRException { if (vs.getExpansion() .hasExtension("http://hl7.org/fhir/StructureDefinition/valueset-toocostly")) { throw new FHIRException("Unable to validate core - value set is too costly to expand"); } else { ValueSetExpansionContainsComponent cc = findCode(vs.getExpansion().getContains(), code); if (cc == null) return new ValidationResult( IssueSeverity.ERROR, "Unknown Code " + code + " in " + vs.getUrl()); return null; } }
private ValidationResult verifyCodeExternal(ValueSet vs, CodeableConcept cc, boolean tryCache) throws Exception { ValidationResult res = handleByCache(vs, cc, tryCache); if (res != null) return res; Parameters pin = new Parameters(); pin.addParameter().setName("codeableConcept").setValue(cc); pin.addParameter().setName("valueSet").setResource(vs); res = serverValidateCode(pin, false); Map<String, ValidationResult> cache = validationCache.get(vs.getUrl()); cache.put(cacheId(cc), res); return res; }
private ValidationResult handleByCache(ValueSet vs, Coding coding, boolean tryCache) { String cacheId = cacheId(coding); Map<String, ValidationResult> cache = validationCache.get(vs.getUrl()); if (cache == null) { cache = new HashMap<String, IWorkerContext.ValidationResult>(); validationCache.put(vs.getUrl(), cache); } if (cache.containsKey(cacheId)) return cache.get(cacheId); if (!tryCache) return null; if (!cacheValidation) return null; if (failed.contains(vs.getUrl())) return null; ValueSetExpansionOutcome vse = expandVS(vs, true, false); if (vse.getValueset() == null || notcomplete(vse.getValueset())) { failed.add(vs.getUrl()); return null; } ValidationResult res = validateCode(coding, vse.getValueset()); cache.put(cacheId, res); return res; }
private ValidationResult verifyCodeExternal(ValueSet vs, Coding coding, boolean tryCache) throws Exception { ValidationResult res = vs == null ? null : handleByCache(vs, coding, tryCache); if (res != null) return res; Parameters pin = new Parameters(); pin.addParameter().setName("coding").setValue(coding); if (vs != null) pin.addParameter().setName("valueSet").setResource(vs); res = serverValidateCode(pin, vs == null); if (vs != null) { Map<String, ValidationResult> cache = validationCache.get(vs.getUrl()); cache.put(cacheId(coding), res); } return res; }
private ValidationResult verifyCodeInExpansion( ValueSet vs, String system, String code, String display) { ValueSetExpansionContainsComponent cc = findCode(vs.getExpansion().getContains(), code); if (cc == null) return new ValidationResult( IssueSeverity.ERROR, "Unknown Code " + code + " in " + vs.getUrl()); if (display == null) return new ValidationResult( new ConceptDefinitionComponent().setCode(code).setDisplay(cc.getDisplay())); if (cc.hasDisplay()) { if (display.equalsIgnoreCase(cc.getDisplay())) return new ValidationResult( new ConceptDefinitionComponent().setCode(code).setDisplay(cc.getDisplay())); return new ValidationResult( IssueSeverity.WARNING, "Display Name for " + code + " must be '" + cc.getDisplay() + "'", new ConceptDefinitionComponent().setCode(code).setDisplay(cc.getDisplay())); } return null; }
public ValueSetExpansionOutcome expandOnServer(ValueSet vs, String fn) throws Exception { if (noTerminologyServer) return new ValueSetExpansionOutcome( "Error expanding ValueSet: running without terminology services", TerminologyServiceErrorClass.NOSERVICE); if (expProfile == null) throw new Exception("No ExpansionProfile provided"); try { Map<String, String> params = new HashMap<String, String>(); params.put("_limit", Integer.toString(expandCodesLimit)); params.put("_incomplete", "true"); log("Terminology Server: $expand on " + getVSSummary(vs)); ValueSet result = txServer.expandValueset(vs, expProfile.setIncludeDefinition(false), params); return new ValueSetExpansionOutcome(result); } catch (Exception e) { return new ValueSetExpansionOutcome( "Error expanding ValueSet \"" + vs.getUrl() + ": " + e.getMessage(), TerminologyServiceErrorClass.UNKNOWN); } }