Esempio n. 1
0
        /// <summary>
        /// Finds common substrings for each position in the texts of the specified column.
        /// It uses a batch approach to query for several positions (specified using SubstringQueryColumnCount)
        /// using a single query.
        /// </summary>
        private static async Task <SubstringsData> ExploreSubstrings(
            DConnection conn,
            ExplorerContext ctx,
            int substringQueryColumnCount,
            params int[] substringLengths)
        {
            var substrings = new SubstringsData();

            foreach (var length in substringLengths)
            {
                var hasRows = true;
                for (var pos = 0; hasRows; pos += substringQueryColumnCount)
                {
                    var query      = new TextColumnSubstring(ctx.Table, ctx.Column, pos, length, substringQueryColumnCount);
                    var sstrResult = await conn.Exec(query);

                    hasRows = false;
                    foreach (var row in sstrResult.Rows)
                    {
                        if (row.HasValue)
                        {
                            hasRows = true;
                            substrings.Add(pos + row.Index, row.Value, row.Count);
                        }
                    }
                }
            }
            return(substrings);
        }
Esempio n. 2
0
        private static async Task <bool> CheckIsEmail(DConnection conn, ExplorerContext ctx)
        {
            var emailCheck = await conn.Exec(
                new TextColumnTrim(ctx.Table, ctx.Column, TextColumnTrimType.Both, Constants.EmailAddressChars));

            return(emailCheck.Rows.All(r => r.IsNull || (!r.IsSuppressed && r.Value == "@")));
        }
Esempio n. 3
0
 /// <summary>
 /// Configure a column exploration.
 /// </summary>
 /// <param name="conn">A DConnection configured for the Api backend.</param>
 /// <param name="ctx">An <see cref="ExplorerContext" /> defining the exploration parameters.</param>
 /// <param name="componentConfiguration">
 /// An action to add and configure the components to use in this exploration.
 /// </param>
 /// <returns>A new ColumnExploration object.</returns>
 public ColumnExploration LaunchColumnExploration(
     DConnection conn,
     ExplorerContext ctx,
     Action <ExplorationConfig> componentConfiguration)
 {
     // This scope (and all the components resolved within) should live until the end of the Task.
     return(ExploreColumn(rootContainer.GetNestedContainer(), conn, ctx, componentConfiguration));
 }
 public NumericHistogramComponent(
     DConnection conn,
     ExplorerContext ctx,
     ResultProvider <SimpleStats <double> .Result> statsResultProvider)
 {
     this.conn = conn;
     this.ctx  = ctx;
     this.statsResultProvider = statsResultProvider;
 }
Esempio n. 5
0
 public TextLengthComponent(
     DConnection conn,
     ExplorerContext ctx,
     ResultProvider <IsolatorCheckComponent.Result> isolatorCheck)
 {
     this.ctx           = ctx;
     this.conn          = conn;
     this.isolatorCheck = isolatorCheck;
 }
Esempio n. 6
0
        private static async Task <SubstringWithCountList> ExploreEmailDomains(DConnection conn, ExplorerContext ctx)
        {
            var domains = await conn.Exec(new TextColumnTrim(
                                              ctx.Table, ctx.Column, TextColumnTrimType.Leading, Constants.EmailAddressChars));

            return(SubstringWithCountList.FromValueWithCountEnum(
                       domains.Rows
                       .Where(r => r.HasValue && r.Value.StartsWith("@", StringComparison.InvariantCulture))));
        }
Esempio n. 7
0
 public TextGeneratorComponent(DConnection conn, ExplorerContext ctx, EmailCheckComponent emailChecker)
 {
     this.conn                  = conn;
     this.ctx                   = ctx;
     this.emailChecker          = emailChecker;
     GeneratedValuesCount       = DefaultGeneratedValuesCount;
     EmailDomainsCountThreshold = DefaultEmailDomainsCountThreshold;
     SubstringQueryColumnCount  = DefaultSubstringQueryColumnCount;
 }
Esempio n. 8
0
        /// <summary>
        /// Configure a column exploration within a given scope.
        /// </summary>
        /// <param name="scope">The scoped container to use for object resolution.</param>
        /// <param name="conn">A DConnection configured for the Api backend.</param>
        /// <param name="ctx">An <see cref="ExplorerContext" /> defining the exploration parameters.</param>
        /// <param name="componentConfiguration">
        /// An action to add and configure the components to use in this exploration.
        /// </param>
        /// <returns>A new ColumnExploration object.</returns>
        public static ColumnExploration ExploreColumn(
            INestedContainer scope,
            DConnection conn,
            ExplorerContext ctx,
            Action <ExplorationConfig> componentConfiguration)
        {
            // Configure a new Exploration
            var config = new ExplorationConfig(scope);

            config.UseConnection(conn);
            config.UseContext(ctx);
            config.Compose(componentConfiguration);
            return(new ColumnExploration(config, scope, ctx.Column));
        }
Esempio n. 9
0
 public CyclicalTimeBuckets(DConnection conn, ExplorerContext ctx)
 {
     this.conn = conn;
     this.ctx  = ctx;
 }
Esempio n. 10
0
 public EmailCheckComponent(DConnection conn, ExplorerContext ctx)
 {
     this.conn = conn;
     this.ctx  = ctx;
 }
Esempio n. 11
0
 /// <summary>
 /// Configure an exploration.
 /// </summary>
 /// <param name="dataSource">The data source name on which to execute the exploration.</param>
 /// <param name="table">The table name on which to execute the exploration.</param>
 /// <param name="conn">A DConnection configured for the Api backend.</param>
 /// <param name="explorationSettings">
 /// A list of tuples containing the exploration parameters and
 /// the action to add and configure the components to use in this exploration.
 /// </param>
 /// <returns>A new Exploration object.</returns>
 public Exploration LaunchExploration(
     string dataSource,
     string table,
     DConnection conn,
     IEnumerable <(Action <ExplorationConfig> ComponentConfig, ExplorerContext Context)> explorationSettings)
Esempio n. 12
0
 public MinMaxRefiner(DConnection conn, ExplorerContext ctx)
 {
     this.ctx  = ctx;
     this.conn = conn;
 }
Esempio n. 13
0
        private static async Task <SubstringWithCountList> ExploreEmailTopLevelDomains(DConnection conn, ExplorerContext ctx)
        {
            var suffixes = await conn.Exec(new TextColumnSuffix(ctx.Table, ctx.Column, 3, 7));

            return(SubstringWithCountList.FromValueWithCountEnum(
                       suffixes.Rows
                       .Where(r => r.HasValue && r.Value.StartsWith(".", StringComparison.InvariantCulture))));
        }
Esempio n. 14
0
 public LinearTimeBuckets(DConnection conn, ExplorerContext ctx)
 {
     this.conn = conn;
     this.ctx  = ctx;
 }
Esempio n. 15
0
 public IsolatorCheckComponent(DConnection conn, ExplorerContext ctx)
 {
     this.ctx  = ctx;
     this.conn = conn;
 }
Esempio n. 16
0
 public SimpleStats(DConnection conn, ExplorerContext ctx)
 {
     this.conn = conn;
     this.ctx  = ctx;
 }
 public DistinctValuesComponent(DConnection conn, ExplorerContext ctx)
 {
     this.ctx  = ctx;
     this.conn = conn;
 }
Esempio n. 18
0
 public void UseConnection(DConnection conn) => scope.Inject(conn);