Add support for unknown code system version validating concept maps

This commit is contained in:
Grahame Grieve 2024-07-28 20:03:44 +08:00
parent f0531e9d66
commit f9ed8dc348
3 changed files with 18 additions and 3 deletions

View File

@ -1885,8 +1885,15 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
} else if (p.getName().equals("status")) {
status = ((PrimitiveType<?>) p.getValue()).asStringValue();
} else if (p.getName().equals("x-caused-by-unknown-system")) {
err = TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED;
unknownSystems.add(((PrimitiveType<?>) p.getValue()).asStringValue());
String unkSystem = ((PrimitiveType<?>) p.getValue()).asStringValue();
if (unkSystem != null && unkSystem.contains("|")) {
err = TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED_VERSION;
system = unkSystem.substring(0, unkSystem.indexOf("|"));
version = unkSystem.substring(unkSystem.indexOf("|")+1);
} else {
err = TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED;
unknownSystems.add(unkSystem);
}
} else if (p.getName().equals("x-unknown-system")) {
unknownSystems.add(((PrimitiveType<?>) p.getValue()).asStringValue());
} else if (p.getName().equals("warning-withdrawn")) {
@ -1948,6 +1955,12 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
res.setDefinition(new ConceptDefinitionComponent().setDisplay(display).setCode(code));
res.setDisplay(display);
}
if (system != null) {
res.setSystem(system);
}
if (version != null) {
res.setVersion(version);
}
} else if (message != null && !message.equals("No Message returned")) {
res = new ValidationResult(IssueSeverity.WARNING, message, system, version, new ConceptDefinitionComponent().setDisplay(display).setCode(code), display, null).setTxLink(txLog.getLastId());
} else if (display != null) {

View File

@ -1,7 +1,7 @@
package org.hl7.fhir.r5.terminologies.utilities;
public enum TerminologyServiceErrorClass {
UNKNOWN, NOSERVICE, SERVER_ERROR, VALUESET_UNSUPPORTED, CODESYSTEM_UNSUPPORTED, BLOCKED_BY_OPTIONS, INTERNAL_ERROR, BUSINESS_RULE, TOO_COSTLY, PROCESSING;
UNKNOWN, NOSERVICE, SERVER_ERROR, VALUESET_UNSUPPORTED, CODESYSTEM_UNSUPPORTED, CODESYSTEM_UNSUPPORTED_VERSION, BLOCKED_BY_OPTIONS, INTERNAL_ERROR, BUSINESS_RULE, TOO_COSTLY, PROCESSING;
public boolean isInfrastructure() {
return this == NOSERVICE || this == SERVER_ERROR || this == VALUESET_UNSUPPORTED;

View File

@ -171,6 +171,8 @@ public class ConceptMapValidator extends BaseValidator {
for (CMCodingValidationRequest cv : batch) {
if (cv.getResult().getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED) {
warning(errors, "2023-09-06", IssueType.BUSINESSRULE, cv.getStack(), cv.getResult().isOk(), I18nConstants.CONCEPTMAP_VS_CONCEPT_CODE_UNKNOWN_SYSTEM, cv.getCoding().getSystem(), cv.getCoding().getCode(), cv.getVsObj().getUrl());
} else if (cv.getResult().getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED_VERSION) {
warning(errors, "2023-09-06", IssueType.BUSINESSRULE, cv.getStack(), cv.getResult().isOk(), I18nConstants.CONCEPTMAP_VS_CONCEPT_CODE_UNKNOWN_SYSTEM_VERSION, cv.getCoding().getSystem(), cv.getCoding().getCode(), cv.getVsObj().getUrl(), cv.getResult().getVersion());
} else if (cv.getCoding().getVersion() == null) {
ok = rule(errors, "2023-09-06", IssueType.BUSINESSRULE, cv.getStack(), cv.getResult().isOk(), I18nConstants.CONCEPTMAP_VS_INVALID_CONCEPT_CODE, cv.getCoding().getSystem(), cv.getCoding().getCode(), cv.getVsObj().getUrl()) && ok;
} else {