public async Task <OutcomeViewModel> DispositionBuilder(OutcomeViewModel model, DosEndpoint?endpoint) { model.DispositionTime = DateTime.Now; if (OutcomeGroup.Call999.Equals(model.OutcomeGroup)) { model.CareAdviceMarkers = model.State.Keys.Where(key => key.StartsWith("Cx")); } if (!String.IsNullOrEmpty(model.SymptomDiscriminatorCode)) { model.SymptomDiscriminator = await GetSymptomDiscriminator(model.SymptomDiscriminatorCode); } var pathways = _journeyHistoryWrangler.GetPathwayNumbers(model.Journey.Steps); if (pathways.Length > 0) { model.SymptomGroup = await GetSymptomGroup(pathways); } if (OutcomeGroup.ClinicianCallBack.Equals(model.OutcomeGroup)) { //hard code SD and SG codes to fix DOS for Yorkshire region //TODO: Fix this in DOS and remove this hack model.SymptomDiscriminatorCode = "4193"; model.SymptomGroup = "1206"; } if (OutcomeGroup.PrePopulatedDosResultsOutcomeGroups.Contains(model.OutcomeGroup) && !String.IsNullOrEmpty(model.CurrentPostcode)) { model = await PopulateGroupedDosResults(model, null, null, endpoint); } model.WorseningCareAdvice = await _careAdviceBuilder.FillWorseningCareAdvice(model.UserInfo.Demography.Age, model.UserInfo.Demography.Gender); model.CareAdvices = await _careAdviceBuilder.FillCareAdviceBuilder(model.Id, new AgeCategory(model.UserInfo.Demography.Age).Value, model.UserInfo.Demography.Gender, _keywordCollector.ConsolidateKeywords(model.CollectedKeywords).ToList()); model.SurveyLink = await _surveyLinkViewModelBuilder.SurveyLinkBuilder(model); return(model); }
public async Task <OutcomeViewModel> DispositionBuilder(OutcomeViewModel model, DosEndpoint?endpoint) { model.DispositionTime = DateTime.Now; Task <SymptomDiscriminator> discriminatorTask = null; Task <string> symptomGroupTask = null; if (model.OutcomeGroup.IsCoronaVirusCallback) { //hard code SD and SG codes for covidpathway //TODO: Fix this in Pathways and remove this hack model.SymptomDiscriminatorCode = "8001"; model.SymptomGroup = "8000"; } else if (OutcomeGroup.ClinicianCallBack.Equals(model.OutcomeGroup)) { //hard code SD and SG codes to fix DOS for Yorkshire region //TODO: Fix this in DOS and remove this hack model.SymptomDiscriminatorCode = "4193"; model.SymptomGroup = "1206"; } else { if (!string.IsNullOrEmpty(model.SymptomDiscriminatorCode)) { discriminatorTask = GetSymptomDiscriminator(model.SymptomDiscriminatorCode); } var pathways = _journeyHistoryWrangler.GetPathwayNumbers(model.Journey.Steps); if (pathways.Any()) { symptomGroupTask = GetSymptomGroup(pathways); } if (discriminatorTask != null) { model.SymptomDiscriminator = await discriminatorTask; } if (symptomGroupTask != null) { model.SymptomGroup = await symptomGroupTask; } } var dosTask = Task.FromResult(model); if (OutcomeGroup.PrePopulatedDosResultsOutcomeGroups.Contains(model.OutcomeGroup) && !string.IsNullOrEmpty(model.CurrentPostcode)) { dosTask = PopulateGroupedDosResults(model, null, null, endpoint); } var worseningTask = Task.FromResult(model.WorseningCareAdvice); if (!model.WorseningCareAdvice.Items.Any()) { worseningTask = _careAdviceBuilder.FillWorseningCareAdvice(model.UserInfo.Demography.Age, model.UserInfo.Demography.Gender); } var careAdvicesTask = Task.FromResult(model.CareAdvices); if (!model.CareAdvices.Any()) { var ageGroup = new AgeCategory(model.UserInfo.Demography.Age).Value; var careAdviceKeywords = _keywordCollector.ConsolidateKeywords(model.CollectedKeywords).ToList(); careAdvicesTask = _careAdviceBuilder.FillCareAdviceBuilder(model.Id, ageGroup, model.UserInfo.Demography.Gender, careAdviceKeywords); } model = await dosTask; if (OutcomeGroup.Call999Cat1.Equals(model.OutcomeGroup) || OutcomeGroup.Call999Cat2.Equals(model.OutcomeGroup) || OutcomeGroup.Call999Cat3.Equals(model.OutcomeGroup)) { model.CareAdviceMarkers = model.State.Keys.Where(key => key.StartsWith("Cx")); } if (model.Is999Callback) { model.HasAcceptedCallbackOffer = true; } var surveyTask = _surveyLinkViewModelBuilder.SurveyLinkBuilder(model); model.WorseningCareAdvice = await worseningTask; model.CareAdvices = await careAdvicesTask; model.SurveyLink = await surveyTask; return(model); }