public void RegisterTypes(IContainerRegistry containerRegistry) { // Register any platform specific implementations DrugInteractionService drugInteractionService = new DrugInteractionService(GetCsvStream); containerRegistry.RegisterInstance(drugInteractionService); }
public void RegisterTypes(IContainerRegistry containerRegistry) { string filename = "CombinedDatasetConservativeTWOSIDES.csv"; FileInfo fileInfo = new FileInfo($"{Environment.CurrentDirectory}\\Assets\\{filename}"); // Register any platform specific implementations DrugInteractionService drugInteractionService = new DrugInteractionService(fileInfo.FullName); containerRegistry.RegisterInstance(drugInteractionService); }
private static void DrugDrugInteractionCheck(FileInfo fileInfo) { DrugInteractionService drugInteractionService = new DrugInteractionService(fileInfo.FullName); Console.WriteLine("Please enter your drug! (Be patient!)"); List <Drug> usedDrugs = new List <Drug>(); //user inputs used drugs while (true) { string line = Console.ReadLine(); line = line.ToLower(); if (String.IsNullOrEmpty(line)) { break; } Drug drug = drugInteractionService.FindDrug(line); if (drug == null) { Console.WriteLine($"Drug \"{line}\" not found or too many results, try a new one or abort by pressing enter."); } else { if (line == drug.Name) { usedDrugs.Add(drug); Console.WriteLine("Enter the next drug or Press Enter to finish. (Be patient!)"); } else { Console.WriteLine($"Did you mean {drug.Name}? [y/n]"); string yes = Console.ReadLine(); if ("y" == yes) { usedDrugs.Add(drug); Console.WriteLine("Enter the next drug or Press Enter to Finish. (Be patient!)"); } } } } Console.WriteLine("Drug Drug interaction check"); var taskWarnings = drugInteractionService.AreDrugsInteractingAsync(usedDrugs); while (!taskWarnings.IsCompleted) { Console.Write("."); } Console.WriteLine(""); //check drug interactions foreach (var warning in taskWarnings.Result) { Console.WriteLine(warning); } }
public AddMedicinePageViewModel( INavigationService navigationService, DrugService drugService, DrugInteractionService drugInteractionService, IDialogService dialogService, IPageDialogService pageDialogService) : base(navigationService) { _drugInteractionService = drugInteractionService; _dialogService = dialogService; _pageDialogService = pageDialogService; Title = "Add Medicine"; DrugService = drugService; AddMedicineCommand = new DelegateCommand(OnAddMedicineCommand); }