Esempio n. 1
0
        public async Task <IEnumerable <QueryIntervalValue <IEnumerable <QueryGroupValue <IDictionary <string, string> > > > > > MultiAnalysis(string collection, IEnumerable <MultiAnalysisParam> analysisParams, QueryTimeframe timeframe = null, QueryInterval interval = null, IEnumerable <QueryFilter> filters = null, string groupby = "", string timezone = "")
        {
            var jObs      = analysisParams.Select(x => new JProperty(x.Label, JObject.FromObject(new { analysis_type = x.Analysis, target_property = x.TargetProperty })));
            var parmsJson = JsonConvert.SerializeObject(new JObject(jObs), Formatting.None, new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            });

            var parms = new Dictionary <string, string>();

            parms.Add(KeenConstants.QueryParmEventCollection, collection);
            parms.Add(KeenConstants.QueryParmTimeframe, timeframe.ToSafeString());
            parms.Add(KeenConstants.QueryParmInterval, interval.ToSafeString());
            parms.Add(KeenConstants.QueryParmTimezone, timezone);
            parms.Add(KeenConstants.QueryParmGroupBy, groupby);
            parms.Add(KeenConstants.QueryParmFilters, filters == null ? "" : JArray.FromObject(filters).ToString());
            parms.Add(KeenConstants.QueryParmAnalyses, parmsJson);

            var reply = await KeenWebApiRequest(KeenConstants.QueryMultiAnalysis, parms);

            var result = new List <QueryIntervalValue <IEnumerable <QueryGroupValue <IDictionary <string, string> > > > >();

            foreach (JObject i in reply.Value <JArray>("result"))
            {
                var qgl = new List <QueryGroupValue <IDictionary <string, string> > >();
                foreach (JObject o in i.Value <JArray>("value"))
                {
                    var    d      = new Dictionary <string, string>();
                    string grpVal = "";
                    foreach (JProperty p in o.Values <JProperty>())
                    {
                        if (p.Name == groupby)
                        {
                            grpVal = (string)p.Value;
                        }
                        else
                        {
                            d.Add(p.Name, (string)p.Value);
                        }
                    }
                    qgl.Add(new QueryGroupValue <IDictionary <string, string> >(d, grpVal));
                }

                var t  = i.Value <JObject>("timeframe");
                var qv = new QueryIntervalValue <IEnumerable <QueryGroupValue <IDictionary <string, string> > > >(qgl, t.Value <DateTime>("start"), t.Value <DateTime>("end"));
                result.Add(qv);
            }
            return(result);
        }
Esempio n. 2
0
 /// <summary>
 /// Returns the maximum value for the target property.
 /// Each item represents one interval.
 /// </summary>
 /// <param name="collection">Name of event collection to query.</param>
 /// <param name="targetProperty">Name of property to analyse.</param>
 /// <param name="timeframe">Specifies window of time from which to select events for analysis. May be absolute or relative.</param>
 /// <param name="interval">The block size for partitioning the specified timeframe. Optional, may be null.</param>
 /// <param name="filters">Filters to narrow down the events used in analysis. Optional, may be null.</param>
 /// <param name="timezone">The timezone to use when specifying a relative timeframe. Optional, may be blank.</param>
 /// <returns></returns>
 public async Task<IEnumerable<QueryIntervalValue<string>>> QueryMaximumIntervalAsync(string collection,string targetProperty, QueryTimeframe timeframe, QueryInterval interval = null, IEnumerable<QueryFilter> filters = null, string timezone = "")
 {
     return await Queries.Metric<string>(KeenConstants.QueryMaximum, collection, targetProperty, timeframe, interval, filters, timezone).ConfigureAwait(false);
 }
