fix bug checking slice min/max

This commit is contained in:
Grahame Grieve 2023-05-29 03:38:48 +03:00
parent f04d8fc5a3
commit 8c7a5bf724
2 changed files with 16 additions and 10 deletions

View File

@ -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
* 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

View File

@ -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);