fix validation of concept maps containing SCT

This commit is contained in:
Grahame Grieve 2024-03-26 06:27:42 +11:00
parent a95b867054
commit 3d57cec0f1
3 changed files with 16 additions and 6 deletions

View File

@ -874,7 +874,9 @@ public class I18nConstants {
public static final String CONCEPTMAP_GROUP_TARGET_PROPERTY_TYPE_UNKNOWN_SYSTEM = "CONCEPTMAP_GROUP_TARGET_PROPERTY_TYPE_UNKNOWN_SYSTEM"; public static final String CONCEPTMAP_GROUP_TARGET_PROPERTY_TYPE_UNKNOWN_SYSTEM = "CONCEPTMAP_GROUP_TARGET_PROPERTY_TYPE_UNKNOWN_SYSTEM";
public static final String SM_GROUP_NAME_DUPLICATE = "SM_GROUP_NAME_DUPLICATE"; public static final String SM_GROUP_NAME_DUPLICATE = "SM_GROUP_NAME_DUPLICATE";
public static final String CONCEPTMAP_GROUP_SOURCE_INCOMPLETE = "CONCEPTMAP_GROUP_SOURCE_INCOMPLETE"; public static final String CONCEPTMAP_GROUP_SOURCE_INCOMPLETE = "CONCEPTMAP_GROUP_SOURCE_INCOMPLETE";
public static final String CONCEPTMAP_GROUP_SOURCE_SERVER_SIDE = "CONCEPTMAP_GROUP_SOURCE_SERVER_SIDE";
public static final String CONCEPTMAP_GROUP_TARGET_INCOMPLETE = "CONCEPTMAP_GROUP_TARGET_INCOMPLETE"; public static final String CONCEPTMAP_GROUP_TARGET_INCOMPLETE = "CONCEPTMAP_GROUP_TARGET_INCOMPLETE";
public static final String CONCEPTMAP_GROUP_TARGET_SERVER_SIDE = "CONCEPTMAP_GROUP_TARGET_SERVER_SIDE";
public static final String UNABLE_TO_RESOLVE_SYSTEM_SYSTEM_IS_INDETERMINATE = "UNABLE_TO_RESOLVE_SYSTEM_SYSTEM_IS_INDETERMINATE"; public static final String UNABLE_TO_RESOLVE_SYSTEM_SYSTEM_IS_INDETERMINATE = "UNABLE_TO_RESOLVE_SYSTEM_SYSTEM_IS_INDETERMINATE";
public static final String SD_NO_TYPE_CODE_ON_CODE = "SD_NO_TYPE_CODE_ON_CODE"; public static final String SD_NO_TYPE_CODE_ON_CODE = "SD_NO_TYPE_CODE_ON_CODE";
public static final String UNKNOWN_CODESYSTEM = "UNKNOWN_CODESYSTEM"; public static final String UNKNOWN_CODESYSTEM = "UNKNOWN_CODESYSTEM";

View File

@ -667,10 +667,6 @@ BUNDLE_RULE_NONE = No Rule
BUNDLE_RULE_UNKNOWN = Bundle Rule refers to invalid resource {0} BUNDLE_RULE_UNKNOWN = Bundle Rule refers to invalid resource {0}
BUNDLE_RULE_INVALID_INDEX = Bundle Rules index is invalid ({0}) BUNDLE_RULE_INVALID_INDEX = Bundle Rules index is invalid ({0})
BUNDLE_RULE_PROFILE_UNKNOWN = Bundle Rules profile {1} is unknown for {0} BUNDLE_RULE_PROFILE_UNKNOWN = Bundle Rules profile {1} is unknown for {0}
RENDER_BUNDLE_DOCUMENT_CONTENT = Additional Document Content
RENDER_BUNDLE_HEADER_DOC_ENTRY_URD = {0}. {1} ({2}/{3})
RENDER_BUNDLE_HEADER_DOC_ENTRY_U = {0}. {1}
RENDER_BUNDLE_HEADER_DOC_ENTRY_RD = {0}. {2}/{3}
UNABLE_TO_CHECK_IF_THE_PROVIDED_CODES_ARE_IN_THE_VALUE_SET_CS = Unable to check whether the code is in the value set ''{0}'' because the code system {1} was not found UNABLE_TO_CHECK_IF_THE_PROVIDED_CODES_ARE_IN_THE_VALUE_SET_CS = Unable to check whether the code is in the value set ''{0}'' because the code system {1} was not found
UNABLE_TO_CHECK_IF_THE_PROVIDED_CODES_ARE_IN_THE_VALUE_SET_VS = Unable to check whether the code is in the value set ''{0}'' because the value set {1} was not found UNABLE_TO_CHECK_IF_THE_PROVIDED_CODES_ARE_IN_THE_VALUE_SET_VS = Unable to check whether the code is in the value set ''{0}'' because the value set {1} was not found
UNABLE_TO_CHECK_IF_THE_PROVIDED_CODES_ARE_IN_THE_VALUE_SET = Unable to check whether the code is in the value set ''{0}'' UNABLE_TO_CHECK_IF_THE_PROVIDED_CODES_ARE_IN_THE_VALUE_SET = Unable to check whether the code is in the value set ''{0}''
@ -915,6 +911,8 @@ CONCEPTMAP_GROUP_TARGET_PROPERTY_TYPE_UNKNOWN_SYSTEM = The code system {0} could
SM_DEPENDENT_PARAM_TYPE_MISMATCH_DUPLICATE = The group {0} has already been used with different parameters, so the type checking may be incorrect (other = [{1}]; this = [{2}]) SM_DEPENDENT_PARAM_TYPE_MISMATCH_DUPLICATE = The group {0} has already been used with different parameters, so the type checking may be incorrect (other = [{1}]; this = [{2}])
CONCEPTMAP_GROUP_SOURCE_INCOMPLETE = Source Code System {0} doesn''t have all content (content = {1}), so the source codes cannot be checked CONCEPTMAP_GROUP_SOURCE_INCOMPLETE = Source Code System {0} doesn''t have all content (content = {1}), so the source codes cannot be checked
CONCEPTMAP_GROUP_TARGET_INCOMPLETE = Target Code System {0} doesn''t have all content (content = {1}), so the target codes cannot be checked CONCEPTMAP_GROUP_TARGET_INCOMPLETE = Target Code System {0} doesn''t have all content (content = {1}), so the target codes cannot be checked
CONCEPTMAP_GROUP_SOURCE_SERVER_SIDE = Source Code System {0} is only supported on the terminology server, so the source codes are not validated for performance reasons
CONCEPTMAP_GROUP_TARGET_SERVER_SIDE = Target Code System {0} is only supported on the terminology server, so the target codes are not validated for performance reasons
SD_NO_TYPE_CODE_ON_CODE = Snapshot for {1} element {0} has type.code without a value SD_NO_TYPE_CODE_ON_CODE = Snapshot for {1} element {0} has type.code without a value
UNKNOWN_CODESYSTEM = A definition for CodeSystem ''{0}'' could not be found, so the code cannot be validated UNKNOWN_CODESYSTEM = A definition for CodeSystem ''{0}'' could not be found, so the code cannot be validated
UNKNOWN_CODESYSTEM_VERSION = A definition for CodeSystem ''{0}'' version ''{1}'' could not be found, so the code cannot be validated. Valid versions: {2} UNKNOWN_CODESYSTEM_VERSION = A definition for CodeSystem ''{0}'' version ''{1}'' could not be found, so the code cannot be validated. Valid versions: {2}

View File

@ -226,7 +226,10 @@ public class ConceptMapValidator extends BaseValidator {
if (warning(errors, "2023-03-05", IssueType.REQUIRED, grp.line(), grp.col(), stack.getLiteralPath(), e != null, I18nConstants.CONCEPTMAP_GROUP_SOURCE_MISSING)) { if (warning(errors, "2023-03-05", IssueType.REQUIRED, grp.line(), grp.col(), stack.getLiteralPath(), e != null, I18nConstants.CONCEPTMAP_GROUP_SOURCE_MISSING)) {
ctxt.source = readCSReference(e, grp.getNamedChild("sourceVersion", false), ctxt.getSourceVS()); ctxt.source = readCSReference(e, grp.getNamedChild("sourceVersion", false), ctxt.getSourceVS());
if (ctxt.source.cs != null) { if (ctxt.source.cs != null) {
if (!warning(errors, "2023-03-05", IssueType.NOTFOUND, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), isOkCodeSystem(ctxt.source.cs), I18nConstants.CONCEPTMAP_GROUP_SOURCE_INCOMPLETE, e.getValue(), ctxt.source.cs.getContent().toCode())) { if (isServerSideOnly(ctxt.source.cs)) {
hint(errors, "2024-03-25", IssueType.BUSINESSRULE, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), false, I18nConstants.CONCEPTMAP_GROUP_SOURCE_SERVER_SIDE, e.getValue());
ctxt.source.cs = null;
} else if (!warning(errors, "2023-03-05", IssueType.NOTFOUND, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), isOkCodeSystem(ctxt.source.cs), I18nConstants.CONCEPTMAP_GROUP_SOURCE_INCOMPLETE, e.getValue(), ctxt.source.cs.getContent().toCode())) {
ctxt.source.cs = null; ctxt.source.cs = null;
} }
} else { } else {
@ -242,7 +245,10 @@ public class ConceptMapValidator extends BaseValidator {
if (warning(errors, "2023-03-05", IssueType.REQUIRED, grp.line(), grp.col(), stack.getLiteralPath(), e != null, I18nConstants.CONCEPTMAP_GROUP_TARGET_MISSING)) { if (warning(errors, "2023-03-05", IssueType.REQUIRED, grp.line(), grp.col(), stack.getLiteralPath(), e != null, I18nConstants.CONCEPTMAP_GROUP_TARGET_MISSING)) {
ctxt.target = readCSReference(e, grp.getNamedChild("targetVersion", false), ctxt.getTargetVS()); ctxt.target = readCSReference(e, grp.getNamedChild("targetVersion", false), ctxt.getTargetVS());
if (ctxt.target.cs != null) { if (ctxt.target.cs != null) {
if (!warning(errors, "2023-03-05", IssueType.NOTFOUND, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), isOkCodeSystem(ctxt.target.cs), I18nConstants.CONCEPTMAP_GROUP_TARGET_INCOMPLETE, e.getValue(), ctxt.target.cs.getContent().toCode())) { if (isServerSideOnly(ctxt.target.cs)) {
hint(errors, "2024-03-25", IssueType.BUSINESSRULE, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), false, I18nConstants.CONCEPTMAP_GROUP_TARGET_SERVER_SIDE, e.getValue());
ctxt.target.cs = null;
} else if (!warning(errors, "2023-03-05", IssueType.NOTFOUND, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), isOkCodeSystem(ctxt.target.cs), I18nConstants.CONCEPTMAP_GROUP_TARGET_INCOMPLETE, e.getValue(), ctxt.target.cs.getContent().toCode())) {
ctxt.target.cs = null; ctxt.target.cs = null;
} }
} else { } else {
@ -264,6 +270,10 @@ public class ConceptMapValidator extends BaseValidator {
return ok; return ok;
} }
private boolean isServerSideOnly(CodeSystem cs) {
return Utilities.existsInList(cs.getUrl(), "http://snomed.info/sct", "http://loinc.org");
}
private CSReference readCSReference(Element ref, Element version, ValueSet vs) { private CSReference readCSReference(Element ref, Element version, ValueSet vs) {
CSReference res = new CSReference(); CSReference res = new CSReference();
res.url = ref.primitiveValue(); res.url = ref.primitiveValue();