Beispiel #1
0
        private IExtractionRequestFulfiller CreateRequestFulfiller(CohortExtractorOptions opts)
        {
            var c    = WhenIHaveA <ExtractionInformation>().CatalogueItem.Catalogue;
            var t    = c.GetTableInfoList(false).Single();
            var repo = Repository.CatalogueRepository;

            foreach (string requiredColumn in new string[]
            {
                QueryToExecuteColumnSet.DefaultImagePathColumnName,
                QueryToExecuteColumnSet.DefaultStudyIdColumnName,
                QueryToExecuteColumnSet.DefaultSeriesIdColumnName,
                QueryToExecuteColumnSet.DefaultInstanceIdColumnName,
            })
            {
                var ei = new ExtractionInformation(repo, new CatalogueItem(repo, c, "a"), new ColumnInfo(repo, requiredColumn, "varchar(10)", (TableInfo)t), requiredColumn);
                ei.ExtractionCategory = ExtractionCategory.Core;
                ei.SaveToDatabase();
            }

            c.ClearAllInjections();

            Assert.AreEqual(5, c.GetAllExtractionInformation(ExtractionCategory.Any).Length);

            var f         = new MicroserviceObjectFactory();
            var fulfiller = f.CreateInstance <IExtractionRequestFulfiller>(opts.RequestFulfillerType,
                                                                           typeof(IExtractionRequestFulfiller).Assembly,
                                                                           new object[] { new[] { c } });

            if (fulfiller != null)
            {
                fulfiller.Rejectors.Add(f.CreateInstance <IRejector>(opts.RejectorType, typeof(TestRejector).Assembly) ?? new RejectNone());
            }

            return(fulfiller);
        }
Beispiel #2
0
        public IsIdentifiableHost(
            [NotNull] GlobalOptions globals,
            [NotNull] IsIdentifiableServiceOptions serviceOpts
            )
            : base(globals)
        {
            _consumerOptions = globals.IsIdentifiableOptions;

            string classifierTypename = globals.IsIdentifiableOptions.ClassifierType;
            string dataDirectory      = globals.IsIdentifiableOptions.DataDirectory;

            if (string.IsNullOrWhiteSpace(classifierTypename))
            {
                throw new ArgumentException("No IClassifier has been set in options.  Enter a value for ClassifierType", nameof(globals));
            }
            if (string.IsNullOrWhiteSpace(dataDirectory))
            {
                throw new ArgumentException("A DataDirectory must be set", nameof(globals));
            }

            var objectFactory = new MicroserviceObjectFactory();
            var classifier    = objectFactory.CreateInstance <IClassifier>(classifierTypename, typeof(IClassifier).Assembly, new DirectoryInfo(dataDirectory), serviceOpts);

            if (classifier == null)
            {
                throw new TypeLoadException($"Could not find IClassifier Type { classifierTypename }");
            }

            _producerModel = RabbitMqAdapter.SetupProducer(globals.IsIdentifiableOptions.IsIdentifiableProducerOptions, isBatch: false);

            Consumer = new IsIdentifiableQueueConsumer(_producerModel, globals.FileSystemOptions.FileSystemRoot, globals.FileSystemOptions.ExtractRoot, classifier);
        }
Beispiel #3
0
        public MapperSource([NotNull] GlobalOptions globalOptions, TriggerUpdatesFromMapperOptions cliOptions)
        {
            _cliOptions    = cliOptions;
            _globalOptions = globalOptions;

            FansiImplementations.Load();

            try
            {
                var objectFactory = new MicroserviceObjectFactory();
                _swapper = objectFactory.CreateInstance <ISwapIdentifiers>(globalOptions.IdentifierMapperOptions.SwapperType, typeof(ISwapIdentifiers).Assembly);
            }
            catch (System.Exception ex)
            {
                throw new System.Exception($"Could not create IdentifierMapper Swapper with SwapperType:{globalOptions.IdentifierMapperOptions?.SwapperType ?? "Null"}", ex);
            }

            if (_swapper == null)
            {
                throw new ArgumentException("No SwapperType has been specified in GlobalOptions.IdentifierMapperOptions");
            }
        }
Beispiel #4
0
        private IAuditExtractions CreateAuditor(CohortExtractorOptions opts)
        {
            var f = new MicroserviceObjectFactory();

            return(f.CreateInstance <IAuditExtractions>(opts.AuditorType, typeof(IAuditExtractions).Assembly));
        }