mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-03-06 03:19:15 +00:00
Correctly handle supplements when validating based on expansions
This commit is contained in:
parent
c1089f234c
commit
c6edf285e3
@ -264,6 +264,15 @@ public class ValueSetProcessBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String removeSupplement(String s) {
|
||||||
|
requiredSupplements.remove(s);
|
||||||
|
if (s.contains("|")) {
|
||||||
|
s = s.substring(0, s.indexOf("|"));
|
||||||
|
requiredSupplements.remove(s);
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
protected AlternateCodesProcessingRules altCodeParams = new AlternateCodesProcessingRules(false);
|
protected AlternateCodesProcessingRules altCodeParams = new AlternateCodesProcessingRules(false);
|
||||||
protected AlternateCodesProcessingRules allAltCodes = new AlternateCodesProcessingRules(true);
|
protected AlternateCodesProcessingRules allAltCodes = new AlternateCodesProcessingRules(true);
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,7 @@ import org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent;
|
|||||||
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent;
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||||
|
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent;
|
||||||
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
|
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
|
||||||
import org.hl7.fhir.r5.terminologies.client.TerminologyClientManager;
|
import org.hl7.fhir.r5.terminologies.client.TerminologyClientManager;
|
||||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||||
@ -518,17 +519,14 @@ public class ValueSetValidator extends ValueSetProcessBase {
|
|||||||
if (cs != null) {
|
if (cs != null) {
|
||||||
if (cs.hasUserData("supplements.installed")) {
|
if (cs.hasUserData("supplements.installed")) {
|
||||||
for (String s : cs.getUserString("supplements.installed").split("\\,")) {
|
for (String s : cs.getUserString("supplements.installed").split("\\,")) {
|
||||||
requiredSupplements.remove(s);
|
s = removeSupplement(s);
|
||||||
if (s.contains("|")) {
|
|
||||||
s = s.substring(0, s.indexOf("|"));
|
|
||||||
requiredSupplements.remove(s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cs;
|
return cs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<String> resolveCodeSystemVersions(String system) {
|
public List<String> resolveCodeSystemVersions(String system) {
|
||||||
List<String> res = new ArrayList<>();
|
List<String> res = new ArrayList<>();
|
||||||
for (CodeSystem t : localSystems) {
|
for (CodeSystem t : localSystems) {
|
||||||
@ -696,6 +694,11 @@ public class ValueSetValidator extends ValueSetProcessBase {
|
|||||||
res = validateCode(path, code, cs, null, info);
|
res = validateCode(path, code, cs, null, info);
|
||||||
res.setIssues(issues);
|
res.setIssues(issues);
|
||||||
} else if (cs == null && valueset.hasExpansion() && inExpansion) {
|
} else if (cs == null && valueset.hasExpansion() && inExpansion) {
|
||||||
|
for (ValueSetExpansionParameterComponent p : valueset.getExpansion().getParameter()) {
|
||||||
|
if ("used-supplement".equals(p.getName())) {
|
||||||
|
removeSupplement(p.getValue().primitiveValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
// we just take the value set as face value then
|
// we just take the value set as face value then
|
||||||
res = new ValidationResult(system, wv, new ConceptDefinitionComponent().setCode(code.getCode()).setDisplay(code.getDisplay()), code.getDisplay());
|
res = new ValidationResult(system, wv, new ConceptDefinitionComponent().setCode(code.getCode()).setDisplay(code.getDisplay()), code.getDisplay());
|
||||||
if (!preferServerSide(system)) {
|
if (!preferServerSide(system)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user