Esempio n. 3
0
        public async Task <IEnumerable <QueryIntervalValue <IEnumerable <QueryGroupValue <string> > > > > Metric(QueryType queryType, string collection, string targetProperty, string groupby, QueryTimeframe timeframe, QueryInterval interval, IEnumerable <QueryFilter> filters = null, string timezone = "")
        {
            if (queryType == null)
            {
                throw new ArgumentNullException("queryType");
            }
            if (string.IsNullOrWhiteSpace(collection))
            {
                throw new ArgumentNullException("collection");
            }
            if (string.IsNullOrWhiteSpace(targetProperty) && (queryType != QueryType.Count()))
            {
                throw new ArgumentNullException("targetProperty");
            }
            if (null == timeframe)
            {
                throw new ArgumentException("timeframe", "Timeframe must be specified for a series query.");
            }
            if (null == interval)
            {
                throw new ArgumentNullException("interval", "interval must be specified for a series query");
            }
            if (string.IsNullOrWhiteSpace(groupby))
            {
                throw new ArgumentNullException("groupby", "groupby field name must be specified for a goupby query");
            }

            var parms = new Dictionary <string, string>();

            parms.Add(KeenConstants.QueryParmEventCollection, collection);
            parms.Add(KeenConstants.QueryParmTargetProperty, targetProperty);
            parms.Add(KeenConstants.QueryParmGroupBy, groupby);
            parms.Add(KeenConstants.QueryParmTimeframe, timeframe.ToSafeString());
            parms.Add(KeenConstants.QueryParmInterval, interval.ToSafeString());
            parms.Add(KeenConstants.QueryParmTimezone, timezone);
            parms.Add(KeenConstants.QueryParmFilters, filters == null ? "" : JArray.FromObject(filters).ToString());

            var reply = await KeenWebApiRequest(queryType.ToString(), parms);

            IEnumerable <QueryIntervalValue <IEnumerable <QueryGroupValue <string> > > > result;

            if (queryType == QueryType.SelectUnique())
            {
                // This is to support SelectUnique which is the only query type with a list-type result.
                result                 = from i in reply.Value <JArray>("result")
                                 let v = (from r in i.Value <JArray>("value")
                                          let c = string.Join(",", r.Value <JArray>("result").Values <string>())
                                                  let g = r.Value <string>(groupby)
                                                          select new QueryGroupValue <string>(c, g))
                                         let t = i.Value <JObject>("timeframe")
                                                 select new QueryIntervalValue <IEnumerable <QueryGroupValue <string> > >(v, t.Value <DateTime>("start"), t.Value <DateTime>("end"));
            }
            else
            {
                result                 = from i in reply.Value <JArray>("result")
                                 let v = (from r in i.Value <JArray>("value")
                                          let c = r.Value <string>("result")
                                                  let g = r.Value <string>(groupby)
                                                          select new QueryGroupValue <string>(c, g))
                                         let t = i.Value <JObject>("timeframe")
                                                 select new QueryIntervalValue <IEnumerable <QueryGroupValue <string> > >(v, t.Value <DateTime>("start"), t.Value <DateTime>("end"));
            }
            return(result);
        }
Esempio n. 4
0
 /// <summary>
 /// Returns counts of unique resources in the event collection.
 /// Each item contains information about the groupings in that interval.
 /// </summary>
 /// <param name="collection">Name of event collection to query.</param>
 /// <param name="targetProperty">Name of property to analyse.</param>
 /// <param name="groupBy">Name of field by which to group results.</param>
 /// <param name="timeframe">Specifies window of time from which to select events for analysis. May be absolute or relative.</param>
 /// <param name="interval">The block size for partitioning the specified timeframe. Optional, may be null.</param>
 /// <param name="filters">Filters to narrow down the events used in analysis. Optional, may be null.</param>
 /// <param name="timezone">The timezone to use when specifying a relative timeframe. Optional, may be blank.</param>
 /// <returns></returns>
 public async Task<IEnumerable<QueryIntervalValue<IEnumerable<QueryGroupValue<int>>>>> QueryCountUniqueIntervalGroupAsync(string collection, string targetProperty, string groupBy, QueryTimeframe timeframe, QueryInterval interval, IEnumerable<QueryFilter> filters = null, string timezone = "")
 {
     return await Queries.Metric<int>(KeenConstants.QueryCountUnique, collection, targetProperty, groupBy, timeframe, interval, filters, timezone).ConfigureAwait(false);
 }
