public StatisticsTransferScheduledAction(Collector filler, StatisticsRepository repository, ConfigurationManagerWrapper config)
		{
			var section = config.GetContentSection<StatisticsSection>("statistics", required: false);
			MemoryFlushInterval = section.MemoryFlushInterval;
			TransferInterval = section.TransferInterval;
			StatisticsGranularity = section.Granularity;
			this.filler = filler;
			this.repository = repository;
		}
Example #2
0
        public ActivityPeriod(DateTime start, DateTime end, Granularity gran, TimelineEventStore store)
        {
            Start = start;
            End = end;
            Granularity = gran;
            m_Store = store;

            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.UserPaint, true);
        }
		public StatisticsContentHandler(StatisticsRepository repository, ConfigurationManagerWrapper config)
		{
			this.repository = repository;
			var section = config.GetContentSection<Configuration.StatisticsSection>("statistics", required: false);
			this.displayedDays = section.DisplayedDays;
			this.granularity = section.Granularity;
			this.slotSize = granularity == Granularity.Day
				? TimeSpan.FromDays(1)
				: granularity == Granularity.Hour
					? TimeSpan.FromHours(1)
					: TimeSpan.FromMinutes(1);
		}
Example #4
0
		public override void Transfer(DateTime uptil, Granularity interval)
		{
			try
			{
				base.Transfer(uptil, interval);
				AdoExceptionDetected = null;
			}
			catch (GenericADOException)
			{
				MarkAdoException();
				throw;
			}
		}
		public static DateTime GetSlot(this DateTime date, Granularity interval, bool endOfSlot = false)
		{
			DateTime slot;
			if (interval == Granularity.Minute)
				slot = new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, 0);
			else if (interval == Granularity.Hour)
				slot = new DateTime(date.Year, date.Month, date.Day, date.Hour, 0, 0);
			else
				slot = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);

			if (endOfSlot)
			{
				if (interval == Granularity.Minute)
					slot = slot.AddMinutes(1);
				else if (interval == Granularity.Hour)
					slot = slot.AddHours(1);
				else
					slot = slot.AddDays(1);
			}

			return slot;
		}
Example #6
0
        public List<ActivityPeriod> GetActivity(DateTime start, DateTime end, Granularity gran)
        {
            List<ActivityPeriod> res = new List<ActivityPeriod>();
            DateTime currentStart = start;
            DateTime current = start;
            bool on = false;
            while (current <= end) {
                bool onHere = false;
                DateTime now = current;
                switch (gran) {
                    case Granularity.Hour:
                        onHere = ActivityDuringHour(current);
                        current = current.AddHours(1);
                        break;
                    case Granularity.Day:
                        onHere = ActivityDuringDay(current);
                        current = current.AddDays(1);
                        break;
                    case Granularity.Month:
                        onHere = ActivityDuringMonth(current);
                        current = current.AddMonths(1);
                        break;
                }
                if (!on && onHere) {
                    on = true;
                    currentStart = now;
                } else if (on && !onHere) {
                    on = false;
                    res.Add(new ActivityPeriod(currentStart, now, gran, this));
                }
            }
            if (on) {
                res.Add(new ActivityPeriod(currentStart, end, gran, this));
            }

            return res;
        }
        public IEnumerable <ActivePeriodViewModel> GetActivePeriodsDistributionReport(RoleData role, int hospitalId, string specialtyCode, int clinicianId, Granularity granularity)
        {
            var activePeriodsDistributionReport = _reportAuthorizationFilter.GetActivePeriodsDistributionReport(role, hospitalId, specialtyCode, clinicianId, (Manager.Granularity)granularity);

            return
                (activePeriodsDistributionReport.Select(
                     activePeriodInfo => _activePeriodInfoToViewModelMapper.Map(activePeriodInfo)).ToArray());
        }
Example #8
0
 /// <summary>
 /// Get historic rates
 /// </summary>
 /// <param name="pair">Trading pair</param>
 /// <param name="startTime">Start time of candles (UTC Time)</param>
 /// <param name="endTime">End time of candles (UTC Time)</param>
 /// <param name="granularity">Candle size</param>
 /// <returns>HistoricRates array</returns>
 public HistoricRates[] GetHistoricRates(string pair, DateTime startTime, DateTime endTime, Granularity granularity)
 {
     return(_repository.GetHistoricRates(pair, startTime, endTime, granularity).Result);
 }
        public IEnumerable <ActivePeriodInfo> GetActivePeriodsDistributionReport(int hospitalId, string specialtyCode, int clinicianId, Granularity granularity)
        {
            var periods = GetActivePeriods(hospitalId, specialtyCode, clinicianId).ToList();

            var groupedPeriodsByGranularity = (from period in periods
                                               let lastCompletedEvent = period.CompletedEvents.LastOrDefault()
                                                                        where lastCompletedEvent != null
                                                                        group period by(granularity == Granularity.Specialty ? lastCompletedEvent.Clinician.Specialty.Name :
                                                                                        (granularity == Granularity.Clinician ? lastCompletedEvent.Clinician.Name :
                                                                                         lastCompletedEvent.Clinician.Hospital.Name))
                                                                        into groupedPeriods
                                                                        select new { groupedPeriods.Key, Periods = groupedPeriods.ToList() })
                                              .ToDictionary(e => e.Key, e => e.Periods);

            var activePeriodsDistribution = new List <ActivePeriodInfo>();

            foreach (var groupedPeriod in groupedPeriodsByGranularity)
            {
                for (var week = BreachPeriodWeekDistribution; week <= EighteenWeekPeriod; week++)
                {
                    var filteredPeriods = (from period in groupedPeriod.Value
                                           let daysInPeriod = period.GetDaysSpentAt(_clock.Today)
                                                              let periodWeek = (int)Math.Round((double)(daysInPeriod / 7)) + 1
                                                                               where
                                                                               ((periodWeek == week) ||
                                                                                (week == BreachPeriodWeekDistribution && periodWeek > EighteenWeekPeriod))
                                                                               select period)
                                          .ToList();

                    var firstPeriod = filteredPeriods.Any() ? filteredPeriods.FirstOrDefault() : groupedPeriod.Value.FirstOrDefault();
                    if (firstPeriod != null)
                    {
                        var lastCompletedEvent = firstPeriod.CompletedEvents.LastOrDefault();
                        if (lastCompletedEvent != null)
                        {
                            activePeriodsDistribution.Add(new ActivePeriodInfo
                            {
                                Clinician             = lastCompletedEvent.Clinician.Name,
                                ClinicianId           = lastCompletedEvent.Clinician.Id,
                                Specialty             = lastCompletedEvent.Clinician.Specialty.Name,
                                SpecialtyCode         = lastCompletedEvent.Clinician.Specialty.Code,
                                Hospital              = lastCompletedEvent.Clinician.Hospital.Name,
                                HospitalId            = lastCompletedEvent.Clinician.Hospital.Id,
                                NumberOfActivePeriods = filteredPeriods.Any() ? filteredPeriods.Count : 0,
                                Week = week > EighteenWeekPeriod ? BreachPeriodWeekDistribution : week
                            });
                        }
                    }
                }
            }

            return(activePeriodsDistribution);
        }
