fix minor issues in terminology engine

This commit is contained in:
Grahame Grieve 2023-04-18 09:41:28 +08:00
parent cc8c7be307
commit ec84f6aa0b
2 changed files with 19 additions and 8 deletions

View File

@ -364,9 +364,13 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
} else {
List<OperationOutcomeIssueComponent> issues = new ArrayList<>();
issues.addAll(makeIssue(IssueSeverity.ERROR, IssueType.NOTFOUND, path+".system", warningMessage));
String msg = context.formatMessagePlural(1, I18nConstants.NONE_OF_THE_PROVIDED_CODES_ARE_IN_THE_VALUE_SET_, valueset.getUrl());
issues.addAll(makeIssue(IssueSeverity.ERROR, IssueType.INVALID, path, msg));
throw new VSCheckerException(warningMessage+"; "+msg, issues);
if (valueset == null) {
throw new VSCheckerException(warningMessage, issues);
} else {
String msg = context.formatMessagePlural(1, I18nConstants.NONE_OF_THE_PROVIDED_CODES_ARE_IN_THE_VALUE_SET_, valueset.getUrl());
issues.addAll(makeIssue(IssueSeverity.ERROR, IssueType.INVALID, path, msg));
throw new VSCheckerException(warningMessage+"; "+msg, issues);
}
}
}
}
@ -377,7 +381,7 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
if (cs!=null && cs.getContent() != CodeSystemContentMode.COMPLETE) {
warningMessage = "Resolved system "+system+(cs.hasVersion() ? " (v"+cs.getVersion()+")" : "")+", but the definition is not complete";
if (!inExpansion && cs.getContent() != CodeSystemContentMode.FRAGMENT) { // we're going to give it a go if it's a fragment
throw new FHIRException(warningMessage);
throw new VSCheckerException(warningMessage, null);
}
}
@ -603,8 +607,13 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
}
}
}
String msg = context.formatMessagePlural(b.count(), I18nConstants.DISPLAY_NAME_FOR__SHOULD_BE_ONE_OF__INSTEAD_OF, code.getSystem(), code.getCode(), b.toString(), code.getDisplay());
return new ValidationResult(IssueSeverity.WARNING, msg, code.getSystem(), cc, getPreferredDisplay(cc, cs), makeIssue(IssueSeverity.WARNING, IssueType.INVALID, path+".display", msg));
if (b.count() == 0) {
String msg = context.formatMessagePlural(options.getLanguages().size(), I18nConstants.NO_VALID_DISPLAY_FOUND, code.getSystem(), code.getCode(), code.getDisplay(), options.langSummary());
return new ValidationResult(IssueSeverity.WARNING, msg, code.getSystem(), cc, getPreferredDisplay(cc, cs), makeIssue(IssueSeverity.WARNING, IssueType.INVALID, path+".display", msg));
} else {
String msg = context.formatMessagePlural(b.count(), I18nConstants.DISPLAY_NAME_FOR__SHOULD_BE_ONE_OF__INSTEAD_OF, code.getSystem(), code.getCode(), b.toString(), code.getDisplay(), options.langSummary());
return new ValidationResult(IssueSeverity.WARNING, msg, code.getSystem(), cc, getPreferredDisplay(cc, cs), makeIssue(IssueSeverity.WARNING, IssueType.INVALID, path+".display", msg));
}
}
private boolean isOkLanguage(String language) {

View File

@ -850,7 +850,8 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx
for (ConceptReferenceComponent c : inc.getConcept()) {
c.checkNoModifiers("Code in Value Set", "expanding");
ConceptDefinitionComponent def = CodeSystemUtilities.findCode(cs.getConcept(), c.getCode());
Boolean inactive = false; // default is true if we're a fragment and
boolean inactive = false; // default is true if we're a fragment and
boolean isAbstract = false;
if (def == null) {
def.checkNoModifiers("Code in Code System", "expanding");
if (cs.getContent() == CodeSystemContentMode.FRAGMENT) {
@ -864,9 +865,10 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx
}
} else {
inactive = CodeSystemUtilities.isInactive(cs, def);
isAbstract = CodeSystemUtilities.isNotSelectable(cs, def);
}
addCode(inc.getSystem(), c.getCode(), !Utilities.noString(c.getDisplay()) ? c.getDisplay() : def == null ? null : def.getDisplay(), c.hasDisplay() ? vsSrc.getLanguage() : cs.getLanguage(), null, mergeDesignations(def, convertDesignations(c.getDesignation())),
expParams, false, inactive, def == null ? null : def.getDefinition(), imports, noInactive, false, exp.getProperty(), def != null ? def.getProperty() : null, null, def == null ? null : def.getExtension(), c.getExtension());
expParams, isAbstract, inactive, def == null ? null : def.getDefinition(), imports, noInactive, false, exp.getProperty(), def != null ? def.getProperty() : null, null, def == null ? null : def.getExtension(), c.getExtension());
}
}
if (inc.getFilter().size() > 1) {