示例#1
0
        Concept Convert(QueryRef @ref, CompilerOptions opts)
        {
            var alias = $"{opts.Alias}C";

            return(new Concept
            {
                Id = @ref.Id.Value,
                UniversalId = @ref.UniversalId,
                RootId = Guid.Empty,
                SqlSetFrom = $"(SELECT {opts.FieldPersonId} = {alias}.PersonId FROM {opts.AppDb}.app.Cohort AS {alias} WHERE {alias}.QueryId = '{@ref.Id.Value}')",
            });
        }
 public ConceptDatasetExecutionRequest(QueryRef qr, IPanelItemDTO panelItem, long?early = null, long?late = null)
 {
     QueryRef  = qr;
     PanelItem = panelItem;
     if (early.HasValue)
     {
         EarlyBound = DateTimes.FromUTCTicks(early.Value);
     }
     if (late.HasValue)
     {
         LateBound = DateTimes.FromUTCTicks(late.Value);
     }
 }
示例#3
0
 public DatasetExecutionRequest(QueryRef qr, DatasetQueryRef dr, long?early = null, long?late = null)
 {
     QueryRef   = qr;
     DatasetRef = dr;
     if (early.HasValue)
     {
         EarlyBound = DateTimes.FromUTCTicks(early.Value);
     }
     if (late.HasValue)
     {
         LateBound = DateTimes.FromUTCTicks(late.Value);
     }
 }
示例#4
0
        /// <summary>
        /// Get the <see cref="DemographicCompilerContext"/> from the provider, validates it's state, and wraps it in <see cref="CompilerValidationContext{DemographicCompilerContext}"/>.
        /// </summary>
        /// <returns>The compiler validation context.</returns>
        /// <param name="qr">Query reference.</param>
        /// <exception cref="Validation.LeafRPCException"/>
        /// <exception cref="System.Data.Common.DbException"/>
        public async Task <CompilerValidationContext <DemographicCompilerContext> > GetCompilerContextAsync(QueryRef qr)
        {
            log.LogInformation("Getting DemographicQueryCompilerContext. QueryRef:{@QueryRef}", qr);
            try
            {
                var context = await contextProvider.GetCompilerContextAsync(qr);

                var state = GetContextState(context);
                return(new CompilerValidationContext <DemographicCompilerContext>
                {
                    Context = context,
                    State = state
                });
            }
            catch (DbException de)
            {
                log.LogError("Could not get demographic query context. Query:{@QueryRef} Code:{Code} Error:{Error}", qr, de.ErrorCode, de.Message);
                de.MapThrow();
                throw;
            }
        }
示例#5
0
        /// <summary>
        /// Validate the specified context. Throws if there are unrecoverable errors.
        /// </summary>
        /// <returns>The validated Panel.</returns>
        /// <param name="ctx">Context.</param>
        /// <exception cref="LeafCompilerException"/>
        public PanelDatasetCompilerContext ValidateConceptPanel(PanelValidationContext ctx, QueryRef queryRef)
        {
            if (!ctx.PreflightPassed)
            {
                throw new LeafCompilerException("PreflightCheck failed, nothing to validate.");
            }
            ValidateItems(ctx);
            var panels = ValidatePanels(ctx);

            return(new PanelDatasetCompilerContext
            {
                Panel = panels.First(),
                QueryContext = new QueryContext
                {
                    QueryId = (Guid)queryRef.Id
                }
            });
        }
示例#6
0
        public async Task <CompilerValidationContext <PanelDatasetCompilerContext> > GetCompilerContextAsync(QueryRef qr, int panelIdx)
        {
            log.LogInformation("Getting ConceptDatasetCompilerContext. PanelIndex:{@PanelIndex}, QueryRef:{@QueryRef}", panelIdx, qr);
            try
            {
                var context = await contextProvider.GetCompilerContextAsync(qr, panelIdx);

                var state = GetContextState(context);
                return(new CompilerValidationContext <PanelDatasetCompilerContext>
                {
                    Context = context,
                    State = state
                });
            }
            catch (DbException de)
            {
                log.LogError("Failed to get PanelDatasetCompilerContext. Query:{@QueryRef} Code:{Code} Error:{Error}", qr, de.ErrorCode, de.Message);
                de.MapThrow();
                throw;
            }
        }