Merge pull request #526 from lmckenzi/Vocab-validation-with-expansion-only

Fixed issue where when validating with no terminology server and a va…
This commit is contained in:
Grahame Grieve 2021-06-05 08:21:48 +10:00 committed by GitHub
commit 6c8f5d4c47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 0 deletions

View File

@ -488,11 +488,32 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
}
}
}
} else if (valueset.hasExpansion()) {
// Retrieve a list of all systems associated with this code in the expansion
List<String> systems = new ArrayList<String>();
checkSystems(valueset.getExpansion().getContains(), code, systems);
if (systems.size()==1)
sys = systems.get(0);
}
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
public Boolean codeInValueSet(String system, String code) throws FHIRException {
Boolean result = false;