Example #10
0
        private static void DisplayPartitionRange(List <string> partitionKeys, bool current, Granularity granularity)
        {
            LogMessage("", MessageType.Informational, false);

            if (partitionKeys.Count > 0)
            {
                LogMessage($"=>{(current ? "Current" : "New")} partition range ({Convert.ToString(granularity)}):", MessageType.Informational, false);
                LogMessage($"MIN partition:   {DateFormatPartitionKey(partitionKeys[0], granularity)}", MessageType.Informational, true);
                LogMessage($"MAX partition:   {DateFormatPartitionKey(partitionKeys[partitionKeys.Count - 1], granularity)}", MessageType.Informational, true);
                LogMessage($"Partition count: {partitionKeys.Count}", MessageType.Informational, true);
            }
            else
            {
                LogMessage("=>Table not yet partitioned", MessageType.Informational, false);
            }
        }
Example #11
0
        private static Partition CreateNewPartition(Table table, Partition templatePartition, PartitioningConfiguration partitioningConfiguration, string partitionKey, Granularity granularity)
        {
            string beginParam = GetDateKey(partitionKey, granularity, partitioningConfiguration.IntegerDateKey, false, templatePartition.Source is MPartitionSource);
            string endParam   = GetDateKey(partitionKey, granularity, partitioningConfiguration.IntegerDateKey, true, templatePartition.Source is MPartitionSource);

            Partition newPartition;

            newPartition = new Partition();
            templatePartition.CopyTo(newPartition);
            newPartition.Name = partitionKey;
            //string query = String.Format(partitioningConfiguration.TemplateSourceQuery, beginParam, endParam);
            string query = partitioningConfiguration.TemplateSourceQuery.Replace("{0}", beginParam).Replace("{1}", endParam);

            switch (newPartition.Source)
            {
            case MPartitionSource mSource:
                mSource.Expression = query;
                break;

            case QueryPartitionSource querySource:
                querySource.Query = query;
                break;
            }
            table.Partitions.Add(newPartition);
            return(newPartition);
        }
        /// <summary>
        /// Get historic rates
        /// </summary>
        /// <param name="pair">Trading pair</param>
        /// <param name="startTime">Start time of candles</param>
        /// <param name="endTime">End time of candles</param>
        /// <param name="granularity">Candle size</param>
        /// <param name="candleCount">Number of candles</param>
        /// <returns>HistoricRates array</returns>
        private async Task <HistoricRates[]> OnGetHistoricRates(string pair, DateTime?startTime, DateTime?endTime, Granularity granularity, int candleCount)
        {
            DateTime endDT   = endTime == null ? DateTime.UtcNow : (DateTime)endTime;
            DateTime startDT = DateTime.UtcNow;

            if (startTime == null)
            {
                startDT = _helper.GetFromUnixTime(endDT, granularity, candleCount);
            }
            else
            {
                startDT = (DateTime)startTime;
            }
            var startISO        = _helper.GetISO8601Date(startDT);
            var endISO          = _helper.GetISO8601Date(endDT);
            var tradingPair     = _helper.CreateDashedPair(pair);
            var longGranularity = _helper.GranularityToNumber(granularity);
            var url             = baseUrl + $"/products/{tradingPair}/candles?start={startISO}&end={endISO}&granularity={longGranularity}";

            var response = await _restRepo.GetApiStream <HistoricRates[]>(url, GetRequestHeaders());

            return(response);
        }
