Updated to handle recursion on expansion.contains
This commit is contained in:
parent
c11312de78
commit
3c543b72ce
|
@ -489,19 +489,31 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (valueset.hasExpansion()) {
|
} else if (valueset.hasExpansion()) {
|
||||||
for (ValueSetExpansionContainsComponent c: valueset.getExpansion().getContains()) {
|
// Retrieve a list of all systems associated with this code in the expansion
|
||||||
if (c.getCode().equals(code)) {
|
List<String> systems = new ArrayList<String>();
|
||||||
if (sys == null)
|
checkSystems(valueset.getExpansion().getContains(), code, systems);
|
||||||
sys = c.getSystem();
|
if (systems.size()==1)
|
||||||
else
|
sys = systems.get(0);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sys;
|
return sys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Recursively go through all codes in the expansion and for any coding that matches the specified code, add the system for that coding
|
||||||
|
* to the passed list.
|
||||||
|
*/
|
||||||
|
private void checkSystems(List<ValueSetExpansionContainsComponent> contains, String code, List<String> systems) {
|
||||||
|
for (ValueSetExpansionContainsComponent c: contains) {
|
||||||
|
if (c.getCode().equals(code)) {
|
||||||
|
if (!systems.contains(c.getSystem()))
|
||||||
|
systems.add(c.getSystem());
|
||||||
|
}
|
||||||
|
if (c.hasContains())
|
||||||
|
checkSystems(c.getContains(), code, systems);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean codeInValueSet(String system, String code) throws FHIRException {
|
public Boolean codeInValueSet(String system, String code) throws FHIRException {
|
||||||
Boolean result = false;
|
Boolean result = false;
|
||||||
|
|
Loading…
Reference in New Issue