Esempio n. 1
0
        /// <summary>
        /// Creates a new result for a single <see cref="AggregateConfiguration"/> or <see cref="CohortAggregateContainer"/>
        /// </summary>
        /// <param name="cacheServer"></param>
        /// <param name="childProvider"></param>
        /// <param name="helper"></param>
        /// <param name="customise"></param>
        public CohortQueryBuilderResult(ExternalDatabaseServer cacheServer, ICoreChildProvider childProvider, CohortQueryBuilderHelper helper, QueryBuilderCustomArgs customise)
        {
            CacheServer   = cacheServer;
            ChildProvider = childProvider;
            Helper        = helper;
            Customise     = customise;

            if (cacheServer != null)
            {
                CacheManager = new CachedAggregateConfigurationResultsManager(CacheServer);
            }
        }
        /// <summary>
        /// Creates a new result for a single <see cref="AggregateConfiguration"/> or <see cref="CohortAggregateContainer"/>
        /// </summary>
        /// <param name="cacheServer"></param>
        /// <param name="childProvider"></param>
        /// <param name="helper"></param>
        /// <param name="customise"></param>
        /// <param name="cancellationToken"></param>
        public CohortQueryBuilderResult(ExternalDatabaseServer cacheServer, ICoreChildProvider childProvider, CohortQueryBuilderHelper helper, QueryBuilderCustomArgs customise, CancellationToken cancellationToken)
        {
            CacheServer       = cacheServer;
            ChildProvider     = childProvider;
            Helper            = helper;
            Customise         = customise;
            CancellationToken = cancellationToken;

            if (cacheServer != null)
            {
                CacheManager = new CachedAggregateConfigurationResultsManager(CacheServer);

                try
                {
                    PluginCohortCompilers = new PluginCohortCompilerFactory(cacheServer.CatalogueRepository.MEF).CreateAll();
                }
                catch (Exception ex)
                {
                    throw new Exception("Failed to build list of IPluginCohortCompilers", ex);
                }
            }
        }
Esempio n. 3
0
 private void RecreateHelpers(QueryBuilderCustomArgs customizations)
 {
     helper  = new CohortQueryBuilderHelper();
     Results = new CohortQueryBuilderResult(CacheServer, _childProvider, helper, customizations);
 }
Esempio n. 4
0
        /// <summary>
        /// Creates arguments for an <see cref="AggregateConfiguration"/> which has a JOIN to a patient index table.  All arguments must be provided
        /// </summary>
        /// <param name="join">The join usage relationship object (includes join direction etc)</param>
        /// <param name="joinedTo">The patient index to which the join is made to (e.g. <see cref="JoinableCohortAggregateConfiguration.AggregateConfiguration"/>)</param>
        /// <param name="joinSql">The full SQL of the join</param>
        /// <param name="customisations"></param>
        /// <param name="globals"></param>
        public QueryBuilderArgs(JoinableCohortAggregateConfigurationUse join, AggregateConfiguration joinedTo, CohortQueryBuilderDependencySql joinSql, QueryBuilderCustomArgs customisations, ISqlParameter[] globals) : this(customisations, globals)
        {
            JoinIfAny = join;
            JoinedTo  = joinedTo;
            JoinSql   = joinSql;

            if (JoinIfAny == null != (JoinedTo == null) || JoinIfAny == null != (JoinSql == null))
            {
                throw new Exception("You must provide all arguments or no arguments");
            }

            if (JoinedTo != null)
            {
                if (!JoinedTo.IsCohortIdentificationAggregate || !JoinedTo.IsJoinablePatientIndexTable())
                {
                    throw new ArgumentException($"JoinedTo ({JoinedTo}) was not a patient index table", nameof(joinedTo));
                }
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Creates basic arguments for an <see cref="AggregateConfiguration"/> that does not have a join to a patient index table
 /// </summary>
 public QueryBuilderArgs(QueryBuilderCustomArgs customisations, ISqlParameter[] globals)
 {
     customisations?.Populate(this);
     Globals = globals ?? new ISqlParameter[0];
 }