/// <summary> /// Returns personalized recommendation for given weather/alert/appChain results /// </summary> /// <param name="weatherCondition"></param> /// <param name="weatherAlertCode"></param> /// <param name="acr"></param> /// <returns></returns> public string GetPersonalizedRiskDescription(string weatherCondition, string weatherAlertCode, AppChainResults acr, string userName, int appId) { var currentDate = DateTime.Now.Date; ForecastRequest[] request = new ForecastRequest[] { new ForecastRequest { date = currentDate, alertCode = weatherAlertCode, weather = weatherCondition } }; var _s = new PersonalizedRecommendationsWorker().GetRecommendation(request, acr, userName, appId); if (_s != null) { return(_s[0].gtForecast); } return ("Personalization is not possible due to insufficient genetic data in the selected file. Choose a different genetic data file."); }
public JsonResult GetForecast(ForecastRetrieveDTO forecastDTO) { GenericResponse responseObj = null; int timeStart = DateTime.Now.TimeOfDay.Seconds; try { string userName = new AuthWorker(Options.OAuthUrl, Options.OAuthRedirectUrl, Options.OAuthSecret, Options.OAuthAppId).GetUserInfo(forecastDTO.authToken).username; if(userName == null) throw new Sequencing.WeatherApp.Controllers.DaoLayer.ApplicationException(string.Format("Invalid access token {0}", forecastDTO.authToken)); AppChainResults acr = new AppChainResults { MelanomaAppChainResult = forecastDTO.melanomaRisk, VitDAppChainResult = forecastDTO.vitaminD }; var _s = new PersonalizedRecommendationsWorker().GetRecommendation(forecastDTO.forecastRequest, acr, userName, forecastDTO.appId); responseObj = new GenericResponse() { Status = 0, ResponseTime = DateTime.Now.TimeOfDay.Seconds - timeStart, Message = "Genetically tailored forecast successfully retrieved", Data = _s, }; return Json(responseObj, JsonRequestBehavior.AllowGet); } catch (Exception e) { responseObj = new GenericResponse() { Status = 1, ResponseTime = DateTime.Now.TimeOfDay.Milliseconds - timeStart, Message = e.Message, Data = "Personalization is not possible due to insufficient genetic data in the selected file. Choose a different genetic data file.", }; ExternalSettingsController.ResponseLogging(responseObj); return Json(responseObj, JsonRequestBehavior.AllowGet); } }
/// <summary> /// Returns personalized recommendation for given weather/alert/appChain results /// </summary> /// <param name="weatherCondition"></param> /// <param name="weatherAlertCode"></param> /// <param name="acr"></param> /// <returns></returns> public string GetPersonalizedRiskDescription(string weatherCondition, string weatherAlertCode, AppChainResults acr, string userName, int appId) { var currentDate = DateTime.Now.Date ; ForecastRequest[] request = new ForecastRequest[] { new ForecastRequest { date = currentDate, alertCode = weatherAlertCode, weather = weatherCondition } }; var _s = new PersonalizedRecommendationsWorker().GetRecommendation(request, acr, userName, appId); if (_s != null) return _s[0].gtForecast; return "Personalization is not possible due to insufficient genetic data in the selected file. Choose a different genetic data file."; }