mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-02-09 22:34:42 +00:00
fix value set validation to deal with multi-heirarchy
This commit is contained in:
parent
7771c7f231
commit
cbf70365f1
@ -369,12 +369,33 @@ public class ValueSetCheckerSimple implements ValueSetChecker {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ConceptDefinitionComponent findCodeInConcept(ConceptDefinitionComponent concept, String code) {
|
||||||
|
if (code.equals(concept.getCode())) {
|
||||||
|
return concept;
|
||||||
|
}
|
||||||
|
ConceptDefinitionComponent cc = findCodeInConcept(concept.getConcept(), code);
|
||||||
|
if (cc != null) {
|
||||||
|
return cc;
|
||||||
|
}
|
||||||
|
if (concept.hasUserData(CodeSystemUtilities.USER_DATA_CROSS_LINK)) {
|
||||||
|
List<ConceptDefinitionComponent> children = (List<ConceptDefinitionComponent>) concept.getUserData(CodeSystemUtilities.USER_DATA_CROSS_LINK);
|
||||||
|
for (ConceptDefinitionComponent c : children) {
|
||||||
|
cc = findCodeInConcept(c, code);
|
||||||
|
if (cc != null) {
|
||||||
|
return cc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private ConceptDefinitionComponent findCodeInConcept(List<ConceptDefinitionComponent> concept, String code) {
|
private ConceptDefinitionComponent findCodeInConcept(List<ConceptDefinitionComponent> concept, String code) {
|
||||||
for (ConceptDefinitionComponent cc : concept) {
|
for (ConceptDefinitionComponent cc : concept) {
|
||||||
if (code.equals(cc.getCode())) {
|
if (code.equals(cc.getCode())) {
|
||||||
return cc;
|
return cc;
|
||||||
}
|
}
|
||||||
ConceptDefinitionComponent c = findCodeInConcept(cc.getConcept(), code);
|
ConceptDefinitionComponent c = findCodeInConcept(cc, code);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@ -449,7 +470,7 @@ public class ValueSetCheckerSimple implements ValueSetChecker {
|
|||||||
Boolean nok = inComponent(vsi, system, code, valueset.getCompose().getInclude().size() == 1);
|
Boolean nok = inComponent(vsi, system, code, valueset.getCompose().getInclude().size() == 1);
|
||||||
if (nok == null && result == false) {
|
if (nok == null && result == false) {
|
||||||
result = null;
|
result = null;
|
||||||
} else if (!nok) {
|
} else if (nok) {
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -547,7 +568,7 @@ public class ValueSetCheckerSimple implements ValueSetChecker {
|
|||||||
if (cc == null) {
|
if (cc == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cc = findCodeInConcept(cc.getConcept(), code);
|
cc = findCodeInConcept(cc, code);
|
||||||
return cc != null;
|
return cc != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user