From 8c7a5bf7249bcc192c033e0dabb8000454146d61 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 29 May 2023 03:38:48 +0300 Subject: [PATCH] fix bug checking slice min/max --- RELEASE_NOTES.md | 8 ++++++-- .../conformance/profile/ProfileUtilities.java | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 7b06c6ab5..78d03a832 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,7 +1,11 @@ ## Validator Changes -* no changes +* Add support for "Obligation Profiles" (see https://chat.fhir.org/#narrow/stream/179177-conformance/topic/Proposed.20new.20Profile.20features) +* Adjust slice min/max checking to ignore type slices (rules are different in this case) +* Properly handle validating mime/type when terminology server is not available ## Other code changes -* no changes \ No newline at end of file +* Rework Pipelines - more stability and quicker +* Fix bug where elementmodel.Element.copy() didn't clone children. Users of the Element Model (not the normal model) should check all uses of copy. (Only known users are Validator + IG publisher) +* Add nimbus & ZXing to core library dependencies for forthcoming improved SHC/SHL support diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java index 3c7ac187d..29472eb34 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java @@ -773,18 +773,20 @@ public class ProfileUtilities extends TranslatingUtilities { } } for (String s : toRemove) { - int count = slices.get(s).checkMin(); - if (count > -1) { - String msg = "The slice definition for "+slices.get(s).getFocus().getId()+" has a minimum of "+slices.get(s).getFocus().getMin()+" but the slices add up to a minimum of "+count; + ElementDefinitionCounter slice = slices.get(s); + int count = slice.checkMin(); + boolean repeats = !"1".equals(slice.getFocus().getBase().getMax()); // type slicing if repeats = 1 + if (count > -1 && repeats) { + String msg = "The slice definition for "+slice.getFocus().getId()+" has a minimum of "+slice.getFocus().getMin()+" but the slices add up to a minimum of "+count; messages.add(new ValidationMessage(Source.ProfileValidator, ValidationMessage.IssueType.VALUE, url+"#"+ed.getId(), msg, forPublication ? ValidationMessage.IssueSeverity.ERROR : ValidationMessage.IssueSeverity.INFORMATION)); } - count = slices.get(s).checkMax(); - if (count > -1) { - String msg = "The slice definition for "+slices.get(s).getFocus().getId()+" has a maximum of "+slices.get(s).getFocus().getMax()+" but the slices add up to a maximum of "+count+". Check that this is what is intended"; + count = slice.checkMax(); + if (count > -1 && repeats) { + String msg = "The slice definition for "+slice.getFocus().getId()+" has a maximum of "+slice.getFocus().getMax()+" but the slices add up to a maximum of "+count+". Check that this is what is intended"; messages.add(new ValidationMessage(Source.ProfileValidator, ValidationMessage.IssueType.VALUE, url+"#"+ed.getId(), msg, ValidationMessage.IssueSeverity.INFORMATION)); } - if (!slices.get(s).checkMinMax()) { - String msg = "The slice definition for "+slices.get(s).getFocus().getId()+" has a maximum of "+slices.get(s).getFocus().getMin()+" which is less than the minimum of "+slices.get(s).getFocus().getMin(); + if (!slice.checkMinMax()) { + String msg = "The slice definition for "+slice.getFocus().getId()+" has a maximum of "+slice.getFocus().getMax()+" which is less than the minimum of "+slice.getFocus().getMin(); messages.add(new ValidationMessage(Source.ProfileValidator, ValidationMessage.IssueType.VALUE, url+"#"+ed.getId(), msg, ValidationMessage.IssueSeverity.WARNING)); } slices.remove(s);