public App.SmitteStop.Domain.Db.CovidStatistics BuildStatistics(CovidStatisticsCsvContent inputData) { _inputData = inputData; _statistics = new App.SmitteStop.Domain.Db.CovidStatistics { ConfirmedCasesToday = CalculateConfirmedToday(), ConfirmedCasesTotal = CalculateConfirmedTotal(), TestsConductedToday = CalculateTestedToday(), TestsConductedTotal = CalculateTestedTotal(), PatientsAdmittedToday = CalculateAdmittedToday(), PatientsAdmittedTotal = CalculateAdmittedTotal(), IcuAdmittedToday = CalculateIcuAdmittedToday(), IcuAdmittedTotal = CalculateIcuAdmittedTotal(), VaccinatedFirstDoseTotal = CalculateVaccinatedFirstDoseTotal(), VaccinatedFirstDoseToday = CalculateVaccinatedFirstDoseToday(), VaccinatedSecondDoseTotal = CalculateVaccinatedSecondDoseTotal(), VaccinatedSecondDoseToday = CalculateVaccinatedSecondDoseToday(), DeathsCasesTotal = DeathsCasesTotal(), ModificationDate = DateTime.UtcNow, EntryDate = _dateTimeResolver.GetDateTime().Date, }; return(_statistics); }
private void HandleDataMissing() { if (_dateTimeResolver.GetDateTime().Hour < _config.MakeAlertIfDataIsMissingAfterHour) { _logger.LogInformation(CovidStatisticsFileMissingOnServerException.DataMissingInfoMessage); } else { _logger.LogError(CovidStatisticsFileMissingOnServerException.DataMissingErrorMessage); throw new CovidStatisticsFileMissingOnServerException(); } }