Example #13
0
        /// <summary>
        /// Merge months into a year, or days into a month.
        /// </summary>
        /// <param name="modelConfiguration">Configuration info for the model</param>
        /// <param name="messageLogger">Pointer to logging method</param>
        /// <param name="analysisServicesTable">Name of the partitioned table in the tabular model.</param>
        /// <param name="targetGranularity">Granularity of the newly created partition. Must be year or month.</param>
        /// <param name="partitionKey">Target partition key. If year, follow yyyy; if month follow yyyymm.</param>
        public static void MergePartitions(ModelConfiguration modelConfiguration, LogMessageDelegate messageLogger, string analysisServicesTable, Granularity targetGranularity, string partitionKey)
        {
            _modelConfiguration = modelConfiguration;
            _messageLogger      = messageLogger;

            Server server = new Server();

            try
            {
                LogMessage("", MessageType.Informational, false);
                LogMessage($"Merge partitions into {partitionKey} for table {analysisServicesTable}", MessageType.Informational, false);
                LogMessage(new String('-', partitionKey.Length + analysisServicesTable.Length + 33), MessageType.Informational, false);
                LogMessage("", MessageType.Informational, false);
                LogMessage("=>Actions & progress:", MessageType.Informational, false);

                //Check target granularity
                if (targetGranularity == Granularity.Daily)
                {
                    throw new InvalidOperationException($"Target granularity for merging must be year or month.");
                }

                //Check new partition key is expected format
                int partitionKeyParsed;
                if (!(
                        (partitionKey.Length == 4 && targetGranularity == Granularity.Yearly) ||
                        (partitionKey.Length == 6 && targetGranularity == Granularity.Monthly)
                        ) || !int.TryParse(partitionKey, out partitionKeyParsed)
                    )
                {
                    throw new InvalidOperationException($"Partition key {partitionKey} is not of expected format.");
                }

                //Check configuration contains the partitioned table
                bool foundMatch = false;
                PartitioningConfiguration partitionConfig = null;
                foreach (TableConfiguration tableConfig in modelConfiguration.TableConfigurations)
                {
                    if (tableConfig.AnalysisServicesTable == analysisServicesTable && tableConfig.PartitioningConfigurations.Count > 0)
                    {
                        partitionConfig = tableConfig.PartitioningConfigurations[0];
                        foundMatch      = true;
                        break;
                    }
                }
                if (!foundMatch)
                {
                    throw new InvalidOperationException($"Table {analysisServicesTable} not found in configuration with at least one partitioning configuration defined.");
                }

                Database database;
                Connect(server, out database);

                Table table = database.Model.Tables.Find(analysisServicesTable);
                if (table == null)
                {
                    throw new Microsoft.AnalysisServices.ConnectionException($"Could not connect to table {analysisServicesTable}.");
                }

                //Find template partition
                Partition templatePartition = table.Partitions.Find(analysisServicesTable);
                if (templatePartition == null)
                {
                    throw new InvalidOperationException($"Table {analysisServicesTable} does not contain a partition with the same name to act as the template partition.");
                }

                //See if there is already a partition with same key - do not want to delete an existing partition in case of inadvertent data loss
                if (table.Partitions.Find(partitionKey) != null)
                {
                    throw new InvalidOperationException($"Table {analysisServicesTable} already contains a partition with key {partitionKey}. Please delete this partition and retry.");
                }


                //Check there are partitions to be merged
                Granularity      childGranularity     = targetGranularity == Granularity.Yearly ? Granularity.Monthly : Granularity.Daily;
                List <Partition> partitionsToBeMerged = GetPartitionsCurrent(table, childGranularity, partitionKey);
                if (partitionsToBeMerged.Count == 0)
                {
                    LogMessage($"No partitinos found in {analysisServicesTable} to be merged into {partitionKey}.", MessageType.Informational, false);
                }
                else
                {
                    //Done with validation, so go ahead ...
                    LogMessage("", MessageType.Informational, false);
                    LogMessage($"Create new merged partition {DateFormatPartitionKey(partitionKey, targetGranularity)} for table {analysisServicesTable}", MessageType.Informational, true);
                    Partition newPartition = CreateNewPartition(table, templatePartition, partitionConfig, partitionKey, targetGranularity);

                    foreach (Partition partition in partitionsToBeMerged)
                    {
                        LogMessage($"Partition {partition.Name} to be merged into {DateFormatPartitionKey(partitionKey, targetGranularity)}", MessageType.Informational, true);
                    }

                    newPartition.RequestMerge(partitionsToBeMerged);
                    LogMessage($"Save changes for table {analysisServicesTable} ...", MessageType.Informational, true);
                    database.Model.SaveChanges();

                    Console.ForegroundColor = ConsoleColor.White;
                    LogMessage("", MessageType.Informational, false);
                    LogMessage("Finish: " + DateTime.Now.ToString("hh:mm:ss tt"), MessageType.Informational, false);
                }
            }
            catch (Exception exc)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                LogMessage("", MessageType.Informational, false);
                LogMessage($"Exception occurred: {DateTime.Now.ToString("hh:mm:ss tt")}", MessageType.Error, false);
                LogMessage($"Exception message: {exc.Message}", MessageType.Error, false);
                if (exc.InnerException != null)
                {
                    LogMessage($"Inner exception message: {exc.InnerException.Message}", MessageType.Error, false);
                }
                LogMessage("", MessageType.Informational, false);
                Console.ForegroundColor = ConsoleColor.White;
            }
            finally
            {
                try
                {
                    _modelConfiguration = null;
                    _messageLogger      = null;
                    if (server != null)
                    {
                        server.Disconnect();
                    }
                }
                catch { }
            }
        }
Example #14
0
        public File GetFuturePeriodBreachesReportFile(RoleData role, int weeksToBreach,
                                                      Format format, Layout layout, int hospitalId, string specialtyCode, int clinicianId, Granularity granularity)
        {
            string outputFileName;
            string templateFileName;

            switch (granularity)
            {
            case Granularity.Specialty:
                switch (layout)
                {
                case Layout.BarChart:
                    templateFileName =
                        "CPMS.Report.Rendering.Adapters.Templates.FuturePeriodBreaches_Specialty_BarChart.rdlc";
                    break;

                case Layout.Tabular:
                    templateFileName =
                        "CPMS.Report.Rendering.Adapters.Templates.FuturePeriodBreaches_Specialty_Tabular.rdlc";
                    break;

                default:
                    throw new NotSupportedException(string.Format("Layout {0} is not supported!", layout));
                }
                outputFileName = "FuturePeriodBreachesBySpecialty";
                break;

            case Granularity.Clinician:
                switch (layout)
                {
                case Layout.BarChart:
                    templateFileName =
                        "CPMS.Report.Rendering.Adapters.Templates.FuturePeriodBreaches_Clinician_BarChart.rdlc";
                    break;

                case Layout.Tabular:
                    templateFileName =
                        "CPMS.Report.Rendering.Adapters.Templates.FuturePeriodBreaches_Clinician_Tabular.rdlc";
                    break;

                default:
                    throw new NotSupportedException(string.Format("Layout {0} is not supported!", layout));
                }
                outputFileName = "FuturePeriodBreachesByClinician";
                break;

            case Granularity.Hospital:
                switch (layout)
                {
                case Layout.BarChart:
                    templateFileName =
                        "CPMS.Report.Rendering.Adapters.Templates.FuturePeriodBreaches_Hospital_BarChart.rdlc";
                    break;

                case Layout.Tabular:
                    templateFileName =
                        "CPMS.Report.Rendering.Adapters.Templates.FuturePeriodBreaches_Hospital_Tabular.rdlc";
                    break;

                default:
                    throw new NotSupportedException(string.Format("Layout {0} is not supported!", layout));
                }
                outputFileName = "FuturePeriodBreachesByHospital";
                break;

            default:
                throw new NotSupportedException(string.Format("Granularity {0} is not supported!", granularity));
            }

            var futurePeriodBreachesReportData = _reportPresentationService.GetFuturePeriodBreachesReport(role, weeksToBreach, hospitalId,
                                                                                                          specialtyCode, clinicianId, granularity);
            var reportDataSource = new ReportDataSource("FuturePeriodBreaches", futurePeriodBreachesReportData);

            return(GetReportFile(format, templateFileName, outputFileName, reportDataSource));
        }
