Don't use remote termsvc on implied system validation (#2045)

* Don't use remote termsvc on implied system validation

* Add changelog
This commit is contained in:
James Agnew 2020-08-18 13:56:37 -04:00 committed by GitHub
parent 30ac44974d
commit 03cde8c53f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,6 @@
---
type: add
issue: 2045
title: "The `RemoteTerminologyServiceValidationSupport` class used for connecting to a remote terminology service
will no longer attempt to perform code validation for fields where the code system is implied, since there is no
FHIR operation allowing this style of validation to be performed remotely."

View File

@ -48,6 +48,13 @@ public class RemoteTerminologyServiceValidationSupport extends BaseValidationSup
@Override
public CodeValidationResult validateCodeInValueSet(ValidationSupportContext theValidationSupportContext, ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, @Nonnull IBaseResource theValueSet) {
if (theOptions != null) {
if (theOptions.isInferSystem()) {
return null;
}
}
IBaseResource valueSet = theValueSet;
String valueSetUrl = DefaultProfileValidationSupport.getConformanceResourceUrl(myCtx, valueSet);
if (isNotBlank(valueSetUrl)) {

View File

@ -1,6 +1,7 @@
package org.hl7.fhir.common.hapi.validation.support;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.ConceptValidationOptions;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Operation;
@ -132,7 +133,7 @@ public class RemoteTerminologyServiceValidationSupportTest {
ValueSet valueSet = new ValueSet();
valueSet.setUrl(VALUE_SET_URL);
IValidationSupport.CodeValidationResult outcome = mySvc.validateCodeInValueSet(null, null, CODE_SYSTEM, CODE, DISPLAY, valueSet);
IValidationSupport.CodeValidationResult outcome = mySvc.validateCodeInValueSet(null, new ConceptValidationOptions(), CODE_SYSTEM, CODE, DISPLAY, valueSet);
assertEquals(CODE, outcome.getCode());
assertEquals(DISPLAY, outcome.getDisplay());
assertEquals(null, outcome.getSeverity());
@ -145,6 +146,20 @@ public class RemoteTerminologyServiceValidationSupportTest {
assertEquals(null, myValueSetProvider.myLastValueSet);
}
/**
* Remote terminology services shouldn't be used to validatre codes with an implied system
*/
@Test
public void testValidateCodeInValueSet_InferSystem() {
createNextValueSetReturnParameters(true, DISPLAY, null);
ValueSet valueSet = new ValueSet();
valueSet.setUrl(VALUE_SET_URL);
IValidationSupport.CodeValidationResult outcome = mySvc.validateCodeInValueSet(null, new ConceptValidationOptions().setInferSystem(true), null, CODE, DISPLAY, valueSet);
assertEquals(null, outcome);
}
@Test
public void testIsValueSetSupported_False() {
myValueSetProvider.myNextReturnValueSets = new ArrayList<>();