fix mini-terminology server bugs around unknown systems

This commit is contained in:
Grahame Grieve 2024-01-30 19:05:49 +11:00
parent 975f4fd28b
commit ebfd70477c
3 changed files with 8 additions and 3 deletions

View File

@ -356,6 +356,9 @@ public class ValueSetValidator extends ValueSetProcessBase {
res.setVersion(foundCoding.hasVersion() ? foundCoding.getVersion() : foundCoding.hasUserData("cs") ? ((CodeSystem) foundCoding.getUserData("cs")).getVersion() : null); res.setVersion(foundCoding.hasVersion() ? foundCoding.getVersion() : foundCoding.hasUserData("cs") ? ((CodeSystem) foundCoding.getUserData("cs")).getVersion() : null);
res.setDisplay(cd.getDisplay()); res.setDisplay(cd.getDisplay());
} }
if (info.getErr() != null) {
res.setErrorClass(info.getErr());
}
res.setUnknownSystems(unknownSystems); res.setUnknownSystems(unknownSystems);
res.addCodeableConcept(vcc); res.addCodeableConcept(vcc);
return res; return res;
@ -669,7 +672,7 @@ public class ValueSetValidator extends ValueSetProcessBase {
res.setDefinition(null); res.setDefinition(null);
res.setSystem(null); res.setSystem(null);
res.setDisplay(null); res.setDisplay(null);
res.setUnknownSystems(unknownSystems); res.setUnknownSystems(unknownSystems);
// } // }
} else if (warningMessage!=null) { } else if (warningMessage!=null) {
String msg = context.formatMessage(I18nConstants.CODE_FOUND_IN_EXPANSION_HOWEVER_, warningMessage); String msg = context.formatMessage(I18nConstants.CODE_FOUND_IN_EXPANSION_HOWEVER_, warningMessage);
@ -1309,6 +1312,7 @@ public class ValueSetValidator extends ValueSetProcessBase {
} }
return res.isOk(); return res.isOk();
} else { } else {
info.setErr(TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED);
if (unknownSystems != null) { if (unknownSystems != null) {
if (version == null) { if (version == null) {
unknownSystems.add(system); unknownSystems.add(system);

View File

@ -37,6 +37,7 @@ import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent; import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent;
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome; import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass;
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult; import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
import org.hl7.fhir.r5.test.utils.CompareUtilities; import org.hl7.fhir.r5.test.utils.CompareUtilities;
import org.hl7.fhir.r5.test.utils.TestingUtilities; import org.hl7.fhir.r5.test.utils.TestingUtilities;
@ -375,7 +376,7 @@ public class TerminologyServiceTests {
} }
if (vm.getUnknownSystems() != null) { if (vm.getUnknownSystems() != null) {
for (String s : vm.getUnknownSystems()) { for (String s : vm.getUnknownSystems()) {
res.addParameter("x-caused-by-unknown-system", new CanonicalType(s)); res.addParameter(vm.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED ? "x-caused-by-unknown-system" : "x-unknown-system", new CanonicalType(s));
} }
} }
if (vm.getIssues().size() > 0) { if (vm.getIssues().size() > 0) {

View File

@ -20,7 +20,7 @@
<properties> <properties>
<guava_version>32.0.1-jre</guava_version> <guava_version>32.0.1-jre</guava_version>
<hapi_fhir_version>6.4.1</hapi_fhir_version> <hapi_fhir_version>6.4.1</hapi_fhir_version>
<validator_test_case_version>1.4.27</validator_test_case_version> <validator_test_case_version>1.4.28-SNAPSHOT</validator_test_case_version>
<jackson_version>2.16.0</jackson_version> <jackson_version>2.16.0</jackson_version>
<junit_jupiter_version>5.9.2</junit_jupiter_version> <junit_jupiter_version>5.9.2</junit_jupiter_version>
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version> <junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>