Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var useInMemoryStore = !_Platform.IsRunningOnWindows || _Platform.IsRunningOnMono || _Platform.IsRunningOnNanoServer;

            services.ConfigureDataContext(Configuration, useInMemoryStore);

            // Register dependencies
            services.ConfigureDependencies(Configuration);

            services.AddCaching();

            services.Configure <SecurityConfig>(Configuration.GetSection("Security"));

            // Add Identity services to the services container.
            services.AddIdentity <ApplicationUser, IdentityRole>()
            .AddEntityFrameworkStores <SkiResortContext>()
            .AddDefaultTokenProviders();

            // Add framework services.
            services.AddMvc().AddJsonOptions(options =>
            {
                options.SerializerSettings.ContractResolver =
                    new CamelCasePropertyNamesContractResolver();
            });

            // Initialize anomaly detection statics
            AnomalyDetector.Initialize(Configuration);
        }
Ejemplo n.º 2
0
        public RemoteCameraViewModel(CaptureElement captureElement)
        {
            // Check if CaptureElement is not null and throw an exception accordingly
            ArgumentCheck.IsNull(captureElement, "captureElement");

            // Store reference to the CaptureElement
            this.captureElement = captureElement;

            // Instantiate CameraCapture and ImageProcessor
            cameraCapture  = new CameraCapture();
            ImageProcessor = new ImageProcessor(cameraCapture);

            // Instantiate CloudHelper
            CloudHelper = new CloudHelper();

            // Instantiate AnomalyDetector
            AnomalyDetector = new AnomalyDetector();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            // ProcessData<ProductSalesData>("product-sales.csv", nameof(ProductSalesData.numSales));
            // ProcessData<CoronavirusData>("full_data.csv", nameof(CoronavirusData.NewCases));

            var filePath = Path.Combine(_dataPath, "full_data.csv");

            AnomalyDetector <CoronavirusData, CoronavirusPrediction>
            .SetContext()
            .LoadDataFromFile(filePath)
            .ManipulateData(data =>
                            from dailyCounts in data
                                where dailyCounts.Location == "Worldwide"
                            let parsedDate = DateTime.Parse(dailyCounts.Date)
                                             orderby parsedDate
                                             select dailyCounts)
            .SetOptions(new AnomalyDetectorOptions(nameof(CoronavirusData.NewCases)))
            .DetectSpike();
        }
        public async Task <IEnumerable <Lift> > GetNearByAsync(double latitude, double longitude)
        {
            var lifts = await _liftsRepository.GetNearByAsync(latitude, longitude);

            var liftCounts = await _liftLinesRepository.LiftSkiersWaitingAsync();

            var liftHistory = await _liftLinesRepository.LiftWaitHistoryAsync(TimeSpan.FromMinutes(30));

            foreach (var lift in lifts)
            {
                lift.WaitingTime = lift.Status != LiftStatus.Open ? -1 :
                                   ComputeWaitTime(liftCounts.FirstOrDefault(l => l.Item1 == lift.Name)?.Item2);

                var history = liftHistory.Where(lh => lh.Item1 == lift.Name)
                              .Select(lh => Tuple.Create(lh.Item2, lh.Item3));
                lift.StayAway = ShowStayAway(lift) ? true : await AnomalyDetector.SlowChairliftAsync(history);
            }

            return(lifts);
        }
Ejemplo n.º 5
0
        private void buttonDetectAnomalies_Click(object sender, EventArgs e)
        {
            List <Anomaly> anomalies_dbcc      = AnomalyDetector.detectAnomaliesWithData();
            List <Anomaly> anomalies_structure = AnomalyDetector.detectAnomaliesWithNoData();


            string output_log = "";

            output_log += "**********ANOMALY in DATA***********\n";

            foreach (var item in anomalies_dbcc)
            {
                // string extra_summary = Trigger.getExtraSummary(item.object_id);

                output_log += "\n***Anomalía del objeto " + item.object_id + ": \n" + item.summary; // + "\n" + extra_summary + "\n";
            }

            output_log += "\n\n**********ANOMALY STRUCTURE*************\n";
            foreach (var item in anomalies_structure)
            {
                output_log += "\n***Anomalía structure in " + item.object_id + ": \n" + item.summary;
            }

            MyFileManager.writeTXT(output_log, "D://LOG_AUDITORIA_FULL_ANOMALIAS.txt");

            if (anomalies_dbcc.Count + anomalies_structure.Count > 0)
            {
                output_log += "\n\nLOG GENERADO CON ANOMALÍAS en D://AUDITORIA_LOG_.txt";
            }
            else
            {
                output_log += "\n\nNO SE DETECTARON ANOMALÍAS";
            }

            this.richTextBox1.Text = output_log;
        }
Ejemplo n.º 6
0
 static public void RecreateObjectReferences()
 {
     dataLoader       = new DHTDataLoader(LocalWebServerUrl);
     anomalyDetector  = new AnomalyDetector(TempMean, TempStdDev, HumMean, HumStdDev);
     machineConnector = new MachineConnector($"{InteractionWebServerUrl}");
 }