Esempio n. 5
0
 /// <summary>
 /// Returns the minimum value for the target property in the event collection.
 /// Within each interval results are grouped by the value of the groupBy field.
 /// </summary>
 /// <param name="collection">Name of event collection to query.</param>
 /// <param name="targetProperty">Name of property to analyse.</param>
 /// <param name="groupBy">Name of field by which to group results.</param>
 /// <param name="timeframe">Specifies window of time from which to select events for analysis. May be absolute or relative.</param>
 /// <param name="interval">The block size for partitioning the specified timeframe. Optional, may be null.</param>
 /// <param name="filters">Filters to narrow down the events used in analysis. Optional, may be null.</param>
 /// <param name="timezone">The timezone to use when specifying a relative timeframe. Optional, may be blank.</param>
 /// <returns></returns>
 public IEnumerable<QueryIntervalValue<IEnumerable<QueryGroupValue<string>>>> QueryMinimumIntervalGroup(string collection, string targetProperty, string groupBy, QueryTimeframe timeframe, QueryInterval interval, IEnumerable<QueryFilter> filters = null, string timezone = "")
 {
     try
     {
         return QueryMinimumIntervalGroupAsync(collection, targetProperty, groupBy, timeframe, interval, filters, timezone).Result;
     }
     catch (AggregateException ex)
     {
         throw ex.TryUnwrap();
     }            
 }
Esempio n. 6
0
 /// <summary>
 /// Returns counts of resources in the event collection.
 /// Each item represents one interval.
 /// </summary>
 /// <param name="collection">Name of event collection to query</param>
 /// <param name="timeframe">Specifies window of time from which to select events for analysis. May be absolute or relative.</param>
 /// <param name="interval">The block size for partitioning the specified timeframe. Optional, may be null.</param>
 /// <param name="filters">Filters to narrow down the events used in analysis. Optional, may be null.</param>
 /// <param name="timezone">The timezone to use when specifying a relative timeframe. Optional, may be blank.</param>
 /// <returns></returns>
 public async Task<IEnumerable<QueryIntervalValue<int>>> QueryCountIntervalAsync(string collection, QueryTimeframe timeframe, QueryInterval interval = null, IEnumerable<QueryFilter> filters = null, string timezone = "")
 {
     return await Queries.Metric<int>(KeenConstants.QueryCount, collection, "-", timeframe, interval, filters, timezone).ConfigureAwait(false); ;
 }
Esempio n. 7
0
 /// <summary>
 /// Returns counts of unique resources in the event collection.
 /// Each item represents one interval.
 /// </summary>
 /// <param name="collection">Name of event collection to query.</param>
 /// <param name="targetProperty">Name of property to analyse.</param>
 /// <param name="timeframe">Specifies window of time from which to select events for analysis. May be absolute or relative.</param>
 /// <param name="interval">The block size for partitioning the specified timeframe. Optional, may be null.</param>
 /// <param name="filters">Filters to narrow down the events used in analysis. Optional, may be null.</param>
 /// <param name="timezone">The timezone to use when specifying a relative timeframe. Optional, may be blank.</param>
 /// <returns></returns>
 public IEnumerable<QueryIntervalValue<int>> QueryCountUniqueInterval(string collection, string targetProperty, QueryTimeframe timeframe, QueryInterval interval = null, IEnumerable<QueryFilter> filters = null, string timezone = "")
 {
     try
     {
         return QueryCountUniqueIntervalAsync(collection, targetProperty, timeframe, interval, filters, timezone).Result;
     }
     catch (AggregateException ex)
     {
         throw ex.TryUnwrap();
     }            
 }
Esempio n. 8
0
 /// <summary>
 /// Run multiple types of analysis over the same data.
 /// Each item contains information about the groupings in that interval.
 /// </summary>
 /// <param name="collection">Name of event collection to query.</param>
 /// <param name="analysisParams">Defines the multiple types of analyses to perform.</param>
 /// <param name="groupBy">Name of field by which to group results.</param>
 /// <param name="timeframe">Specifies window of time from which to select events for analysis. May be absolute or relative.</param>
 /// <param name="interval">The block size for partitioning the specified timeframe. Optional, may be null.</param>
 /// <param name="filters">Filters to narrow down the events used in analysis. Optional, may be null.</param>
 /// <param name="timezone">The timezone to use when specifying a relative timeframe. Optional, may be blank.</param>
 /// <returns></returns>
 public async Task<IEnumerable<QueryIntervalValue<IEnumerable<QueryGroupValue<IDictionary<string, string>>>>>> QueryMultiAnalysisIntervalGroupAsync(string collection, IEnumerable<MultiAnalysisParam> analysisParams, QueryTimeframe timeframe = null, QueryInterval interval = null, IEnumerable<QueryFilter> filters = null, string groupBy = "", string timezone = "")
 {
     return await Queries.MultiAnalysis(collection, analysisParams, timeframe, interval, filters, groupBy, timezone).ConfigureAwait(false);
 }
