* Check for using CodeSystem not ValueSet in a value set binding
This commit is contained in:
parent
dd5f204797
commit
0f087234de
|
@ -438,7 +438,7 @@ public class I18nConstants {
|
|||
public static final String TERMINOLOGY_TX_SYSTEM_VALUESET = "Terminology_TX_System_ValueSet";
|
||||
public static final String TERMINOLOGY_TX_SYSTEM_VALUESET2 = "Terminology_TX_System_ValueSet2";
|
||||
public static final String TERMINOLOGY_TX_VALUESET_NOTFOUND = "Terminology_TX_ValueSet_NotFound";
|
||||
public static final String TERMINOLOGY_TX_VALUESET_NOTFOUND2 = "Terminology_TX_ValueSet_NotFound2";
|
||||
public static final String TERMINOLOGY_TX_VALUESET_NOTFOUND_CS = "Terminology_TX_ValueSet_NotFound_CS";
|
||||
public static final String TERMINOLOGY_TX_NOSVC_BOUND_REQ = "TERMINOLOGY_TX_NOSVC_BOUND_REQ";
|
||||
public static final String TERMINOLOGY_TX_NOSVC_BOUND_EXT = "TERMINOLOGY_TX_NOSVC_BOUND_EXT";
|
||||
public static final String TEXT_SHOULD_NOT_BE_PRESENT = "Text_should_not_be_present";
|
||||
|
|
|
@ -174,7 +174,7 @@ 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_ValueSet2 = The Coding references a value set, not a code system (''{0}'')
|
||||
Terminology_TX_ValueSet_NotFound = ValueSet {0} not found by validator
|
||||
Terminology_TX_ValueSet_NotFound2 = ValueSet {0} not found by validator
|
||||
Terminology_TX_ValueSet_NotFound_CS = Found a reference to a CodeSystem ({0}) where a ValueSet belongs
|
||||
Type_Specific_Checks_DT_Base64_Valid = The value ''{0}'' is not a valid Base64 value
|
||||
Type_Specific_Checks_DT_Boolean_Value = boolean values must be ''true'' or ''false''
|
||||
Type_Specific_Checks_DT_Code_WS = The code ''{0}'' is not valid (whitespace rules)
|
||||
|
|
|
@ -1050,7 +1050,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, binding != null, I18nConstants.TERMINOLOGY_TX_BINDING_MISSING, path)) {
|
||||
if (binding.hasValueSet()) {
|
||||
ValueSet valueset = resolveBindingReference(profile, binding.getValueSet(), profile.getUrl());
|
||||
if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND, describeReference(binding.getValueSet()))) {
|
||||
if (valueset == null) {
|
||||
CodeSystem cs = context.fetchCodeSystem(binding.getValueSet());
|
||||
if (rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, cs == null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND_CS, describeReference(binding.getValueSet()))) {
|
||||
warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND, describeReference(binding.getValueSet()));
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
CodeableConcept cc = ObjectConverter.readAsCodeableConcept(element);
|
||||
if (!cc.hasCoding()) {
|
||||
|
@ -1177,7 +1182,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, binding != null, I18nConstants.TERMINOLOGY_TX_BINDING_MISSING, path)) {
|
||||
if (binding.hasValueSet()) {
|
||||
ValueSet valueset = resolveBindingReference(profile, binding.getValueSet(), profile.getUrl());
|
||||
if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND, describeReference(binding.getValueSet()))) {
|
||||
if (valueset == null) {
|
||||
CodeSystem cs = context.fetchCodeSystem(binding.getValueSet());
|
||||
if (rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, cs == null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND_CS, describeReference(binding.getValueSet()))) {
|
||||
warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND, describeReference(binding.getValueSet()));
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
CodeableConcept cc = convertToCodeableConcept(element, logical);
|
||||
if (!cc.hasCoding()) {
|
||||
|
@ -1302,7 +1312,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, binding != null, I18nConstants.TERMINOLOGY_TX_BINDING_MISSING2, path)) {
|
||||
if (binding.hasValueSet()) {
|
||||
ValueSet valueset = resolveBindingReference(profile, binding.getValueSet(), profile.getUrl());
|
||||
if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND, describeReference(binding.getValueSet()))) {
|
||||
if (valueset == null) {
|
||||
CodeSystem cs = context.fetchCodeSystem(binding.getValueSet());
|
||||
if (rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, cs == null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND_CS, describeReference(binding.getValueSet()))) {
|
||||
warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND, describeReference(binding.getValueSet()));
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
long t = System.nanoTime();
|
||||
ValidationResult vr = null;
|
||||
|
@ -1435,7 +1450,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
|
||||
private void checkMaxValueSet(List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, String maxVSUrl, CodeableConcept cc, NodeStack stack) {
|
||||
ValueSet valueset = resolveBindingReference(profile, maxVSUrl, profile.getUrl());
|
||||
if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND, describeReference(maxVSUrl))) {
|
||||
if (valueset == null) {
|
||||
CodeSystem cs = context.fetchCodeSystem(maxVSUrl);
|
||||
if (rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, cs == null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND_CS, describeReference(maxVSUrl))) {
|
||||
warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND, describeReference(maxVSUrl));
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
long t = System.nanoTime();
|
||||
ValidationResult vr = checkCodeOnServer(stack, valueset, cc, false);
|
||||
|
@ -1455,7 +1475,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
|
||||
private void checkMaxValueSet(List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, String maxVSUrl, Coding c, NodeStack stack) {
|
||||
ValueSet valueset = resolveBindingReference(profile, maxVSUrl, profile.getUrl());
|
||||
if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND, describeReference(maxVSUrl))) {
|
||||
if (valueset == null) {
|
||||
CodeSystem cs = context.fetchCodeSystem(maxVSUrl);
|
||||
if (rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, cs == null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND_CS, describeReference(maxVSUrl))) {
|
||||
warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND, describeReference(maxVSUrl));
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
long t = System.nanoTime();
|
||||
ValidationResult vr = checkCodeOnServer(stack, valueset, c, true);
|
||||
|
@ -1475,7 +1500,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
|
||||
private void checkMaxValueSet(List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, String maxVSUrl, String value, NodeStack stack) {
|
||||
ValueSet valueset = resolveBindingReference(profile, maxVSUrl, profile.getUrl());
|
||||
if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND, describeReference(maxVSUrl))) {
|
||||
if (valueset == null) {
|
||||
CodeSystem cs = context.fetchCodeSystem(maxVSUrl);
|
||||
if (rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, cs == null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND_CS, describeReference(maxVSUrl))) {
|
||||
warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND, describeReference(maxVSUrl));
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
long t = System.nanoTime();
|
||||
ValidationResult vr = checkCodeOnServer(stack, valueset, value, baseOptions.setLanguage(stack.getWorkingLang()));
|
||||
|
@ -1530,7 +1560,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, binding != null, I18nConstants.TERMINOLOGY_TX_BINDING_MISSING2, path)) {
|
||||
if (binding.hasValueSet()) {
|
||||
ValueSet valueset = resolveBindingReference(profile, binding.getValueSet(), profile.getUrl());
|
||||
if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND, describeReference(binding.getValueSet()))) {
|
||||
if (valueset == null) {
|
||||
CodeSystem cs = context.fetchCodeSystem(binding.getValueSet());
|
||||
if (rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, cs == null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND_CS, describeReference(binding.getValueSet()))) {
|
||||
warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND, describeReference(binding.getValueSet()));
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Coding c = ObjectConverter.readAsCoding(element);
|
||||
long t = System.nanoTime();
|
||||
|
@ -2500,7 +2535,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
ElementDefinitionBindingComponent binding = elementContext.getBinding();
|
||||
if (binding.hasValueSet()) {
|
||||
ValueSet vs = resolveBindingReference(profile, binding.getValueSet(), profile.getUrl());
|
||||
if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, vs != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND2, describeReference(binding.getValueSet()))) {
|
||||
if (vs == null) {
|
||||
CodeSystem cs = context.fetchCodeSystem(binding.getValueSet());
|
||||
if (rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, cs == null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND_CS, describeReference(binding.getValueSet()))) {
|
||||
warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, vs != null, I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND, describeReference(binding.getValueSet()));
|
||||
}
|
||||
} else {
|
||||
long t = System.nanoTime();
|
||||
ValidationResult vr = null;
|
||||
if (binding.getStrength() != BindingStrength.EXAMPLE) {
|
||||
|
|
Loading…
Reference in New Issue