public async void LoadVaccineData() { Status = "Loading Vaccine Data"; // Step 1: select folder for vaccine data //Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; var picker = new Windows.Storage.Pickers.FolderPicker(); picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Desktop; picker.FileTypeFilter.Add("*"); var vaccineFolder = await picker.PickSingleFolderAsync(); if (vaccineFolder != null) { Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.AddOrReplace("VaccineFolder", vaccineFolder); } else { return; } // Step 2: suck in all the data var vaccineFiles = await vaccineFolder.GetFilesAsync(); foreach (StorageFile file in vaccineFiles) { // Suck in the data and add it to the list string vaccineData = await Windows.Storage.FileIO.ReadTextAsync(file); var vaccineDay = JsonConvert.DeserializeObject<VaccineSet>(vaccineData); if(vaccineDay != null) { vaccineDay.VaccineSetDate = vaccineDay.VaccineDay?.First()?.DataDate!= null ? vaccineDay.VaccineDay.First().DataDate : DateTime.Now; RawVaccineData.Add(vaccineDay); } } //Step 3: Organize the data into state info StateVaccineData.Clear(); var stateBaseInfo = StatesConstants.GetStatesList().Concat(StatesConstants.GetVaccineExtrasList()); foreach (StateBase sb in stateBaseInfo) { var newState = new VaccineState(sb); foreach (VaccineSet vs in RawVaccineData) { var vaccineDay = vs.VaccineDay.First(vd => vd.StateCode.ToString().ToLower() == newState.StateBase.Code.ToString().ToLower()); newState.VaccineData.Add(new VaccineDay(vaccineDay)); } StateVaccineData.Add(newState); } StateVaccineData = PerformStateVaccineSortByRegion(StateVaccineData); }
public ProcessedVaccine(VaccineState coreState) { CoreVaccineStateData = coreState; OutputFiles = new Dictionary <string, List <CalculatedValue> >(); }