From fe474b1ad242907f523e1f88698e6a5a6830e338 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 29 May 2023 01:13:45 +0300 Subject: [PATCH] properly handle... --- .../fhir/r5/terminologies/ValueSetUtilities.java | 16 ++++++++++++++++ .../validation/ValueSetValidator.java | 1 + 2 files changed, 17 insertions(+) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetUtilities.java index c6e1f23e6..7edcff541 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetUtilities.java @@ -385,5 +385,21 @@ public class ValueSetUtilities { return code; } + public static int countExpansion(ValueSet valueset) { + int i = valueset.getExpansion().getContains().size(); + for (ValueSetExpansionContainsComponent t : valueset.getExpansion().getContains()) { + i = i + countExpansion(t); + } + return i; + } + + private static int countExpansion(ValueSetExpansionContainsComponent c) { + int i = c.getContains().size(); + for (ValueSetExpansionContainsComponent t : c.getContains()) { + i = i + countExpansion(t); + } + return i; + } + } \ No newline at end of file diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/validation/ValueSetValidator.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/validation/ValueSetValidator.java index c9c9e5e70..6e32be61f 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/validation/ValueSetValidator.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/validation/ValueSetValidator.java @@ -493,6 +493,7 @@ public class ValueSetValidator { res.getIssues().addAll(makeIssue(IssueSeverity.WARNING, IssueType.NOTFOUND, path, m)); res.setUnknownSystems(unknownSystems); res.setSeverity(IssueSeverity.ERROR); // back patching for display logic issue + res.setErrorClass(TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED); } else if (!inExpansion && !inInclude) { // if (!info.getIssues().isEmpty()) { // res.setMessage("Not in value set "+valueset.getUrl()+": "+info.summary()).setSeverity(IssueSeverity.ERROR);