Example #15
0
 public Model(string root, Granularity report) : base()
 {
     IssueModel = new Issue.Vector.Model();
     this._data = new FlacDiags(root, report, FormatModel.Data, IssueModel.Data);
 }
        /// <summary>
        /// Get instrument with it's candles for a specific timerange
        /// with a specific granularity
        /// </summary>
        /// <param name="instrument">Name of the instrument</param>
        /// <param name="granularity">Granularity of the instrument</param>
        /// <param name="utcFrom">Time to get the candles from (taken as an UTC time)</param>
        /// <param name="utcTo">Time to get the candles to (taken as an UTC time)</param>
        /// <returns>The instrument object with it's candles</returns>
        public async Task <InstrumentWithCandles> GetInstrumentCandles(InstrumentName instrument, Granularity granularity, DateTime utcFrom, DateTime utcTo)
        {
            // Collect all blob names needed
            var blobNames = GetBlobPaths(instrument, granularity, utcFrom, utcTo);

            // Get the container client
            var containerClient = _storageService.GetBlobContainerClient(INSTRUMENT_CONTAINER);

            // Create returning instrument object
            var instrumentWithCandles = new InstrumentWithCandles()
            {
                InstrumentName = instrument,
                Granularity    = granularity,
                Candles        = new List <Candle>()
            };

            // Loop through the required blob files to get all candles data
            foreach (string blob in blobNames)
            {
                // Get the blob client
                var blobClient = containerClient.GetBlobClient(blob);

                // Download blob to stream
                using var stream = new MemoryStream();
                await blobClient.DownloadToAsync(stream);

                // Deserialize stream to object
                stream.Position = 0;
                var serializer = new JsonSerializer();
                using var streamReader   = new StreamReader(stream);
                using var jsonTextReader = new JsonTextReader(streamReader);
                var candles = serializer.Deserialize <IEnumerable <Candle> >(jsonTextReader);

                // Add it to the instrument
                // Since it is abstract ICollection
                // Do a loop
                foreach (var candle in candles)
                {
                    instrumentWithCandles.Candles.Add(candle);
                }
            }

            // Order candles by time (better safe then sorry)
            instrumentWithCandles.Candles.OrderBy(candle => candle.Time);

            // Return instrument with it's candles
            return(instrumentWithCandles);
        }
Example #17
0
        public File GetMonthly18wRTTPerformanceReportFile(RoleData role, DateTime fromDate, DateTime toDate,
                                                          Format format, int hospitalId, string specialtyCode, int clinicianId, Granularity granularity)
        {
            string outputFileName;
            string templateFileName;

            switch (granularity)
            {
            case Granularity.Specialty:
                templateFileName = "CPMS.Report.Rendering.Adapters.Templates.Monthly18wRTTPerformance_Specialty_Tabular.rdlc";
                outputFileName   = "Monthly18wRTTPerformanceBySpecialty";
                break;

            case Granularity.Clinician:
                templateFileName = "CPMS.Report.Rendering.Adapters.Templates.Monthly18wRTTPerformance_Clinician_Tabular.rdlc";
                outputFileName   = "Monthly18wRTTPerformanceByClinician";
                break;

            case Granularity.Hospital:
                templateFileName = "CPMS.Report.Rendering.Adapters.Templates.Monthly18wRTTPerformance_Hospital_Tabular.rdlc";
                outputFileName   = "Monthly18wRTTPerformanceByHospital";
                break;

            default:
                throw new NotSupportedException(string.Format("Granularity {0} is not supported!", granularity));
            }

            var periodBreachesReportData = _reportPresentationService.GetMonthly18wRTTPerformanceReport(role, fromDate, toDate, hospitalId,
                                                                                                        specialtyCode, clinicianId, granularity);
            var reportDataSource = new ReportDataSource("Monthly18wRTTPerformance", periodBreachesReportData);

            return(GetReportFile(format, templateFileName, outputFileName, reportDataSource));
        }
 /// <summary>
 /// Get the instrument and granularity based blob folder
 /// </summary>
 /// <param name="instrument"></param>
 /// <param name="granularity"></param>
 /// <returns></returns>
 private string GetInstrumentFolder(InstrumentName instrument, Granularity granularity) => $"{instrument.ToString().ToUpper()}/{granularity.ToString().ToUpper()}";
Example #19
0
 /// <summary>
 /// Get historic rates asyncronously
 /// </summary>
 /// <param name="pair">Trading pair</param>
 /// <param name="startTime">Start time of candles (UTC Time)</param>
 /// <param name="endTime">End time of candles (UTC Time)</param>
 /// <param name="granularity">Candle size</param>
 /// <returns>HistoricRates array</returns>
 public async Task <HistoricRates[]> GetHistoricRatesAsync(string pair, DateTime startTime, DateTime endTime, Granularity granularity)
 {
     return(await _repository.GetHistoricRates(pair, startTime, endTime, granularity));
 }
Example #20
0
 /// <summary>
 /// Get historic rates asyncronously
 /// </summary>
 /// <param name="pair">Trading pair</param>
 /// <param name="endTime">End time of candles (UTC Time)</param>
 /// <param name="granularity">Candle size</param>
 /// <param name="candleCount">Number of candles</param>
 /// <returns>HistoricRates array</returns>
 public async Task <HistoricRates[]> GetHistoricRatesAsync(string pair, DateTime endTime, Granularity granularity, int candleCount)
 {
     return(await _repository.GetHistoricRates(pair, endTime, granularity, candleCount));
 }
 /// <summary>
 /// Get historic rates
 /// </summary>
 /// <param name="pair">Trading pair</param>
 /// <param name="endTime">End time of candles</param>
 /// <param name="granularity">Candle size</param>
 /// <param name="candleCount">Number of candles</param>
 /// <returns>HistoricRates array</returns>
 public async Task <HistoricRates[]> GetHistoricRates(string pair, DateTime endTime, Granularity granularity, int candleCount)
 {
     return(await OnGetHistoricRates(pair, null, endTime, granularity, candleCount));
 }
Example #22
0
 public bool IsReportable(Granularity granularity) => (int)Level >= (int)granularity;
 /// <summary>
 /// Get historic rates
 /// </summary>
 /// <param name="pair">Trading pair</param>
 /// <param name="startTime">Start time of candles</param>
 /// <param name="endTime">End time of candles</param>
 /// <param name="granularity">Candle size</param>
 /// <returns>HistoricRates array</returns>
 public async Task <HistoricRates[]> GetHistoricRates(string pair, DateTime startTime, DateTime endTime, Granularity granularity)
 {
     return(await OnGetHistoricRates(pair, startTime, endTime, granularity, 0));
 }
