warning not error when the code system isn't known validating questionnaire answer options

This commit is contained in:
Grahame Grieve 2023-04-01 07:33:56 +11:00
parent 4966731195
commit 7ef17d41d6
3 changed files with 9 additions and 2 deletions

View File

@ -306,6 +306,7 @@ public class I18nConstants {
public static final String PROFILE___ERROR_GENERATING_SNAPSHOT = "Profile___Error_generating_snapshot";
public static final String PROFILE___HAS_NO_BASE_AND_NO_SNAPSHOT = "Profile___has_no_base_and_no_snapshot";
public static final String QUESTIONNAIRE_QR_ITEM_BADOPTION = "Questionnaire_QR_Item_BadOption";
public static final String QUESTIONNAIRE_QR_ITEM_BADOPTION_CS = "QUESTIONNAIRE_QR_ITEM_BADOPTION_CS";
public static final String QUESTIONNAIRE_QR_ITEM_CODING = "Questionnaire_QR_Item_Coding";
public static final String QUESTIONNAIRE_QR_ITEM_CODINGNOOPTIONS = "Questionnaire_QR_Item_CodingNoOptions";
public static final String QUESTIONNAIRE_QR_ITEM_DATENOOPTIONS = "Questionnaire_QR_Item_DateNoOptions";

View File

@ -72,7 +72,8 @@ Profile_VAL_MissingElement = Missing element ''{0}'' - required by fixed value a
Profile_VAL_NotAllowed = The element {0} is present in the instance but not allowed in the applicable {1} specified in profile
Measure_MR_M_None = No Measure is identified, so no validation can be performed against the Measure
Measure_MR_M_NotFound = The Measure ''{0}'' could not be resolved, so no validation can be performed against the Measure
Questionnaire_QR_Item_BadOption = The value provided ({0}::{1}) is not in the options value set in the questionnaire
Questionnaire_QR_Item_BadOption = The code provided {1} 9in the system {0}) is not in the options value set ({2}) in the questionnaire
QUESTIONNAIRE_QR_ITEM_BADOPTION_CS The code provided {1} cannot be validated in the options value set ({2}) in the questionnaire because the system {0} is unknown
Questionnaire_QR_Item_Coding = Error {0} validating Coding against Questionnaire Options
Questionnaire_QR_Item_CodingNoOptions = Cannot validate Coding option because no option list is provided
Questionnaire_QR_Item_DateNoOptions = Cannot validate date answer option because no option list is provided

View File

@ -23,6 +23,7 @@ import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.r5.model.StringType;
import org.hl7.fhir.r5.model.TimeType;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.terminologies.ValueSetExpander.TerminologyServiceErrorClass;
import org.hl7.fhir.r5.utils.FHIRPathEngine;
import org.hl7.fhir.r5.utils.XVerExtensionManager;
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier;
@ -562,7 +563,11 @@ public class QuestionnaireValidator extends BaseValidator {
ValidationResult res = context.validateCode(new ValidationOptions(stack.getWorkingLang()), c, vs, vc);
timeTracker.tx(t, "vc "+c.getSystem()+"#"+c.getCode()+" '"+c.getDisplay()+"'");
if (!res.isOk()) {
ok = txRule(errors, NO_RULE_DATE, res.getTxLink(), IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), false, I18nConstants.QUESTIONNAIRE_QR_ITEM_BADOPTION, c.getSystem(), c.getCode()) && ok;
if (res.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED) {
txWarning(errors, NO_RULE_DATE, res.getTxLink(), IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), false, I18nConstants.QUESTIONNAIRE_QR_ITEM_BADOPTION_CS, c.getSystem(), c.getCode(), vs.present());
} else {
ok = txRule(errors, NO_RULE_DATE, res.getTxLink(), IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), false, I18nConstants.QUESTIONNAIRE_QR_ITEM_BADOPTION, c.getSystem(), c.getCode(), vs.present()) && ok;
}
} else if (res.getSeverity() != null) {
super.addValidationMessage(errors, NO_RULE_DATE, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), res.getMessage(), res.getSeverity(), Source.TerminologyEngine, null);
} else if (res.getMessage() != null) {