private string getLowestCurrentlyHospitalizedWithDays(IEnumerable <CovidRecord> collection) { var daysOutput = string.Empty; string lowestCurrentlyHospitalized; try { var covidRecords = collection.ToArray(); var firstDateOfPositiveTest = this.getDateOfFirstPositiveTest(); var lowestHospitalizedCurrently = this.covidStatistics .FindRecordWithLowestCurrentHospitalizations( firstDateOfPositiveTest).HospitalizedCurrently; var daysOccurred = (from record in covidRecords where record.HospitalizedCurrently == lowestHospitalizedCurrently select record.Date) .ToList(); daysOutput = Format.GetListOfDaysWithOrdinals(daysOccurred); lowestCurrentlyHospitalized = Format.FormatIntegerAsFormattedString(lowestHospitalizedCurrently); } catch (Exception) { lowestCurrentlyHospitalized = Assets.NoPositiveData; } return(CovidDataLines.GetCovidLineForValueAndDaysOfMonth(Assets.LowestCurrentHospitalizationsLabel, lowestCurrentlyHospitalized, daysOutput)); }
/// <Summary>Gets the highest deaths with date.</Summary> /// <returns>A formatted string with the highest deaths test and date</returns> public string GetHighestDeathsWithDate() { var highestDeathsRecord = this.covidStatistics.FindRecordWithHighestDeaths(); var highestDeaths = Format.FormatIntegerAsFormattedString(highestDeathsRecord.Deaths); var date = highestDeathsRecord.Date.ToString(Assets.DateStringFormatted); return(CovidDataLines.GetCovidLineForValueAndDate(Assets.HighestDeathsLabel, highestDeaths, date)); }
/// <Summary>Gets the highest positive with date.</Summary> /// <returns>A formatted string with the highest positive test and date</returns> public string GetHighestPositiveWithDate() { var highestPositiveRecord = this.covidStatistics.FindRecordWithHighestPositiveCases(); var highestPositive = Format.FormatIntegerAsFormattedString(highestPositiveRecord.PositiveTests); var date = highestPositiveRecord.Date.ToString(Assets.DateStringFormatted); return(CovidDataLines.GetCovidLineForValueAndDate(Assets.HighestPositiveTestsLabel, highestPositive, date)); }
/// <summary>Gets the highest current hospitalizations with date.</summary> /// <returns>A formatted string with the highest current hospitalizations</returns> public string GetHighestCurrentHospitalizationsWithDate() { var highestCurrentHospitalizationsRecord = this.covidStatistics.FindRecordWithHighestCurrentHospitalizations(); var highestCurrentHospitalizations = Format.FormatIntegerAsFormattedString(highestCurrentHospitalizationsRecord.HospitalizedCurrently); var date = highestCurrentHospitalizationsRecord.Date.ToString(Assets.DateStringFormatted); return(CovidDataLines.GetCovidLineForValueAndDate(Assets.HighestCurrentHospitalizationsLabel, highestCurrentHospitalizations, date)); }
private string getHighestTotalTestsWithDays(IEnumerable <CovidRecord> collection) { var covidRecords = collection.ToArray(); var highestTotalTests = this.covidStatistics.FindRecordWithHighestTotalTests().TotalTests; var daysOccurred = (from record in covidRecords where record.TotalTests == highestTotalTests select record.Date).ToList(); var daysOutput = Format.GetListOfDaysWithOrdinals(daysOccurred); var highestTotalTestsFormatted = Format.FormatIntegerAsFormattedString(highestTotalTests); return(CovidDataLines.GetCovidLineForValueAndDaysOfMonth(Assets.HighestTotalTestsLabel, highestTotalTestsFormatted, daysOutput)); }
/// <Summary>Gets the Overall Positivity Rate.</Summary> /// <returns>A formatted string with the Overall Positivity Rate.</returns> public string GetOverallPositivityRateSinceFirstPositiveTest() { string positivityRate; try { var overallPositivityRate = this.covidStatistics.FindOverallPositivityRateSinceFirstPositiveTest(); positivityRate = Format.FormatNumericValueAsPercentage(overallPositivityRate); } catch (Exception) { positivityRate = Assets.NoPositiveData; } return(CovidDataLines.GetCovidLineForValue(Assets.OverallPositivityRateLabel, positivityRate)); }
/// <Summary>Gets the average positive tests.</Summary> /// <returns>A formatted string with the average positive test.</returns> public string GetAveragePositiveTestsSinceFirstPositiveTest() { string average; try { var averagePositiveTest = this.covidStatistics.FindAveragePositiveTestsSinceFirstPositiveTest(); average = Format.FormatAveragesWithTwoDecimalPlaces(averagePositiveTest); } catch (Exception) { average = Assets.NoPositiveData; } return(CovidDataLines.GetCovidLineForValue(Assets.AveragePositiveTestsLabel, average)); }
private string getHighestCurrentlyHospitalizedWithDays(IEnumerable <CovidRecord> collection) { var covidRecords = collection.ToArray(); var highestHospitalizedCurrently = this.covidStatistics.FindRecordWithHighestCurrentHospitalizations() .HospitalizedCurrently; var daysOccurred = (from record in covidRecords where record.HospitalizedCurrently == highestHospitalizedCurrently select record.Date).ToList(); var daysOutput = Format.GetListOfDaysWithOrdinals(daysOccurred); var highestPositivesFormatted = Format.FormatIntegerAsFormattedString(highestHospitalizedCurrently); return(CovidDataLines.GetCovidLineForValueAndDaysOfMonth(Assets.HighestCurrentHospitalizationsLabel, highestPositivesFormatted, daysOutput)); }
private string getAverageTotalTests() { string totalTestsAverageFormatted; try { var firstPositiveTestDate = this.getDateOfFirstPositiveTest(); var totalTestsAverage = this.covidStatistics.FindAverageTotalTestsSinceSpecifiedDate(firstPositiveTestDate); totalTestsAverageFormatted = Format.FormatAveragesWithTwoDecimalPlaces(totalTestsAverage); } catch (Exception) { totalTestsAverageFormatted = Assets.NoPositiveData; } return(CovidDataLines.GetCovidLineForValue(Assets.AverageTotalTestsLabel, totalTestsAverageFormatted)); }
private string getAveragePositiveTests() { string positiveAverageFormatted; try { var dateSinceFirstPositiveTests = this.getDateOfFirstPositiveTest(); var positiveAverage = this.covidStatistics.FindAveragePositiveTestsSinceSpecifiedDate(dateSinceFirstPositiveTests); positiveAverageFormatted = Format.FormatAveragesWithTwoDecimalPlaces(positiveAverage); } catch (Exception) { positiveAverageFormatted = Assets.NoPositiveData; } return(CovidDataLines.GetCovidLineForValue(Assets.AveragePositiveTestsLabel, positiveAverageFormatted)); }
/// <Summary>Gets the highest percentage of positive tests with date.</Summary> /// <returns>A formatted string with the highest percentage of positive test and date</returns> public string GetHighestPercentageOfTestsPerDayWithDate() { string highestPercentage; var date = string.Empty; try { var highestPercentageRecord = this.covidStatistics.FindRecordWithHighestPercentageOfPositiveTests(); var positivePercentage = CovidDataStatistics.FindPositivePercentageForRecord(highestPercentageRecord); highestPercentage = Format.FormatNumericValueAsPercentage(positivePercentage); date = highestPercentageRecord.Date.ToString(Assets.DateStringFormatted); } catch (Exception) { highestPercentage = Assets.NoPositiveData; } return(CovidDataLines.GetCovidLineForValueAndDate(Assets.HighestPercentageOfPositiveCasesLabel, highestPercentage, date)); }
/// <Summary>Gets the Days less than a threshold.</Summary> /// <returns>A formatted string with the days less than a threshold.</returns> public string GetTheDaysFromTheFirstPositiveTestLessThanThreshold(int threshold) { string thresholdFormatted; var days = string.Empty; try { var daysLessThanThreshold = this.covidStatistics.FindNumberOfDaysForPositiveTestsLessThanThreshold(threshold); days = Format.FormatIntegerAsFormattedString(daysLessThanThreshold); thresholdFormatted = Format.FormatIntegerAsFormattedString(threshold); } catch (Exception) { thresholdFormatted = Assets.NoPositiveData; } return(CovidDataLines.GetCovidLineForValueWithThreshold(Assets.DaysLessThanValueLabel, days, thresholdFormatted)); }