Example #24
0
        public static List <Band <double> > Bands(SizeUpContext context, long industryId, long boundingGeographicLocationId, int bands, Granularity granularity)
        {
            var gran = Enum.GetName(typeof(Granularity), granularity);

            var data = Core.DataLayer.IndustryData.Get(context)
                       .Where(i => i.IndustryId == industryId)
                       .Where(i => i.GeographicLocation.Granularity.Name == gran)
                       .Where(i => i.GeographicLocation.GeographicLocations.Any(g => g.Id == boundingGeographicLocationId));

            var output = data
                         .Where(i => i.CostEffectiveness != null && i.CostEffectiveness > 0)
                         .Select(i => i.Bands.Where(b => b.Attribute.Name == IndustryAttribute.CostEffectiveness).Select(b => new Band <double> {
                Min = (double)b.Min.Value, Max = (double)b.Max.Value
            }).FirstOrDefault())
                         .ToList()
                         .NTileDescending(i => i.Min, bands)
                         .Select(i => new Band <double>()
            {
                Min = i.Min(v => v.Min), Max = i.Max(v => v.Max)
            })
                         .ToList();

            output.FormatDescending();
            return(output);
        }
Example #25
0
        public IEnumerable <Monthly18wRTTPerformanceInfo> GetMonthly18wRTTPerformanceReport(DateTime fromDate, DateTime toDate,
                                                                                            int hospitalId, string specialtyCode, int clinicianId, Granularity granularity)
        {
            var periods = _periodRepository.Get(period =>
                                                (clinicianId == 0 || period.CompletedEvents.OrderByDescending(e => e.Id).FirstOrDefault().Clinician.Id == clinicianId) &&
                                                (String.IsNullOrEmpty(specialtyCode) || period.CompletedEvents.OrderByDescending(e => e.Id).FirstOrDefault().Clinician.Specialty.Code == specialtyCode) &&
                                                (hospitalId == 0 || period.CompletedEvents.OrderByDescending(e => e.Id).FirstOrDefault().Clinician.Hospital.Id == hospitalId),
                                                fromDate,
                                                p => p.CompletedEvents.Select(e => e.Name),
                                                p => p.CompletedEvents.Select(e => e.Clinician.Specialty),
                                                p => p.CompletedEvents.Select(e => e.Clinician.Hospital))
                          .ToList();

            var periodsReport = new List <Monthly18wRTTPerformanceInfo>();

            for (var date = fromDate; date <= toDate; date = date.AddMonths(1))
            {
                var monthlyPeriodBreaches = _monthlyPeriodBreachesReportService.GetMonthlyPeriodBreaches(periods, date, granularity);
                if (monthlyPeriodBreaches != null)
                {
                    periodsReport.AddRange(monthlyPeriodBreaches);
                }
            }

            return(periodsReport);
        }
Example #26
0
		public virtual void Transfer(DateTime uptil, Granularity interval)
		{
			using (var tx = buckets.BeginTransaction())
			{
				var slotEndTime = uptil.GetSlot(interval, endOfSlot: true);
				var collectedBuckets = buckets.Find().Where(b => b.TimeSlot < slotEndTime).OrderBy(b => b.TimeSlot).ToArray();
				if (collectedBuckets.Length == 0)
					return;

				ClearBuckets(collectedBuckets);

				var start = collectedBuckets[0].TimeSlot;
				var pageViews = collectedBuckets
					.GroupBy(b => new KeyValuePair<DateTime, int>(b.TimeSlot.GetSlot(interval), b.PageID), b => b.Views)
					.ToDictionary(b => b.Key, b => b.Sum());

				var existingStatistics = IncrementExistingStatistics(uptil, interval, start, pageViews);

				var addedStatistics = InsertNewStatistics(pageViews);
				
				tx.Commit();

				logger.InfoFormat("Transferred {0} buckets into {1} new and {2} updated statistics", collectedBuckets.Length, addedStatistics.Count, existingStatistics.Count);
			}
		}
Example #27
0
 private static void IncrementalProcessPartition(string partitionKey, Partition partitionToProcess, Granularity granularity)
 {
     if (_modelConfiguration.IncrementalOnline)
     {
         LogMessage($"Parallel process partition {DateFormatPartitionKey(partitionKey, granularity)} /Full", MessageType.Informational, true);
         partitionToProcess.RequestRefresh(RefreshType.Full);
     }
     else
     {
         LogMessage($"Parallel process partition {DateFormatPartitionKey(partitionKey, granularity)} /DataOnly", MessageType.Informational, true);
         partitionToProcess.RequestRefresh(RefreshType.DataOnly);
     }
 }