Esempio n. 9
0
 /// <summary>
 /// Run multiple types of analysis over the same data.
 /// Each item contains information about the groupings in that interval.
 /// </summary>
 /// <param name="collection">Name of event collection to query.</param>
 /// <param name="analysisParams">Defines the multiple types of analyses to perform.</param>
 /// <param name="groupBy">Name of field by which to group results.</param>
 /// <param name="timeframe">Specifies window of time from which to select events for analysis. May be absolute or relative.</param>
 /// <param name="interval">The block size for partitioning the specified timeframe. Optional, may be null.</param>
 /// <param name="filters">Filters to narrow down the events used in analysis. Optional, may be null.</param>
 /// <param name="timezone">The timezone to use when specifying a relative timeframe. Optional, may be blank.</param>
 /// <returns></returns>
 public IEnumerable<QueryIntervalValue<IEnumerable<QueryGroupValue<IDictionary<string, string>>>>> QueryMultiAnalysisIntervalGroup(string collection, IEnumerable<MultiAnalysisParam> analysisParams, QueryTimeframe timeframe = null, QueryInterval interval = null, IEnumerable<QueryFilter> filters = null, string groupBy = "", string timezone = "")
 {
     try
     {
         return QueryMultiAnalysisIntervalGroupAsync(collection, analysisParams, timeframe, interval, filters, groupBy, timezone).Result;
     }
     catch (AggregateException ex)
     {
         throw ex.TryUnwrap();
     }            
 }
Esempio n. 10
0
        public async Task <IEnumerable <QueryIntervalValue <T> > > Metric <T>(string metric, string collection, string targetProperty, QueryTimeframe timeframe, QueryInterval interval, IEnumerable <QueryFilter> filters = null, string timezone = "")
        {
            if (string.IsNullOrWhiteSpace(collection))
            {
                throw new ArgumentNullException("collection");
            }
            if (string.IsNullOrWhiteSpace(targetProperty))
            {
                throw new ArgumentNullException("targetProperty");
            }
            if (null == timeframe)
            {
                throw new ArgumentException("timeframe", "Timeframe must be specified for a series query.");
            }
            if (null == interval)
            {
                throw new ArgumentNullException("interval", "interval must be specified for a series query");
            }

            var parms = new Dictionary <string, string>();

            parms.Add(KeenConstants.QueryParmEventCollection, collection);
            parms.Add(KeenConstants.QueryParmTargetProperty, targetProperty == "-" ? "" : targetProperty);
            parms.Add(KeenConstants.QueryParmTimeframe, timeframe.ToSafeString());
            parms.Add(KeenConstants.QueryParmInterval, interval.ToSafeString());
            parms.Add(KeenConstants.QueryParmTimezone, timezone);
            parms.Add(KeenConstants.QueryParmFilters, filters == null ? "" : JArray.FromObject(filters).ToString());

            var reply = await KeenWebApiRequest(metric, parms);

            IEnumerable <QueryIntervalValue <T> > result;

            if ((reply.GetValue("result") is JArray) &&
                (typeof(T) == (typeof(IEnumerable <string>))))
            {
                // This is specifically to support SelectUnique which will call with T as IEnumerable<string>
                result                                         = from i in reply.Value <JArray>("result")
                                         let v                 = (T)i.Value <JArray>("value").Values <string>()
                                                         let t = i.Value <JObject>("timeframe")
                                                                 select new QueryIntervalValue <T>(v, t.Value <DateTime>("start"), t.Value <DateTime>("end"));
            }
            else
            {
                result                                         = from i in reply.Value <JArray>("result")
                                         let v                 = i.Value <T>("value")
                                                         let t = i.Value <JObject>("timeframe")
                                                                 select new QueryIntervalValue <T>(v, t.Value <DateTime>("start"), t.Value <DateTime>("end"));
            }

            return(result);
        }
