public bool IsValid(out string details)
        {
            var errors = new List <string>();

            if (InputResources.IsNullOrEmpty() ||
                InputResources.Count(predicate => predicate.Interface != InputInterfaceType.Algorithm) == 0)
            {
                errors.Add("No 'intputResources' specified.");
            }

            if (Algorithm is null)
            {
                errors.Add("No algorithm defined or more than one algorithms defined in 'intputResources'.  'intputResources' must include one algorithm/pipeline for the inference request.");
            }

            if (InputMetadata?.Details?.Type == InferenceRequestType.DicomUid)
            {
                if (InputMetadata.Details.Studies.IsNullOrEmpty())
                {
                    errors.Add("Request type is set to `DICOM_UID` but no studies defined.");
                }
            }
            else
            {
                errors.Add($"'inputMetadata' does not yet support type '{InputMetadata?.Details?.Type}'.");
            }

            details = string.Join(' ', errors);
            return(errors.Count == 0);
        }
示例#2
0
        private bool Validate(out string details)
        {
            var errors = new List <string>();

            if (string.IsNullOrWhiteSpace(TransactionId))
            {
                errors.Add("'transactionId' is required.");
            }

            if (InputResources.IsNullOrEmpty() ||
                InputResources.Count(predicate => predicate.Interface != InputInterfaceType.Algorithm) == 0)
            {
                errors.Add("No 'inputResources' specified.");
            }

            if (Algorithm is null)
            {
                errors.Add("No algorithm defined or more than one algorithms defined in 'inputResources'.  'inputResources' must include one algorithm/pipeline for the inference request.");
            }

            if (InputMetadata.Inputs.IsNullOrEmpty())
            {
                errors.Add("Request has no `inputMetadata` defined. At least one `inputs` or `inputMetadata` required.");
            }
            else
            {
                foreach (var inputDetails in InputMetadata.Inputs)
                {
                    CheckInputMetadataDetails(inputDetails, errors);
                }
            }

            foreach (var input in InputResources)
            {
                if (input.Interface == InputInterfaceType.DicomWeb)
                {
                    CheckDicomWebConnectionDetails("inputResources", errors, input.ConnectionDetails);
                }
                else if (input.Interface == InputInterfaceType.Fhir)
                {
                    CheckFhirConnectionDetails("inputResources", errors, input.ConnectionDetails);
                }
            }

            foreach (var output in OutputResources)
            {
                if (output.Interface == InputInterfaceType.DicomWeb)
                {
                    CheckDicomWebConnectionDetails("outputResources", errors, output.ConnectionDetails);
                }
                else if (output.Interface == InputInterfaceType.Fhir)
                {
                    CheckFhirConnectionDetails("outputResources", errors, output.ConnectionDetails);
                }
            }

            details = string.Join(' ', errors);
            return(errors.Count == 0);
        }
示例#3
0
    public override bool Equals(object other)
    {
        var otherBuilding = other as ProductionBuilding;

        if (otherBuilding == null)
        {
            return(false);
        }

        var equals = (
            UpkeepCost == otherBuilding.UpkeepCost &&
            (
                ResourceGenerationInterval ==
                otherBuilding.ResourceGenerationInterval
            ) &&
            OutputResource == otherBuilding.OutputResource &&
            OutputCount == otherBuilding.OutputCount &&
            InputResources.SequenceEqual(otherBuilding.InputResources) &&
            Efficiency == otherBuilding.Efficiency
            );

        return(equals);
    }