void PopulateFunctionPredictions(PatientOutcomesResults r, DateTime rpDate) { if (r == null) { return; } DateTime today = DateTime.Today; Func <double?, string> s = d => d.HasValue ? (Math.Round(d.Value, 0).ToString() + "%") : "N/A"; List <string> efPredictions = new List <string>(); List <string> ufPredictions = new List <string>(); //if (rpDate.AddMonths(3) > today) { efPredictions.Add(string.Format("{0}: {1}", 3, s(r.ErectileRate1YearBasedOn3Month))); ufPredictions.Add(string.Format("{0}: {1}", 3, s(r.UrinaryRate1YearBasedOn3Month))); } //if (rpDate.AddMonths(6) > today) { efPredictions.Add(string.Format("{0}: {1}", 6, s(r.ErectileRate1YearBasedOn6Month))); ufPredictions.Add(string.Format("{0}: {1}", 6, s(r.UrinaryRate1YearBasedOn6Month))); } //if (rpDate.AddMonths(9) > today) { efPredictions.Add(string.Format("{0}: {1}", 9, s(r.ErectileRate1YearBasedOn9Month))); ufPredictions.Add(string.Format("{0}: {1}", 9, s(r.UrinaryRate1YearBasedOn9Month))); } if (efPredictions.Count > 0) { EFPrediction.Text = string.Join(", ", efPredictions.ToArray()); } else { EFPredictionLabel.Visible = false; EFPredictionBullet.Visible = false; } if (ufPredictions.Count > 0) { UFPrediction.Text = string.Join(", ", ufPredictions.ToArray()); } else { UFPredictionLabel.Visible = false; UFPredictionBullet.Visible = false; } }
protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); // patient header PatientMRN = patientMRN; PatientDisplayName = (patientFirstName ?? "") + " " + (patientLastName ?? ""); AppointmentDate = DateTime.Now; DataView prostateQOLResults = ReportDa.GetProstateQOLResults(patientID); if (prostateQOLResults.Count > 0) { patientHadRP = true; DateTime rpDate = AnalyzePatientHistory(prostateQOLResults); DataTable surveys = AnalyzeSurveys(patientID, rpDate); // TODO: handle expected outcomes // if (weHaveDataForOutcomes) { showAdditionalSeries(...); } PatientOutcomesServiceAdapter outcomesAdapter = new PatientOutcomesServiceAdapter(Request.PhysicalApplicationPath); PatientOutcomesResults results = outcomesAdapter.GetPatientOutcomes(patientID); outcomesAdapter.AddErectileOutcomesToChart(EFChart, results); outcomesAdapter.AddUrinaryOutcomesToChart(UFChart, results); // ef/uf "survival" predictions PopulateFunctionPredictions(results, rpDate); HandleAlerts(); if (LastSurveyDate.HasValue && surveys.Rows.Count > 0) { showSurveyResponses = true; LastSurveyIsBaseline = LastSurveyDate.Value <= rpDate; GetRecentSurveyReponses(surveys); } PopulateNomogramScores(patientID, rpDate, results); RPDate = rpDate; } SetControlValues(); BuildQOLReportLabTests(); GetLastProblemPlans(); }
// populate nomo score labels void PopulateNomogramScores(int patientId, DateTime rpDate, PatientOutcomesResults r) { NomogramDa da = new NomogramDa(); Action <Label, Func <int, int, double>, int> nomocall = (lbl, f, yr) => { try { lbl.Text = ((int)Math.Round(f(patientId, yr), 0)).ToString() + " "; } catch { lbl.Text = "N/A"; } }; nomocall(Pre5Result, da.GetPreRPResult, 5); // nomocall(Post5Result, da.GetPostRPResult, 5); DateTime today = DateTime.Today; Post5Result.Text = r.NomogramPredictionBaseline.HasValue ? ((int)Math.Round(r.NomogramPredictionBaseline.Value, 0)) + " " : "N/A"; // output only relevant results if (rpDate.AddYears(2) > today) { //nomocall(Current2Result, da.GetPostRPResult, 2); Current2Result.Text = r.NomogramPrediction2Year.HasValue ? ((int)Math.Round(r.NomogramPrediction2Year.Value, 0)) + " " : "N/A"; } else { Show2Yr.Visible = false; } if (rpDate.AddYears(5) > today) { Current5Result.Text = r.NomogramPrediction5Year.HasValue ? ((int)Math.Round(r.NomogramPrediction5Year.Value, 0)) + " " : "N/A"; } else { Show5Yr.Visible = false; } if (rpDate.AddYears(7) > today) { //nomocall(Current7Result, da.GetPostRPResult, 7); Current7Result.Text = r.NomogramPrediction7Year.HasValue ? ((int)Math.Round(r.NomogramPrediction7Year.Value, 0)) + " " : "N/A"; } else { Show7Yr.Visible = false; } if (rpDate.AddYears(10) > today) { Current10Result.Text = r.NomogramPrediction10Year.HasValue ? ((int)Math.Round(r.NomogramPrediction10Year.Value, 0)) + " " : "N/A"; } else { Show10Yr.Visible = false; } }