* fix evaluation of codes in code systems that are labelled content = fragment

This commit is contained in:
Grahame Grieve 2020-07-28 06:06:01 +10:00
parent 87ef9752e2
commit b256965738
3 changed files with 4 additions and 7 deletions

View File

@ -0,0 +1 @@
* fix evaluation of codes in code systems that are labelled content = fragment

View File

@ -139,7 +139,7 @@ public class ValueSetCheckerSimple implements ValueSetChecker {
throw new FHIRException(warningMessage);
}
if (cs!=null && cs.getContent() != CodeSystemContentMode.COMPLETE) {
warningMessage = "Unable to resolve system "+system+" - system is not complete";
warningMessage = "Resolved system "+system+", but the definition is not complete";
if (!inExpansion && cs.getContent() != CodeSystemContentMode.FRAGMENT) // we're going to give it a go if it's a fragment
throw new FHIRException(warningMessage);
}
@ -420,7 +420,7 @@ public class ValueSetCheckerSimple implements ValueSetChecker {
return false;
// ok, we need the code system
CodeSystem cs = context.fetchCodeSystem(system);
if (cs == null || cs.getContent() != CodeSystemContentMode.COMPLETE) {
if (cs == null || (cs.getContent() != CodeSystemContentMode.COMPLETE && cs.getContent() != CodeSystemContentMode.FRAGMENT)) {
// make up a transient value set with
ValueSet vs = new ValueSet();
vs.setStatus(PublicationStatus.ACTIVE);

View File

@ -1371,7 +1371,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"))
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"), c, stack);
else
txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_13, describeReference(binding.getValueSet(), valueset), getErrorMessage(vr.getMessage()), gen(c));
txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_13, describeReference(binding.getValueSet(), valueset), getErrorMessage(vr.getMessage()), c.getSystem()+"#"+c.getCode());
} else if (binding.getStrength() == BindingStrength.PREFERRED) {
if (baseOnly) {
txHint(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_14, describeReference(binding.getValueSet(), valueset), getErrorMessage(vr.getMessage()));
@ -1395,10 +1395,6 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
}
}
private String gen(Coding c) {
return c.getSystem()+"#"+c.getCode()+ (c.hasDisplay() ? " \""+c.getDisplay()+"\"" : "");
}
private boolean isValueSet(String url) {
try {
ValueSet vs = context.fetchResourceWithException(ValueSet.class, url);