Example #28
0
            static void Main(string[] args)
            {
                Granularity?granularity_option             = null;
                bool?       instrument_option              = null;
                bool?       also_run_disabled_tests_option = null;
                string      filter_option = null;

                var death_test_processes = new List <Process>();
                var processes            = new List <Process>();
                int test_process_counter = 0;

                var instrument_tests = new List <Task>();

                foreach (string arg in args)
                {
                    if (arg.StartsWith("--") && arg.Contains(":"))
                    {
                        string[] split  = arg.Split(new [] { "--", ":" }, StringSplitOptions.None);
                        string   option = split[1];
                        string   value  = split[2];
                        if (option == "granularity")
                        {
                            granularity_option = ParseEnum <Granularity>(value);
                        }
                        else if (option == "instrument")
                        {
                            instrument_option = bool.Parse(value);
                        }
                        else if (option == "also_run_disabled_tests")
                        {
                            also_run_disabled_tests_option = bool.Parse(value);
                        }
                        else if (option == "filter")
                        {
                            filter_option = value;
                        }
                        else
                        {
                            Console.WriteLine("Unknown option " + option);
                            Environment.Exit(1);
                        }
                        continue;
                    }
                    Granularity granularity             = granularity_option ?? Granularity.Test;
                    bool        instrument              = instrument_option ?? false;
                    bool        also_run_disabled_tests = also_run_disabled_tests_option ?? false;
                    string      filter = filter_option;
                    granularity_option = null;
                    instrument_option  = null;
                    filter_option      = null;

                    if (filter != null && granularity == Granularity.Package)
                    {
                        Console.WriteLine(
                            "--filter is not supported with --granularity:Package");
                        Environment.Exit(1);
                    }

                    string[] test_binaries = Directory.GetFiles(arg, "*_tests.exe");
                    foreach (string test_binary in test_binaries)
                    {
                        if (instrument)
                        {
                            instrument_tests.Add(
                                RunProcessAsync(vsinstr, "/coverage \"" + test_binary + "\""));
                        }
                        if (granularity == Granularity.Package)
                        {
                            var process = new Process {
                                StartInfo =
                                {
                                    UseShellExecute        = false,
                                    RedirectStandardOutput = true,
                                    RedirectStandardError  = true,
                                    FileName  = test_binary,
                                    Arguments = "--gtest_filter=-*DeathTest.*"
                                }
                            };
                            process.StartInfo.Arguments +=
                                " --gtest_output=xml:TestResults\\gtest_results_" +
                                test_process_counter++ + ".xml";
                            processes.Add(process);
                            process = new Process {
                                StartInfo =
                                {
                                    UseShellExecute        = false,
                                    RedirectStandardOutput = false,
                                    RedirectStandardError  = false,
                                    FileName  = test_binary,
                                    Arguments = "--gtest_filter=*DeathTest.*"
                                }
                            };
                            process.StartInfo.Arguments +=
                                " --gtest_output=xml:TestResults\\gtest_results_" +
                                test_process_counter++ + ".xml";
                            if (also_run_disabled_tests)
                            {
                                process.StartInfo.Arguments += " --gtest_also_run_disabled_tests";
                            }
                            death_test_processes.Add(process);
                            continue;
                        }
                        var info = new ProcessStartInfo(
                            test_binary,
                            filter == null
                ? "--gtest_list_tests"
                : $"--gtest_list_tests --gtest_filter={filter}")
                        {
                            UseShellExecute        = false,
                            RedirectStandardOutput = true
                        };
                        var    list_tests    = Process.Start(info);
                        var    output        = list_tests.StandardOutput;
                        string test_case     = null;
                        bool?  is_death_test = null;
                        while (!output.EndOfStream)
                        {
                            string line = output.ReadLine();
                            if (line[0] != ' ')
                            {
                                test_case     = line;
                                is_death_test = Regex.Match(line, ".*DeathTest").Success;
                                if (granularity == Granularity.TestCase)
                                {
                                    var process = new Process {
                                        StartInfo =
                                        {
                                            UseShellExecute        = false,
                                            RedirectStandardOutput = true,
                                            RedirectStandardError  = true,
                                            FileName  = test_binary,
                                            Arguments = "--gtest_filter=" + test_case + "*"
                                        }
                                    };
                                    process.StartInfo.Arguments +=
                                        " --gtest_output=xml:TestResults\\gtest_results_" +
                                        test_process_counter++ + ".xml";
                                    if (also_run_disabled_tests)
                                    {
                                        process.StartInfo.Arguments +=
                                            " --gtest_also_run_disabled_tests";
                                    }
                                    if (is_death_test.Value)
                                    {
                                        death_test_processes.Add(process);
                                    }
                                    else
                                    {
                                        processes.Add(process);
                                    }
                                }
                            }
                            else if (granularity == Granularity.Test)
                            {
                                var process = new Process {
                                    StartInfo =
                                    {
                                        UseShellExecute        = false,
                                        RedirectStandardOutput = true,
                                        RedirectStandardError  = true,
                                        FileName  = test_binary,
                                        Arguments = Encoding.Default.GetString(
                                            Encoding.UTF8.GetBytes(
                                                "--gtest_filter=" + test_case + line.Split(' ')[2]))
                                    }
                                };
                                process.StartInfo.Arguments +=
                                    " --gtest_output=xml:TestResults\\gtest_results_" +
                                    test_process_counter++ + ".xml";
                                if (also_run_disabled_tests)
                                {
                                    process.StartInfo.Arguments += " --gtest_also_run_disabled_tests";
                                }
                                if (is_death_test.Value)
                                {
                                    death_test_processes.Add(process);
                                }
                                else
                                {
                                    processes.Add(process);
                                }
                            }
                        }
                    }
                }
                var stopwatch = new Stopwatch();

                Console.WriteLine("Instrumenting " + instrument_tests.Count +
                                  " processes...");
                stopwatch.Start();
                if (instrument_tests.Count > 0)
                {
                    instrument_tests.ForEach(task => task.Start());
                    Task.WaitAll(instrument_tests.ToArray());
                    Console.WriteLine("Done (" + stopwatch.ElapsedMilliseconds + " ms)");
                }

                Console.WriteLine("Running " + death_test_processes.Count +
                                  " death test processes...");
                stopwatch.Restart();

                foreach (Process process in death_test_processes)
                {
                    process.StartInfo.RedirectStandardOutput = false;
                    process.StartInfo.RedirectStandardError  = false;
                    process.Start();
                    process.WaitForExit();
                    if (process.ExitCode != 0)
                    {
                        Console.WriteLine("Exit code " + process.ExitCode +
                                          " from a death test");
                        Environment.Exit(process.ExitCode);
                    }
                }

                Console.WriteLine("Running " + processes.Count + " processes...");

                Task[] tasks  = new Task[processes.Count];
                var    errors = new ConcurrentBag <string>();

                for (int i = 0; i < processes.Count; ++i)
                {
                    var process = processes[i];
                    // We cannot use i in the lambdas, it would be captured by reference.
                    int index = i;
                    process.Start();
                    tasks[i] = Task.Run(async() => {
                        while (!process.StandardOutput.EndOfStream)
                        {
                            Console.WriteLine("O" + index.ToString().PadLeft(4) + " " +
                                              await process.StandardOutput.ReadLineAsync());
                        }
                        if (process.ExitCode != 0)
                        {
                            errors.Add("Exit code " + process.ExitCode + " from (" +
                                       index.ToString() + ") " + process.StartInfo.FileName +
                                       " " + process.StartInfo.Arguments);
                        }
                    });
                    Task.Run(async() => {
                        while (!process.StandardError.EndOfStream)
                        {
                            Console.WriteLine("E" + index.ToString().PadLeft(4) + " " +
                                              await process.StandardError.ReadLineAsync());
                        }
                    });
                }

                Task.WaitAll(tasks);
                foreach (string error in errors)
                {
                    Console.WriteLine(error);
                }
                Console.WriteLine("Done (" + stopwatch.ElapsedMilliseconds + " ms)");
                Environment.Exit(errors.Count);
            }
