private void GenerateChart(Evaluation evaluation, string pivotCategoryValue) { _currentEvaluation = evaluation; chart1.Visible = false; var dt = PeriodicityState.GetPeriodicityForDataTableForEvaluation(evaluation, pivotCategoryValue, true); if (dt == null) { ClearGraph(); chart1.Visible = true; return; } chart1.DataSource = dt; dataGridView1.DataSource = dt; chart1.Series.Clear(); if (dt.Rows.Count != 0) { _chartLookAndFeelSetter.PopulateYearMonthChart(chart1, dt, "Data Quality"); } chart1.DataBind(); chart1.Visible = true; ReGenerateAnnotations(); }
public PeriodicityCube(int year, int month) { _passingValidation = new PeriodicityState(year, month, null); _consequenceCube.Add(Consequence.Missing, new PeriodicityState(year, month, Consequence.Missing)); _consequenceCube.Add(Consequence.Wrong, new PeriodicityState(year, month, Consequence.Wrong)); _consequenceCube.Add(Consequence.InvalidatesRow, new PeriodicityState(year, month, Consequence.InvalidatesRow)); }
public void TestGetPeriodicityForDataTableForEvaluation_EmptyEvaluation(bool pivot) { var cata = new Catalogue(CatalogueRepository, "MyCata"); var dqeRepo = new DQERepository(CatalogueRepository); var eval = new Evaluation(dqeRepo, cata); var dt = PeriodicityState.GetPeriodicityForDataTableForEvaluation(eval, "ALL", pivot); Assert.IsNull(dt); }
public void GetPeriodicityCountsForEvaluation_EmptyEvaluation() { var cata = new Catalogue(CatalogueRepository, "MyCata"); var dqeRepo = new DQERepository(CatalogueRepository); var eval = new Evaluation(dqeRepo, cata); var dict = PeriodicityState.GetPeriodicityCountsForEvaluation(eval, true); Assert.IsNotNull(dict); Assert.IsEmpty(dict); }
public void GenerateChart() { ragSmiley1.Reset(); ragSmiley1.SetVisible(false); var allCatalogues = _collection.GetCatalogues(); Dictionary <Catalogue, Dictionary <DateTime, ArchivalPeriodicityCount> > cataloguesToAdd = new Dictionary <Catalogue, Dictionary <DateTime, ArchivalPeriodicityCount> >(); DQERepository dqeRepository; try { dqeRepository = new DQERepository(_activator.RepositoryLocator.CatalogueRepository); } catch (NotSupportedException e) { ragSmiley1.SetVisible(true); ragSmiley1.Fatal(e); return; } foreach (var cata in allCatalogues.OrderBy(c => c.Name)) { var eval = dqeRepository.GetMostRecentEvaluationFor(cata); Dictionary <DateTime, ArchivalPeriodicityCount> dictionary = null; if (eval != null) { dictionary = PeriodicityState.GetPeriodicityCountsForEvaluation(eval); } cataloguesToAdd.Add(cata, dictionary); } //every month seen in every dataset ever var buckets = GetBuckets(cataloguesToAdd); racewayRenderArea.AddTracks(_activator, cataloguesToAdd, buckets, _collection.IgnoreRows); racewayRenderArea.Refresh(); this.Invalidate(); }
public Tuple <DateTime?, DateTime?> GetMachineReadableTimespanIfKnownOf(Evaluation evaluation, bool discardOutliers) { var dt = PeriodicityState.GetPeriodicityForDataTableForEvaluation(evaluation, "ALL", false); if (dt == null || dt.Rows.Count < 2) { return(Unknown()); } int discardThreshold = discardOutliers ? GetDiscardThreshold(dt) : -1; DateTime?minMonth = null; for (int i = 0; i < dt.Rows.Count; i++) { if (Convert.ToInt32(dt.Rows[i]["CountOfRecords"]) > discardThreshold) { minMonth = DateTime.Parse(dt.Rows[i][1].ToString()); break; } } DateTime?maxMonth = null; for (int i = dt.Rows.Count - 1; i >= 0; i--) { if (Convert.ToInt32(dt.Rows[i]["CountOfRecords"]) > discardThreshold) { maxMonth = DateTime.Parse(dt.Rows[i][1].ToString()); break; } } if (maxMonth == null || minMonth == null) { return(Unknown()); } return(Tuple.Create(minMonth, maxMonth)); }
public Tuple <DateTime?, DateTime?> GetMachineReadableTimepsanIfKnownOf(Catalogue catalogue, bool discardOutliers, out DateTime?accurateAsOf) { DataTable dt; accurateAsOf = null; Evaluation mostRecentEvaluation = null; try { var repo = new DQERepository(catalogue.CatalogueRepository); mostRecentEvaluation = repo.GetMostRecentEvaluationFor(catalogue); } catch (Exception) { return(Unknown()); } if (mostRecentEvaluation == null) { return(Unknown()); } accurateAsOf = mostRecentEvaluation.DateOfEvaluation; dt = PeriodicityState.GetPeriodicityForDataTableForEvaluation(mostRecentEvaluation, "ALL", false); if (dt == null || dt.Rows.Count < 2) { return(Unknown()); } int discardThreshold = discardOutliers? GetDiscardThreshold(dt):-1; DateTime?minMonth = null; for (int i = 0; i < dt.Rows.Count; i++) { if (Convert.ToInt32(dt.Rows[i]["CountOfRecords"]) > discardThreshold) { minMonth = DateTime.Parse(dt.Rows[i][1].ToString()); break; } } DateTime?maxMonth = null; for (int i = dt.Rows.Count - 1; i >= 0; i--) { if (Convert.ToInt32(dt.Rows[i]["CountOfRecords"]) > discardThreshold) { maxMonth = DateTime.Parse(dt.Rows[i][1].ToString()); break; } } if (maxMonth == null || minMonth == null) { return(Unknown()); } if (maxMonth == minMonth) { return(Tuple.Create(minMonth, minMonth)); } return(Tuple.Create(minMonth, maxMonth)); }
/// <inheritdoc/> public string GetHumanReadableTimepsanIfKnownOf(Catalogue catalogue, bool discardOutliers) { DataTable dt; try { var repo = new DQERepository(catalogue.CatalogueRepository); Evaluation mostRecentEvaluation = repo.GetMostRecentEvaluationFor(catalogue); if (mostRecentEvaluation == null) { return("Unknown"); } dt = PeriodicityState.GetPeriodicityForDataTableForEvaluation(mostRecentEvaluation, "ALL", false); } catch (Exception e) { return("Unknown:" + e.Message); } if (dt == null || dt.Rows.Count < 2) { return("Unknown"); } int discardThreshold = discardOutliers? GetDiscardThreshold(dt):-1; string minMonth = null; for (int i = 0; i < dt.Rows.Count; i++) { if (Convert.ToInt32(dt.Rows[i]["CountOfRecords"]) > discardThreshold) { minMonth = dt.Rows[i][1].ToString(); break; } } string maxMonth = null; for (int i = dt.Rows.Count - 1; i >= 0; i--) { if (Convert.ToInt32(dt.Rows[i]["CountOfRecords"]) > discardThreshold) { maxMonth = dt.Rows[i][1].ToString(); break; } } if (maxMonth == null || minMonth == null) { return("All Values Below Threshold"); } if (maxMonth == minMonth) { return(minMonth); } return(minMonth + " To " + maxMonth); }