Esempio n. 11
0
 /// <summary>
 /// Returns items collected by time interval and group.
 /// </summary>
 /// <param name="queryType">Type of query to run.</param>
 /// <param name="collection">Name of event collection to query.</param>
 /// <param name="targetProperty">Name of property to analyse.</param>
 /// <param name="groupBy">Name of field by which to group results.</param>
 /// <param name="timeframe">Specifies window of time from which to select events for analysis. May be absolute or relative.</param>
 /// <param name="interval">The block size for partitioning the specified timeframe. Optional, may be null.</param>
 /// <param name="filters">Filters to narrow down the events used in analysis. Optional, may be null.</param>
 /// <param name="timezone">The timezone to use when specifying a relative timeframe. Optional, may be blank.</param>
 /// <returns></returns>
 public async Task<IEnumerable<QueryIntervalValue<IEnumerable<QueryGroupValue<string>>>>> QueryIntervalGroupAsync
     (QueryType queryType, string collection, string targetProperty, string groupBy, QueryTimeframe timeframe,
         QueryInterval interval, IEnumerable<QueryFilter> filters = null, string timezone = "")
 {
     return
         await
             Queries.Metric(queryType, collection, targetProperty, groupBy, timeframe, interval, filters,
                 timezone).ConfigureAwait(false);
 }
Esempio n. 12
0
        public async Task<IEnumerable<QueryIntervalValue<IEnumerable<QueryGroupValue<IDictionary<string, string>>>>>> MultiAnalysis(string collection, IEnumerable<MultiAnalysisParam> analysisParams, QueryTimeframe timeframe = null, QueryInterval interval = null, IEnumerable<QueryFilter> filters = null, string groupby = "", string timezone = "")
        {
            var jObs = analysisParams.Select(x => new JProperty(x.Label, JObject.FromObject(new { analysis_type = x.Analysis, target_property = x.TargetProperty })));
            var parmsJson = JsonConvert.SerializeObject(new JObject(jObs), Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });

            var parms = new Dictionary<string, string>();
            parms.Add(KeenConstants.QueryParmEventCollection, collection);
            parms.Add(KeenConstants.QueryParmTimeframe, timeframe.ToSafeString());
            parms.Add(KeenConstants.QueryParmInterval, interval.ToSafeString());
            parms.Add(KeenConstants.QueryParmTimezone, timezone);
            parms.Add(KeenConstants.QueryParmGroupBy, groupby);
            parms.Add(KeenConstants.QueryParmFilters, filters == null ? "" : JArray.FromObject(filters).ToString());
            parms.Add(KeenConstants.QueryParmAnalyses, parmsJson);

            var reply = await KeenWebApiRequest(KeenConstants.QueryMultiAnalysis, parms);

            var result = new List<QueryIntervalValue<IEnumerable<QueryGroupValue<IDictionary<string, string>>>>>();
            foreach (JObject i in reply.Value<JArray>("result"))
            {
                var qgl = new List<QueryGroupValue<IDictionary<string, string>>>();
                foreach (JObject o in i.Value<JArray>("value"))
                {
                    var d = new Dictionary<string, string>();
                    string grpVal = "";
                    foreach (JProperty p in o.Values<JProperty>())
                    {

                        if (p.Name == groupby)
                            grpVal = (string)p.Value;
                        else
                            d.Add(p.Name, (string)p.Value);
                    }
                    qgl.Add( new QueryGroupValue<IDictionary<string, string>>(d, grpVal));
                }

                var t = i.Value<JObject>("timeframe");
                var qv = new QueryIntervalValue<IEnumerable<QueryGroupValue<IDictionary<string, string>>>>(qgl, t.Value<DateTime>("start"), t.Value<DateTime>("end"));
                result.Add(qv);
            }
            return result;
        }