Example #29
0
        private static List <string> GetPartitionKeysTarget(bool forProcessing, PartitioningConfiguration partitioningConfiguration, Granularity granularity)
        {
            //forProcessing: false to return complete target set of partitions, true to return partitons to be processed (may be less if incremental mode).

            List <string> partitionKeys      = new List <string>();
            int           numberOfPartitions = (forProcessing && !_modelConfiguration.InitialSetUp ? partitioningConfiguration.NumberOfPartitionsForIncrementalProcess : partitioningConfiguration.NumberOfPartitionsFull);

            for (int i = numberOfPartitions - 1; i >= 0; i--)
            {
                DateTime periodToAdd;
                switch (granularity)
                {
                case Granularity.Daily:
                    periodToAdd = partitioningConfiguration.MaxDate.AddDays(-i);
                    partitionKeys.Add(Convert.ToString((periodToAdd.Year * 100 + periodToAdd.Month) * 100 + periodToAdd.Day));
                    break;

                case Granularity.Monthly:
                    periodToAdd = partitioningConfiguration.MaxDate.AddMonths(-i);
                    partitionKeys.Add(Convert.ToString(periodToAdd.Year * 100 + periodToAdd.Month));
                    break;

                default:     //Granularity.Yearly:
                    periodToAdd = partitioningConfiguration.MaxDate.AddYears(-i);
                    partitionKeys.Add(Convert.ToString(periodToAdd.Year));
                    break;
                }
            }
            partitionKeys.Sort();

            return(partitionKeys);
        }
        private static Partition CreateNewPartition(Table table, Partition templatePartition, PartitioningConfiguration partitioningConfiguration, string partitionKey, Granularity granularity)
        {
            string beginParam = GetDateKey(partitionKey, granularity, partitioningConfiguration.IntegerDateKey, false);
            string endParam   = GetDateKey(partitionKey, granularity, partitioningConfiguration.IntegerDateKey, true);

            Partition newPartition;

            newPartition = new Partition();
            templatePartition.CopyTo(newPartition);
            newPartition.Name = partitionKey;
            ((QueryPartitionSource)newPartition.Source).Query = String.Format(partitioningConfiguration.TemplateSourceQuery, beginParam, endParam);
            table.Partitions.Add(newPartition);
            return(newPartition);
        }
        private IEnumerable <UserReportPortion> AggregateUserTransactions(Models.Loan loan, Transaction[] allTransactions, Granularity granularity)
        {
            var transactions   = allTransactions.Where(t => t.PaymentId == loan.PaymentId).ToArray();
            var withTimestamps = transactions.Select(t => new TransactionWithTimestamp {
                Timestamp = t.Timestamp.ToDateTime(), Transaction = t
            });
            var portions = Aggregations.GroupByPeriods(granularity, withTimestamps);

            foreach (var portion in portions)
            {
                var debits = portion.Sum(p => (float?)p.Transaction.Amount) ?? 0;
                yield return(new UserReportPortion {
                    Period = portion.Key, Debits = debits, Element = loan.Id
                });
            }
        }
Example #32
0
 /// <summary>
 /// Get historic rates
 /// </summary>
 /// <param name="pair">Trading pair</param>
 /// <param name="endTime">End time of candles (UTC Time)</param>
 /// <param name="granularity">Candle size</param>
 /// <param name="candleCount">Number of candles</param>
 /// <returns>HistoricRates array</returns>
 public HistoricRates[] GetHistoricRates(string pair, DateTime endTime, Granularity granularity, int candleCount)
 {
     return(_repository.GetHistoricRates(pair, endTime, granularity, candleCount).Result);
 }
Example #33
0
		private List<Statistic> IncrementExistingStatistics(DateTime uptil, Granularity interval, DateTime start, Dictionary<KeyValuePair<DateTime, int>, int> pageViews)
		{
			var existingStatistics = statistics.Find(Parameter.GreaterOrEqual("TimeSlot", start) & Parameter.LessThan("TimeSlot", uptil)).ToList();
			foreach (var s in existingStatistics)
			{
				var key = new KeyValuePair<DateTime, int>(s.TimeSlot.GetSlot(interval), s.PageID);
				if (!pageViews.ContainsKey(key))
					continue;
				s.Views += pageViews[key];
				pageViews.Remove(key);
			}

			statistics.SaveOrUpdate(existingStatistics);
			statistics.Flush();
			return existingStatistics;
		}
 public static string DateAsRelative(DateTime date, Granularity granularity)
 {
     return DateAsRelative(date, DateTime.Now, granularity);
 }
        public async Task <ActionResult <IEnumerable <Measurement> > > Get(
            [FromQuery][Required] DateTime startTime, [FromQuery][Required] DateTime endTime, [FromQuery][Required] Granularity granularity)
        {
            _logger.LogDebug($"GetMeasurements: startTime: {startTime}, endTime: {endTime}, granularity: {granularity}");
            var measurements = await _service.GetMeasurements(startTime, endTime, granularity);

            return(Ok(measurements));
        }
