Better information when CodeSystem.content = not-present

This commit is contained in:
Grahame Grieve 2023-07-27 17:49:03 +10:00
parent a3c32d86a0
commit 6afb151dff
3 changed files with 11 additions and 1 deletions

View File

@ -942,6 +942,7 @@ public class I18nConstants {
public static final String LIQUID_SYNTAX_UNEXPECTED = "LIQUID_SYNTAX_UNEXPECTED"; public static final String LIQUID_SYNTAX_UNEXPECTED = "LIQUID_SYNTAX_UNEXPECTED";
public static final String LIQUID_VARIABLE_ALREADY_ASSIGNED = "LIQUID_VARIABLE_ALREADY_ASSIGNED"; public static final String LIQUID_VARIABLE_ALREADY_ASSIGNED = "LIQUID_VARIABLE_ALREADY_ASSIGNED";
public static final String LIQUID_VARIABLE_ILLEGAL = "LIQUID_VARIABLE_ILLEGAL"; public static final String LIQUID_VARIABLE_ILLEGAL = "LIQUID_VARIABLE_ILLEGAL";
public static final String TERMINOLOGY_TX_SYSTEM_NOT_USABLE = "TERMINOLOGY_TX_SYSTEM_NOT_USABLE";

View File

@ -184,6 +184,7 @@ Terminology_TX_NoValid_8 = None of the codes provided are in the maximum value s
Terminology_TX_NoValid_9 = The code provided ({2}) could not be validated against the maximum value set {0}, (error = {1}) Terminology_TX_NoValid_9 = The code provided ({2}) could not be validated against the maximum value set {0}, (error = {1})
Terminology_TX_System_Invalid = Invalid System URI: {0} Terminology_TX_System_Invalid = Invalid System URI: {0}
Terminology_TX_System_NotKnown = Code System URI ''{0}'' is unknown so the code cannot be validated Terminology_TX_System_NotKnown = Code System URI ''{0}'' is unknown so the code cannot be validated
TERMINOLOGY_TX_SYSTEM_NOT_USABLE = Code System with URI ''{0}'' has no content so the code cannot be validated
Terminology_TX_System_Relative = Coding.system must be an absolute reference, not a local reference Terminology_TX_System_Relative = Coding.system must be an absolute reference, not a local reference
Terminology_TX_System_Unknown = Unknown Code System ''{0}'' Terminology_TX_System_Unknown = Unknown Code System ''{0}''
Terminology_TX_System_ValueSet = Invalid System URI: {0} - cannot use a value set URI as a system Terminology_TX_System_ValueSet = Invalid System URI: {0} - cannot use a value set URI as a system

View File

@ -113,6 +113,7 @@ import org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation;
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent; import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r5.model.Enumeration; import org.hl7.fhir.r5.model.Enumeration;
import org.hl7.fhir.r5.model.Enumerations.BindingStrength; import org.hl7.fhir.r5.model.Enumerations.BindingStrength;
import org.hl7.fhir.r5.model.Enumerations.CodeSystemContentMode;
import org.hl7.fhir.r5.model.ExpressionNode; import org.hl7.fhir.r5.model.ExpressionNode;
import org.hl7.fhir.r5.model.ExpressionNode.CollectionStatus; import org.hl7.fhir.r5.model.ExpressionNode.CollectionStatus;
import org.hl7.fhir.r5.model.Extension; import org.hl7.fhir.r5.model.Extension;
@ -1075,7 +1076,14 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} }
} }
if (!isAllowExamples() || !Utilities.startsWithInList(system, "http://example.org", "https://example.org")) { if (!isAllowExamples() || !Utilities.startsWithInList(system, "http://example.org", "https://example.org")) {
hint(errors, NO_RULE_DATE, IssueType.UNKNOWN, element.line(), element.col(), path, done, I18nConstants.TERMINOLOGY_TX_SYSTEM_NOTKNOWN, system); CodeSystem cs = context.fetchCodeSystem(system);
if (cs == null) {
hint(errors, NO_RULE_DATE, IssueType.UNKNOWN, element.line(), element.col(), path, done, I18nConstants.TERMINOLOGY_TX_SYSTEM_NOTKNOWN, system);
} else {
if (hint(errors, NO_RULE_DATE, IssueType.UNKNOWN, element.line(), element.col(), path, cs.getContent() != CodeSystemContentMode.NOTPRESENT, I18nConstants.TERMINOLOGY_TX_SYSTEM_NOT_USABLE, system)) {
rule(errors, NO_RULE_DATE, IssueType.UNKNOWN, element.line(), element.col(), path, false, "Error - this should not happen? (Consult GG)");
}
}
} }
return true; return true;
} catch (Exception e) { } catch (Exception e) {