public BomRainFallService(IBomDataCollection bomDataCollection, IYearlyDataProvider yearlyDataProvider, ILogger <BomRainFallService> logger) { _bomDataCollection = bomDataCollection;// TODO removed _yearlyDataProvider = yearlyDataProvider; _logger = logger; }
public async Task <IBomDataCollection> ReadDataAsync(string path, AllowedFileExtensionEnum fileType) { IBomDataCollection weatherBomData = default; switch (fileType) { case AllowedFileExtensionEnum.CSV: weatherBomData = await _csvClient.GetCsvDataAsync(path); break; } return(weatherBomData); }
public async Task <WeatherBomData> GetRainFallJsonDataAsync(IBomDataCollection bomDataCollection) { _logger.LogDebug("GetRainFallJsonData invoked"); var yearlyBomDataViewModel = new ConcurrentBag <WeatherDataForYear>(); await Task.WhenAll(bomDataCollection.BomData.Select(bomData => bomData.Year).Distinct()?.Select(year => Task.Run( async() => { _logger.LogDebug($"Service invoked for {year}"); var filterYearData = GetFilteredYearData(bomDataCollection.BomData, year); var yearlyModel = await _yearlyDataProvider.GetYearlyBomDataAsync(year, filterYearData); yearlyBomDataViewModel.Add(yearlyModel); }))); return(new WeatherBomData() { WeatherData = new WeatherData() { WeatherDataForYear = yearlyBomDataViewModel } }); }
public YearlyDataProvider(IBomDataCollection bomDataCollection, IMonthlyDataProvider monthlyDataProvider, ILogger <YearlyDataProvider> logger) { _monthlyDataProvider = monthlyDataProvider; _logger = logger; }