Add supplements for used systems as well as for value set systems when validating on server
This commit is contained in:
parent
caf5003215
commit
cff693eb10
|
@ -1375,7 +1375,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Parameters pIn = constructParameters(options, code);
|
Parameters pIn = constructParameters(options, code);
|
||||||
res = validateOnServer(tc, vs, pIn, options);
|
res = validateOnServer2(tc, vs, pIn, options, systems);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
res = new ValidationResult(IssueSeverity.ERROR, e.getMessage() == null ? e.getClass().getName() : e.getMessage(), null).setTxLink(txLog == null ? null : txLog.getLastId()).setErrorClass(TerminologyServiceErrorClass.SERVER_ERROR);
|
res = new ValidationResult(IssueSeverity.ERROR, e.getMessage() == null ? e.getClass().getName() : e.getMessage(), null).setTxLink(txLog == null ? null : txLog.getLastId()).setErrorClass(TerminologyServiceErrorClass.SERVER_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -1645,7 +1645,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
txLog("$validate "+txCache.summary(code)+" for "+ txCache.summary(vs)+" on "+tc.getAddress());
|
txLog("$validate "+txCache.summary(code)+" for "+ txCache.summary(vs)+" on "+tc.getAddress());
|
||||||
try {
|
try {
|
||||||
Parameters pIn = constructParameters(options, code);
|
Parameters pIn = constructParameters(options, code);
|
||||||
res = validateOnServer(tc, vs, pIn, options);
|
res = validateOnServer2(tc, vs, pIn, options, systems);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
issues.clear();
|
issues.clear();
|
||||||
OperationOutcomeIssueComponent iss = new OperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.ERROR, org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXCEPTION);
|
OperationOutcomeIssueComponent iss = new OperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.ERROR, org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXCEPTION);
|
||||||
|
@ -1727,6 +1727,10 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ValidationResult validateOnServer(TerminologyClientContext tc, ValueSet vs, Parameters pin, ValidationOptions options) throws FHIRException {
|
protected ValidationResult validateOnServer(TerminologyClientContext tc, ValueSet vs, Parameters pin, ValidationOptions options) throws FHIRException {
|
||||||
|
return validateOnServer2(tc, vs, pin, options, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ValidationResult validateOnServer2(TerminologyClientContext tc, ValueSet vs, Parameters pin, ValidationOptions options, Set<String> systems) throws FHIRException {
|
||||||
|
|
||||||
if (vs != null) {
|
if (vs != null) {
|
||||||
for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
|
for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
|
||||||
|
@ -1737,7 +1741,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addServerValidationParameters(tc, vs, pin, options);
|
addServerValidationParameters(tc, vs, pin, options, systems);
|
||||||
|
|
||||||
if (txLog != null) {
|
if (txLog != null) {
|
||||||
txLog.clearLastId();
|
txLog.clearLastId();
|
||||||
|
@ -1755,6 +1759,10 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addServerValidationParameters(TerminologyClientContext terminologyClientContext, ValueSet vs, Parameters pin, ValidationOptions options) {
|
protected void addServerValidationParameters(TerminologyClientContext terminologyClientContext, ValueSet vs, Parameters pin, ValidationOptions options) {
|
||||||
|
addServerValidationParameters(terminologyClientContext, vs, pin, options, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addServerValidationParameters(TerminologyClientContext terminologyClientContext, ValueSet vs, Parameters pin, ValidationOptions options, Set<String> systems) {
|
||||||
boolean cache = false;
|
boolean cache = false;
|
||||||
if (vs != null) {
|
if (vs != null) {
|
||||||
if (terminologyClientContext != null && terminologyClientContext.isTxCaching() && terminologyClientContext.getCacheId() != null && vs.getUrl() != null && terminologyClientContext.getCached().contains(vs.getUrl()+"|"+ vs.getVersion())) {
|
if (terminologyClientContext != null && terminologyClientContext.isTxCaching() && terminologyClientContext.getCacheId() != null && vs.getUrl() != null && terminologyClientContext.getCached().contains(vs.getUrl()+"|"+ vs.getVersion())) {
|
||||||
|
@ -1777,6 +1785,11 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
cache = true;
|
cache = true;
|
||||||
addDependentResources(terminologyClientContext, pin, vs);
|
addDependentResources(terminologyClientContext, pin, vs);
|
||||||
}
|
}
|
||||||
|
if (systems != null) {
|
||||||
|
for (String s : systems) {
|
||||||
|
cache = addDependentCodeSystem(terminologyClientContext, pin, s, null) || cache;
|
||||||
|
}
|
||||||
|
}
|
||||||
pin.addParameter().setName("cache-id").setValue(new IdType(terminologyClientManager.getCacheId()));
|
pin.addParameter().setName("cache-id").setValue(new IdType(terminologyClientManager.getCacheId()));
|
||||||
for (ParametersParameterComponent pp : pin.getParameter()) {
|
for (ParametersParameterComponent pp : pin.getParameter()) {
|
||||||
if (pp.getName().equals("profile")) {
|
if (pp.getName().equals("profile")) {
|
||||||
|
@ -1823,13 +1836,20 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CodeSystem cs = fetchResource(CodeSystem.class, inc.getSystem(), src);
|
String sys = inc.getSystem();
|
||||||
|
cache = addDependentCodeSystem(tc, pin, sys, src) || cache;
|
||||||
|
return cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean addDependentCodeSystem(TerminologyClientContext tc, Parameters pin, String sys, Resource src) {
|
||||||
|
boolean cache = false;
|
||||||
|
CodeSystem cs = fetchResource(CodeSystem.class, sys, src);
|
||||||
if (cs != null && !hasCanonicalResource(pin, "tx-resource", cs.getVUrl()) && (cs.getContent() == CodeSystemContentMode.COMPLETE || cs.getContent() == CodeSystemContentMode.FRAGMENT)) {
|
if (cs != null && !hasCanonicalResource(pin, "tx-resource", cs.getVUrl()) && (cs.getContent() == CodeSystemContentMode.COMPLETE || cs.getContent() == CodeSystemContentMode.FRAGMENT)) {
|
||||||
cache = checkAddToParams(tc, pin, cs) || cache;
|
cache = checkAddToParams(tc, pin, cs) || cache;
|
||||||
}
|
}
|
||||||
for (CodeSystem supp : codeSystems.getSupplements(cs)) {
|
for (CodeSystem supp : codeSystems.getSupplements(cs)) {
|
||||||
//if (supp.getContent() == CodeSystemContentMode.SUPPLEMENT && supp.getSupplements().equals(inc.getSystem())) {
|
//if (supp.getContent() == CodeSystemContentMode.SUPPLEMENT && supp.getSupplements().equals(inc.getSystem())) {
|
||||||
assert supp.getContent() == CodeSystemContentMode.SUPPLEMENT && supp.getSupplements().equals(inc.getSystem());
|
assert supp.getContent() == CodeSystemContentMode.SUPPLEMENT && supp.getSupplements().equals(sys);
|
||||||
cache = checkAddToParams(tc, pin, supp) || cache;
|
cache = checkAddToParams(tc, pin, supp) || cache;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue