Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#495 handling exclude system for validate co…
Browse files Browse the repository at this point in the history
…de expand operation
  • Loading branch information
Harsh Patel committed Dec 7, 2020
1 parent 7afa1c5 commit 904929e
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,12 @@ public Parameters validateCode(Collection collection, UriType system, StringType
.findAny();
if (reference.isPresent()) {
if (isValid(display)) {
StringType updated = newStringType(display.getValue().replaceAll("^\"", "")
.replaceAll("\"$", ""));
Optional<Concept> conceptOpt = oclFhirUtil.getSourceConcept(source, code, EMPTY);
if (conceptOpt.isPresent()) {
List<LocalizedText> names = oclFhirUtil.getNames(conceptOpt.get());
boolean match = oclFhirUtil.validateDisplay(names, display, displayLanguage);
boolean match = oclFhirUtil.validateDisplay(names, updated, displayLanguage);
if (!match) {
parameters.addParameter().setName(MESSAGE).setValue(newStringType("Invalid display."));
} else {
Expand Down Expand Up @@ -390,9 +392,19 @@ public ValueSet expand(Collection collection, IntegerType offset, IntegerType co

List<Source> sources = getSourcesFromExpressions(expressions, systemVersion)
.stream()
.filter(s ->
!excludeSystem.contains(canonical(s.getCanonicalUrl(), s.getVersion())) ||
!excludeSystem.contains(s.getCanonicalUrl()))
.filter(s -> {
for(String es : excludeSystem) {
String [] ar = es.split("\\|");
if ((ar.length == 2 && !isValid(ar[1])) || ar.length == 1) {
if (s.getCanonicalUrl().equals(es) || s.getCanonicalUrl().equals(ar[0])) {
return false;
}
} else {
return !es.equals(canonical(s.getCanonicalUrl(), s.getVersion()));
}
}
return true;
})
.collect(Collectors.toList());
Map<String, String> map = systemVersion.parallelStream().map(m -> m.split("\\|"))
.filter(m -> m.length == 2)
Expand Down

0 comments on commit 904929e

Please sign in to comment.