Exemple #1
0
        private OperationOutcome callService(string code, string system, string display, string uri, BindingStrength?strength, string path)
        {
            var outcome = new OperationOutcome();

            OperationOutcome validateResult = _service.ValidateCode(uri, code, system, display, abstractAllowed: false);
            var codeLabel = $"Code '{code}' from system '{system}'";

            if (display != null)
            {
                codeLabel += $" with display '{display}'";
            }

            if (validateResult.Where(type: OperationOutcome.IssueType.NotSupported).Any())
            {
                if (strength != BindingStrength.Example)
                {
                    outcome.AddIssue($"The terminology service is incapable of validating {codeLabel} (valueset '{uri}').", Issue.UNSUPPORTED_BINDING_NOT_SUPPORTED_BY_SERVICE, path);
                    validateResult.MakeInformational();
                    outcome.Include(validateResult);
                }
                return(outcome);
            }

            if (!validateResult.Success)
            {
                if (strength == BindingStrength.Required)
                {
                    outcome.AddIssue($"{codeLabel} is not valid for required binding to valueset '{uri}'", Issue.CONTENT_INVALID_FOR_REQUIRED_BINDING, path);
                }
                else if (strength != BindingStrength.Example)
                {
                    outcome.AddIssue($"{codeLabel} is not valid for non-required binding to valueset '{uri}'", Issue.CONTENT_INVALID_FOR_NON_REQUIRED_BINDING, path);
                }

                validateResult.MakeInformational();
            }

            outcome.Include(validateResult);
            return(outcome);
        }