Example #36
0
        public IEnumerable <FuturePeriodBreachesInfo> GetFuturePeriodBreachesReport(int weeksToBreach, int hospitalId,
                                                                                    string specialtyCode, int clinicianId, Granularity granularity)
        {
            var fromDate        = _clock.Today.AddDays(-weeksToBreach * OneWeek);
            var completedEvents = _completedEventRepository.Get(completedEvent => completedEvent.IsActive &&
                                                                (clinicianId == 0 || completedEvent.Clinician.Id == clinicianId) &&
                                                                (string.IsNullOrEmpty(specialtyCode) || completedEvent.Clinician.Specialty.Code == specialtyCode) &&
                                                                (hospitalId == 0 || completedEvent.Clinician.Hospital.Id == hospitalId) &&
                                                                completedEvent.Period.ShouldCountForBreaches,
                                                                null,
                                                                fromDate,
                                                                e => e.Period.CompletedEvents.Select(completedEvent => completedEvent.Name),
                                                                e => e.Clinician.Specialty,
                                                                e => e.Clinician.Hospital)
                                  .Where(completedEvent =>
                                         completedEvent.Period.GetDaysRemainingAt(_clock.Today) > 0 &&
                                         completedEvent.Period.GetDaysRemainingAt(_clock.Today) <= weeksToBreach * OneWeek)
                                  .ToArray();

            var groupedEventsByGranularity = (from completedEvent in completedEvents
                                              group completedEvent by(granularity == Granularity.Specialty ? completedEvent.Clinician.Specialty.Name :
                                                                      (granularity == Granularity.Clinician ? completedEvent.Clinician.Name :
                                                                       completedEvent.Clinician.Hospital.Name))
                                              into groupedEvents
                                              select new { groupedEvents.Key, Events = groupedEvents.ToList() })
                                             .ToDictionary(e => e.Key, e => e.Events);

            var futurePeriodBreachesReport = new List <FuturePeriodBreachesInfo>();

            foreach (var groupedEvents in groupedEventsByGranularity)
            {
                for (var weekToBreach = 1; weekToBreach <= weeksToBreach; weekToBreach++)
                {
                    var filteredEvents = groupedEvents.Value.Where(e =>
                                                                   e.Period.GetDaysRemainingAt(_clock.Today) > (weekToBreach - 1) * OneWeek &&
                                                                   e.Period.GetDaysRemainingAt(_clock.Today) <= weekToBreach * OneWeek).ToList();

                    var completedEvent = filteredEvents.Any() ? filteredEvents.FirstOrDefault() : groupedEvents.Value.FirstOrDefault();
                    if (completedEvent != null)
                    {
                        futurePeriodBreachesReport.Add(new FuturePeriodBreachesInfo
                        {
                            Clinician        = granularity == Granularity.Clinician ? completedEvent.Clinician.Name : string.Empty,
                            Hospital         = completedEvent.Clinician.Hospital.Name,
                            Specialty        = granularity == Granularity.Clinician || granularity == Granularity.Specialty ? completedEvent.Clinician.Specialty.Name : string.Empty,
                            WeeksToBreach    = weekToBreach,
                            NumberOfBreaches = filteredEvents.Any() ? filteredEvents.Count() : 0
                        });
                    }
                }
            }

            return(futurePeriodBreachesReport);
        }
        public IEnumerable <Monthly18wRTTPerformanceViewModel> GetMonthly18wRTTPerformanceReport(RoleData role, DateTime fromDate, DateTime toDate, int hospitalId, string specialtyCode, int clinicianId, Granularity granularity)
        {
            var periodBreachesReport = _reportAuthorizationFilter.GetMonthly18wRTTPerformanceReport(role, fromDate, toDate, hospitalId, specialtyCode, clinicianId, (Manager.Granularity)granularity);

            return
                (periodBreachesReport.Select(
                     periodInfo => _monthlyPeriodBreachesInfoToViewModelMapper.Map(periodInfo)).ToArray());
        }
        public IEnumerable <FuturePeriodBreachesViewModel> GetFuturePeriodBreachesReport(RoleData role, int weeksToBreach, int hospitalId, string specialtyCode, int clinicianId, Granularity granularity)
        {
            var futurePeriodBreachesReport = _reportAuthorizationFilter.GetFuturePeriodBreachesReport(role, weeksToBreach, hospitalId, specialtyCode, clinicianId, (Manager.Granularity)granularity);

            return
                (futurePeriodBreachesReport.Select(
                     periodInfo => _futurePeriodBreachesInfoToViewModelMapper.Map(periodInfo)).ToArray());
        }
 public static string DateAsRelative(DateTime date, DateTime baseDate, Granularity granularity)
 {
     int secondsDelta = SecondsDelta(date, baseDate);
     int minutesDelta = MinutesDelta(date, baseDate);
     int hoursDelta = HoursDelta(date, baseDate);
     DaysDelta(date, baseDate);
     int num4 = WeeksDelta(date, baseDate);
     int num5 = MonthsDelta(date, baseDate);
     int delta = YearsDelta(date, baseDate);
     if ((granularity == Granularity.Minutes) && (minutesDelta <= MaximumMinutesGranularity))
     {
         return MinutesDeltaToString(minutesDelta, secondsDelta);
     }
     if (((granularity == Granularity.Minutes) || (granularity == Granularity.Hours)) && (hoursDelta <= MaximumHoursGranularity))
     {
         return HoursDeltaToString(hoursDelta, minutesDelta);
     }
     if (IsToday(date, baseDate))
     {
         return "Today";
     }
     if (IsTomorrow(date, baseDate))
     {
         return "Tomorrow";
     }
     if (IsYesterday(date, baseDate))
     {
         return "Yesterday";
     }
     if (IsThisWeek(date, baseDate))
     {
         return DateToDayOfWeekString(date);
     }
     if (IsLastWeek(date, baseDate))
     {
         return "Last week";
     }
     if (IsNextWeek(date, baseDate))
     {
         return "Next week";
     }
     if (Math.Abs(num4) <= 5)
     {
         return WeeksDeltaToString(num4);
     }
     if (IsLastMonth(date, baseDate))
     {
         return "Last month";
     }
     if (IsNextMonth(date, baseDate))
     {
         return "Next month";
     }
     if (Math.Abs(num5) < 12)
     {
         return MonthsDeltaToString(num5);
     }
     if (IsLastYear(date, baseDate))
     {
         return "Last year";
     }
     if (IsNextYear(date, baseDate))
     {
         return "Next year";
     }
     return YearsDeltaToString(delta);
 }
Example #40
0
        public HttpResponseMessage GetFuturePeriodBreachesReportFile([ModelBinder(typeof(RoleDataModelBinder))] RoleData role, int weeksToBreach,
                                                                     Format format = Format.Excel, Layout layout = Layout.Tabular, int hospitalId = 0, string specialtyCode = null, int clinicianId = 0, Granularity granularity = Granularity.Hospital)
        {
            var reportFile = _reportService.GetFuturePeriodBreachesReportFile(role, weeksToBreach, format, layout, hospitalId, specialtyCode,
                                                                              clinicianId, granularity);

            var response = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new ByteArrayContent(reportFile.Content)
            };

            response.Content.Headers.ContentType        = new MediaTypeHeaderValue("application/octet-stream");
            response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
            {
                FileName = reportFile.FileName
            };

            return(response);
        }