/// <summary> /// Initializes a new instance of the /// <a onclick="return false;" href="Covid19DailyData" originaltag="see">Covid19DailyData</a> class. /// </summary> /// <param name="dataDate">The data date.</param> /// <param name="state">The state.</param> /// <param name="positiveIncrease">The positive increase.</param> /// <param name="negativeIncrease">The negative increase.</param> /// <param name="deathIncrease">The death increase.</param> /// <param name="hospitalizedIncrease">The hospitalized increase.</param> public Covid19DailyData(DateTime dataDate, StateAbbreviations state, int positiveIncrease, int negativeIncrease, int deathIncrease, int hospitalizedIncrease) { this.DataDate = dataDate; this.State = state; this.PositiveIncrease = positiveIncrease; this.NegativeIncrease = negativeIncrease; this.DeathIncrease = deathIncrease; this.HospitalizedIncrease = hospitalizedIncrease; }
/// <summary> /// Return a List of data from the specified state /// </summary> /// <param name="state"></param> /// <returns></returns> public List <Covid19DailyData> GetDataFromState(StateAbbreviations state) { var aStateCollection = new List <Covid19DailyData>(); foreach (var currDailyData in this.Covid19Data) { if (currDailyData.State == StateAbbreviations.GA) { aStateCollection.Add(currDailyData); } } //TODO get get of hardcoded reference to GA return(aStateCollection); }
private void statesComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var selectedState = this.statesComboBox.SelectedValue; if (selectedState == null || this.covidDataAssembler == null) { return; } var selectedStateConverted = Enum.Parse <StateAbbreviations>(selectedState.ToString()); State = selectedStateConverted; this.covidDataAssembler.StateFilter = selectedState.ToString(); this.updateCovidData(); this.noRecordsForThatState(); }
/// <summary> /// Format the overall data from the selected state to be displayed /// </summary> /// <param name="state"></param> /// <returns></returns> public string FormatStateData(StateAbbreviations state) { var stateDataCalculations = new StateDataCalculations(this.Covid19Data); var stateData = state + ": " + Environment.NewLine; stateData += $"First Positive Test occurred on {stateDataCalculations.DateOfFirstPositive().ToShortDateString()}\n"; var highestPos = stateDataCalculations.DataWithHighestNumberOfPositives(); stateData += $"Highest Number of Positive Tests: {highestPos.PositiveIncrease:n0} occurred on {highestPos.DataDate.ToShortDateString()}\n"; var highestNeg = stateDataCalculations.DataWithHighestNumberOfNegatives(); stateData += $"Highest Number of Negative Tests: {highestNeg.NegativeIncrease:n0} occurred on {highestNeg.DataDate.ToShortDateString()}\n"; var highestTests = stateDataCalculations.DataWithHighestNumberTests(); stateData += $"Highest Number of Tests: {highestTests.TotalTest:n0} occurred on {highestTests.DataDate.ToShortDateString()}\n"; var highestDeaths = stateDataCalculations.DataWithHighestNumberDeaths(); stateData += $"Highest Number of Deaths: {highestDeaths.DeathIncrease:n0} occurred on {highestDeaths.DataDate.ToShortDateString()}\n"; var highestHospital = stateDataCalculations.DataWithHighestHospitalization(); stateData += $"Highest Number of Hospitalizations: {highestHospital.HospitalizedIncrease:n0} occurred on {highestHospital.DataDate.ToShortDateString()}\n"; var highestPercent = stateDataCalculations.DataWithHighestPercentPos(); stateData += $"Highest Percentage Positive Tests: {highestPercent.FindPercentPositive()}% occurred on {highestPercent.DataDate.ToShortDateString()}\n"; stateData += $"Average number of Positive Tests: {stateDataCalculations.AverageNumberPositiveSinceFirst():n2}\n"; stateData += $"Positivity Rate of all Tests: {stateDataCalculations.FindPositivityRate():n2}% \n"; stateData += $"Number of Days with positives tests greater than {this.UpperThreshold}: {stateDataCalculations.NumberOfDaysWithPositivesGreaterThan(this.UpperThreshold):n0}\n"; stateData += $"Number of Days with positives tests less than {this.LowerThreshold}: {stateDataCalculations.NumberOfDaysWithPositiveLessThan(this.LowerThreshold):n0}\n"; stateData += "BreakDown of Positive Cases: " + Environment.NewLine + formatPositiveCaseBreakdown(stateDataCalculations); return(stateData); }
/// <summary> /// Initializes a new instance of the /// <a onclick="return false;" href="CovidDataAssembler" originaltag="see">CovidDataAssembler</a> class. /// <para>By default the filter is set to GA</para> /// <para>If stateFilter is empty then all states represented in the table will be represented</para> /// <code>Postcondition: StateFilter == stateFilter AND Summary == null AND IsCovidDataLoaded == false</code> /// </summary> /// <param name="stateFilter">The state filter.</param> public CovidDataAssembler(StateAbbreviations stateFilter) { this.StateFilter = Enum.GetName(typeof(StateAbbreviations), stateFilter); this.Reset(); }