Handle unknown code systems properly
This commit is contained in:
parent
c2dfdfea0b
commit
95d8399992
|
@ -943,6 +943,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
if (!t.hasResult()) {
|
if (!t.hasResult()) {
|
||||||
try {
|
try {
|
||||||
ValueSetValidator vsc = constructValueSetCheckerSimple(options, vs);
|
ValueSetValidator vsc = constructValueSetCheckerSimple(options, vs);
|
||||||
|
vsc.setThrowToServer(options.isUseServer() && tcc.getClient() != null);
|
||||||
ValidationResult res = vsc.validateCode("Coding", t.getCoding());
|
ValidationResult res = vsc.validateCode("Coding", t.getCoding());
|
||||||
if (txCache != null) {
|
if (txCache != null) {
|
||||||
txCache.cacheValidation(t.getCacheToken(), res, TerminologyCache.TRANSIENT);
|
txCache.cacheValidation(t.getCacheToken(), res, TerminologyCache.TRANSIENT);
|
||||||
|
@ -1059,12 +1060,15 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
}
|
}
|
||||||
|
|
||||||
List<OperationOutcomeIssueComponent> issues = new ArrayList<>();
|
List<OperationOutcomeIssueComponent> issues = new ArrayList<>();
|
||||||
|
Set<String> unknownSystems = new HashSet<>();
|
||||||
|
|
||||||
String localError = null;
|
String localError = null;
|
||||||
if (options.isUseClient()) {
|
if (options.isUseClient()) {
|
||||||
// ok, first we try to validate locally
|
// ok, first we try to validate locally
|
||||||
try {
|
try {
|
||||||
ValueSetValidator vsc = constructValueSetCheckerSimple(options, vs, ctxt);
|
ValueSetValidator vsc = constructValueSetCheckerSimple(options, vs, ctxt);
|
||||||
|
vsc.setUnknownSystems(unknownSystems);
|
||||||
|
vsc.setThrowToServer(options.isUseServer() && tcc.getClient() != null);
|
||||||
if (!ValueSetUtilities.isServerSide(code.getSystem())) {
|
if (!ValueSetUtilities.isServerSide(code.getSystem())) {
|
||||||
res = vsc.validateCode(path, code);
|
res = vsc.validateCode(path, code);
|
||||||
if (txCache != null) {
|
if (txCache != null) {
|
||||||
|
@ -1084,7 +1088,11 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localError != null && tcc.getClient() == null) {
|
if (localError != null && tcc.getClient() == null) {
|
||||||
return new ValidationResult(IssueSeverity.ERROR, localError, TerminologyServiceErrorClass.UNKNOWN, issues);
|
if (unknownSystems.size() > 0) {
|
||||||
|
return new ValidationResult(IssueSeverity.ERROR, localError, TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED, issues).setUnknownSystems(unknownSystems);
|
||||||
|
} else {
|
||||||
|
return new ValidationResult(IssueSeverity.ERROR, localError, TerminologyServiceErrorClass.UNKNOWN, issues);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!options.isUseServer()) {
|
if (!options.isUseServer()) {
|
||||||
return new ValidationResult(IssueSeverity.WARNING,formatMessage(I18nConstants.UNABLE_TO_VALIDATE_CODE_WITHOUT_USING_SERVER, localError), TerminologyServiceErrorClass.BLOCKED_BY_OPTIONS, issues);
|
return new ValidationResult(IssueSeverity.WARNING,formatMessage(I18nConstants.UNABLE_TO_VALIDATE_CODE_WITHOUT_USING_SERVER, localError), TerminologyServiceErrorClass.BLOCKED_BY_OPTIONS, issues);
|
||||||
|
@ -1204,11 +1212,14 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
codeSystemsUsed.add(c.getSystem());
|
codeSystemsUsed.add(c.getSystem());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Set<String> unknownSystems = new HashSet<>();
|
||||||
|
|
||||||
if (options.isUseClient()) {
|
if (options.isUseClient()) {
|
||||||
// ok, first we try to validate locally
|
// ok, first we try to validate locally
|
||||||
try {
|
try {
|
||||||
ValueSetValidator vsc = constructValueSetCheckerSimple(options, vs);
|
ValueSetValidator vsc = constructValueSetCheckerSimple(options, vs);
|
||||||
|
vsc.setUnknownSystems(unknownSystems);
|
||||||
|
vsc.setThrowToServer(options.isUseServer() && tcc.getClient() != null);
|
||||||
res = vsc.validateCode("CodeableConcept", code);
|
res = vsc.validateCode("CodeableConcept", code);
|
||||||
txCache.cacheValidation(cacheToken, res, TerminologyCache.TRANSIENT);
|
txCache.cacheValidation(cacheToken, res, TerminologyCache.TRANSIENT);
|
||||||
return res;
|
return res;
|
||||||
|
@ -1349,6 +1360,8 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
version = ((PrimitiveType<?>) p.getValue()).asStringValue();
|
version = ((PrimitiveType<?>) p.getValue()).asStringValue();
|
||||||
} else if (p.getName().equals("code")) {
|
} else if (p.getName().equals("code")) {
|
||||||
code = ((PrimitiveType<?>) p.getValue()).asStringValue();
|
code = ((PrimitiveType<?>) p.getValue()).asStringValue();
|
||||||
|
} else if (p.getName().equals("x-caused-by-unknown-system")) {
|
||||||
|
err = TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED;
|
||||||
} else if (p.getName().equals("cause")) {
|
} else if (p.getName().equals("cause")) {
|
||||||
try {
|
try {
|
||||||
IssueType it = IssueType.fromCode(((StringType) p.getValue()).getValue());
|
IssueType it = IssueType.fromCode(((StringType) p.getValue()).getValue());
|
||||||
|
|
Loading…
Reference in New Issue