Esempio n. 13
0
        public async Task<IEnumerable<QueryIntervalValue<IEnumerable<QueryGroupValue<string>>>>> Metric(QueryType queryType, string collection, string targetProperty, string groupby, QueryTimeframe timeframe, QueryInterval interval, IEnumerable<QueryFilter> filters = null, string timezone = "")
        {
            if (queryType == null)
                throw new ArgumentNullException("queryType");
            if (string.IsNullOrWhiteSpace(collection))
                throw new ArgumentNullException("collection");
            if (string.IsNullOrWhiteSpace(targetProperty) && (queryType != QueryType.Count()))
                throw new ArgumentNullException("targetProperty");
            if (null == timeframe)
                throw new ArgumentException("timeframe", "Timeframe must be specified for a series query.");
            if (null == interval)
                throw new ArgumentNullException("interval", "interval must be specified for a series query");
            if (string.IsNullOrWhiteSpace(groupby))
                throw new ArgumentNullException("groupby", "groupby field name must be specified for a goupby query");

            var parms = new Dictionary<string, string>();
            parms.Add(KeenConstants.QueryParmEventCollection, collection);
            parms.Add(KeenConstants.QueryParmTargetProperty, targetProperty);
            parms.Add(KeenConstants.QueryParmGroupBy, groupby);
            parms.Add(KeenConstants.QueryParmTimeframe, timeframe.ToSafeString());
            parms.Add(KeenConstants.QueryParmInterval, interval.ToSafeString());
            parms.Add(KeenConstants.QueryParmTimezone, timezone);
            parms.Add(KeenConstants.QueryParmFilters, filters == null ? "" : JArray.FromObject(filters).ToString());

            var reply = await KeenWebApiRequest(queryType.ToString(), parms);

            IEnumerable<QueryIntervalValue<IEnumerable<QueryGroupValue<string>>>> result;
            if (queryType == QueryType.SelectUnique())
            {
                // This is to support SelectUnique which is the only query type with a list-type result.
                result = from i in reply.Value<JArray>("result")
                         let v = (from r in i.Value<JArray>("value")
                                  let c = string.Join(",", r.Value<JArray>("result").Values<string>())
                                  let g = r.Value<string>(groupby)
                                  select new QueryGroupValue<string>(c, g))
                         let t = i.Value<JObject>("timeframe")
                         select new QueryIntervalValue<IEnumerable<QueryGroupValue<string>>>(v, t.Value<DateTime>("start"), t.Value<DateTime>("end"));
            }
            else
            {
                result = from i in reply.Value<JArray>("result")
                         let v = (from r in i.Value<JArray>("value")
                                  let c = r.Value<string>("result")
                                  let g = r.Value<string>(groupby)
                                  select new QueryGroupValue<string>(c, g))
                         let t = i.Value<JObject>("timeframe")
                         select new QueryIntervalValue<IEnumerable<QueryGroupValue<string>>>(v, t.Value<DateTime>("start"), t.Value<DateTime>("end"));
            }
            return result;
        }
Esempio n. 14
0
        public async Task <IEnumerable <QueryIntervalValue <IEnumerable <QueryGroupValue <IDictionary <string, string> > > > > > MultiAnalysis(string collection, IEnumerable <MultiAnalysisParam> analysisParams, IQueryTimeframe timeframe = null, QueryInterval interval = null, IEnumerable <QueryFilter> filters = null, string groupby = "", string timezone = "")
        {
            var parms = new Dictionary <string, string>();

            parms.Add(KeenConstants.QueryParmEventCollection, collection);
            parms.Add(KeenConstants.QueryParmTimeframe, timeframe.ToSafeString());
            parms.Add(KeenConstants.QueryParmInterval, interval.ToSafeString());
            parms.Add(KeenConstants.QueryParmTimezone, timezone);
            parms.Add(KeenConstants.QueryParmGroupBy, groupby);
            parms.Add(KeenConstants.QueryParmFilters, filters == null ? "" : JArray.FromObject(filters).ToString());
            parms.Add(KeenConstants.QueryParmAnalyses, SerializeMultiAnalysisQueryParameter(analysisParams));

            var reply = await KeenWebApiRequest(KeenConstants.QueryMultiAnalysis, parms).ConfigureAwait(false);

            var result = new List <QueryIntervalValue <IEnumerable <QueryGroupValue <IDictionary <string, string> > > > >();

            foreach (JObject i in reply.Value <JArray>("result"))
            {
                var qgl = new List <QueryGroupValue <IDictionary <string, string> > >();
                foreach (JObject o in i.Value <JArray>("value"))
                {
                    var    d      = new Dictionary <string, string>();
                    string grpVal = "";
                    foreach (JProperty p in o.Values <JProperty>())
                    {
                        if (p.Name == groupby)
                        {
                            grpVal = (string)p.Value;
                        }
                        else
                        {
                            d.Add(p.Name, (string)p.Value);
                        }
                    }
                    qgl.Add(new QueryGroupValue <IDictionary <string, string> >(d, grpVal));
                }

                var t  = i.Value <JObject>("timeframe");
                var qv = new QueryIntervalValue <IEnumerable <QueryGroupValue <IDictionary <string, string> > > >(qgl, t.Value <DateTime>("start"), t.Value <DateTime>("end"));
                result.Add(qv);
            }
            return(result);
        }