public void PalliativeMortality(BE_Patient patientIn, Random rand) { if (rand.NextDouble() <= mortality) { patientIn.Die("Palliative"); } }
public void PostSurgeryMortality(BE_Patient patientIn, BE_Cycle cycleIn, Random rand) { int yearDifference = (cycleIn.ID - patientIn.SurgeryCycle) / 4; // Assumption: Cycle length is three months. double mortality = 0; if (patientIn.PreSurgeryStateName == "T1a") { mortality = postMortalityT1a[Math.Min(yearDifference, postMortalityT1a.Length - 1)]; } else if (patientIn.PreSurgeryStateName == "T1b") { mortality = postMortalityT1b[Math.Min(yearDifference, postMortalityT1b.Length - 1)]; } else if (patientIn.PreSurgeryStateName == "SC") { mortality = postMortalitySC[Math.Min(yearDifference, postMortalitySC.Length - 1)]; } else { Console.WriteLine(new System.ComponentModel.WarningException("Wrong PostSurgeryMortality!").Message); } if (rand.NextDouble() <= mortality) { patientIn.Die("PostSurgery"); } }
public void PerformSurgery(BE_Patient patientIn, BE_Cycle cycleIn, Random rand) { patientIn.Status = BE_PatientStatus.Surgery; patientIn.ActiveNaturalProgression = false; // When patients undergo surgery, they no longer move under natural progression probabilities. patientIn.ActiveRecurrenceProbability = false; // When patients undergo surgery, they no longer move under recurrence probabilities. patientIn.HasSurgery = true; // Assumption: Patient compliance is 100%. patientIn.PreSurgeryStateName = DeterminePreSurgeryStateName(patientIn, rand); // The pre-surgery state of the patient is recorded. patientIn.SurgeryCycle = cycleIn.ID; // The cycle in which the patient undergoes surgery is recorded. // Intervention history is added to the patient's records. patientIn.interventionHistory.Add(cycleIn.ID, BE_InterventionType.Surgery); // Cost is recorded on the patient, the surgery modality, and the cycle. patientIn.UpdateCost(costSurgery); this.UpdateCost(costSurgery); cycleIn.UpdateCost(costSurgery); // Surgery-related mortality. double mortality = 0; if (patientIn.ConfirmedState.Type == BE_StateType.IMC) { mortality = mortalityIMC; } else { mortality = mortalitySC; } if (rand.NextDouble() < mortality) { patientIn.Die("Surgery_Mortality"); return; // If the patient dies, the execution of this function is terminated. } // Surgery-related adverse events. if (rand.NextDouble() <= adverseEvent.Probability) { patientIn.adverseEventHistory.Add(cycleIn.ID, BE_AdverseEventType.Surgery); patientIn.UpdateCost(adverseEvent.Cost); this.UpdateCost(adverseEvent.Cost); cycleIn.UpdateCost(adverseEvent.Cost); } // Chemotherapy for some of the patients with SC. if (patientIn.ConfirmedState.Type == BE_StateType.SC) { if (rand.NextDouble() <= chemotherapyRatioSC) { patientIn.interventionHistory.Add(cycleIn.ID, BE_InterventionType.Chemotherapy); patientIn.UpdateCost(costChemotherapy); this.UpdateCost(costChemotherapy); cycleIn.UpdateCost(costChemotherapy); } } patientIn.NextTreatment = cycleIn.ID + 1; // Assumption: Patients receive postsurgery care in each cycle. }
public void ScreenPatient(BE_Patient patientIn, BE_Cycle cycleIn, Random rand) { // Six possible outcomes: "true_positive", "false_negative", "true_negative", "false_positive", "death", and "no_show" if (rand.NextDouble() <= adherence) // The patient comply with the screening test. { // Intervention history is added to the patient's records. patientIn.interventionHistory.Add(cycleIn.ID, BE_InterventionType.Screening); // Cost is recorded on the patient, the screening modality, and the cycle. patientIn.UpdateCost(cost); this.UpdateCost(cost); cycleIn.UpdateCost(cost); // Screening-related mortality. if (rand.NextDouble() <= mortality) { patientIn.Die("Screening_" + type.ToString()); patientIn.screenResult.Add(BE_ScreeningResult.Death); return; // If the patient dies, the execution of this function is terminated. } // Screening-related adverse events. // missing AE if (patientIn.CurrentState.Type != BE_StateType.NoBarretts) // The patient is not in the NoBarretts state, it means the patient has the disease. { if (rand.NextDouble() <= sensitivity) { patientIn.HasPositiveTest = true; patientIn.screenResult.Add(BE_ScreeningResult.TruePositive); // Correct diagnosis of the disease. } else { patientIn.screenResult.Add(BE_ScreeningResult.FalseNegative); // Wrong diagnosis of the disease. } } else // The patient is in the NoBarretts state, it means the patient is healthy. { if (rand.NextDouble() <= specificity) { patientIn.screenResult.Add(BE_ScreeningResult.TrueNegative); // Correct diagnosis for the healthy patient. } else { patientIn.HasPositiveTest = true; patientIn.screenResult.Add(BE_ScreeningResult.FalsePositive); // Wrong diagnosis for the healthy patient. } } } else // The patient does not comply with the screening test. { patientIn.interventionHistory.Add(cycleIn.ID, BE_InterventionType.ScreeningNoShow); patientIn.screenResult.Add(BE_ScreeningResult.NoShow); } }
public void GiveEETSession(BE_Patient patientIn, BE_Cycle cycleIn, BE_State[] statesIn, Random rand) { if (patientIn.CountEET == 0) { patientIn.Status = BE_PatientStatus.EET; patientIn.PreEETState = patientIn.ConfirmedState; patientIn.RealPreEETState = patientIn.CurrentState; patientIn.ActiveNaturalProgression = false; } patientIn.CountEET++; // Assumption: Patient compliance is 100%. // Intervention history is added to the patient's records. patientIn.interventionHistory.Add(cycleIn.ID, BE_InterventionType.EET); // Cost is recorded on the patient, the EET modality, and the cycle. patientIn.UpdateCost(costPerSession); this.UpdateCost(costPerSession); cycleIn.UpdateCost(costPerSession); // EET-related mortality. if (rand.NextDouble() <= mortality) { patientIn.Die("EET_Mortality"); return; // If the patient dies, the execution of this function is terminated. } // EET-related adverse events. if (rand.NextDouble() <= adverseEvent.Probability) { patientIn.adverseEventHistory.Add(cycleIn.ID, BE_AdverseEventType.EET); patientIn.UpdateCost(adverseEvent.Cost); this.UpdateCost(adverseEvent.Cost); cycleIn.UpdateCost(adverseEvent.Cost); } if (patientIn.CountEET == sessionCount) { int nextStateID = FindEfficacyState(patientIn.RealPreEETState.ID, rand); patientIn.MoveEETEfficacy(statesIn[nextStateID], cycleIn); } else { patientIn.NextTreatment = cycleIn.ID + 2; // Assumption: EET sessions are held at six-month intervals. } }
public void SurveilPatient(BE_Patient patientIn, BE_Cycle cycleIn, Random rand) { if (rand.NextDouble() <= adherence) // The patient comply with surveillance. { // Intervention history is added to the patient's records. patientIn.interventionHistory.Add(cycleIn.ID, BE_InterventionType.Surveillance); // Cost is recorded on the patient, the surveillance modality, and the cycle. patientIn.UpdateCost(cost); this.UpdateCost(cost); cycleIn.UpdateCost(cost); // Surveillance-related mortality. if (rand.NextDouble() <= mortality) { patientIn.Die("Surveillance"); return; // If the patient dies, the execution of this function is terminated. } // Surveillance-related adverse events. if (rand.NextDouble() <= adverseEvent.Probability) { patientIn.adverseEventHistory.Add(cycleIn.ID, BE_AdverseEventType.Surveillance); patientIn.UpdateCost(adverseEvent.Cost); this.UpdateCost(adverseEvent.Cost); cycleIn.UpdateCost(adverseEvent.Cost); } if (rand.NextDouble() <= sensitivity) { patientIn.ConfirmedState = patientIn.CurrentState; // Correct diagnosis of the health state. SurveillanceDecision(patientIn, cycleIn, rand); } else { patientIn.NextSurveillance = cycleIn.ID + intervalNDBE; // Assumption: In the case of misdiagnosis, it is treated as NDBE. } } else { patientIn.interventionHistory.Add(cycleIn.ID, BE_InterventionType.SurveillanceNoShow); patientIn.NextSurveillance = cycleIn.ID + intervalNDBE; // Assumption: If there is no adherence, it is treated as NDBE. } }
public void GiveTouchUpRFA(BE_Patient patientIn, BE_Cycle cycleIn, BE_State[] statesIn, Random rand) { patientIn.CountRFA++; // Assumption: Patient compliance is 100 %. if (patientIn.CountRFA == maxTouchUpRFA) { patientIn.CompletedMaxRFA = true; } patientIn.CountFollowUp = 0; // The patient's follow-up intervals are reset. patientIn.PreEETState = patientIn.ConfirmedState; patientIn.RealPreEETState = patientIn.CurrentState; patientIn.ActiveNaturalProgression = false; // Intervention history is added to the patient's records. patientIn.interventionHistory.Add(cycleIn.ID, BE_InterventionType.RFA); // Cost is recorded on the patient, the EET modality, and the cycle. patientIn.UpdateCost(costRFA); this.UpdateCost(costRFA); cycleIn.UpdateCost(costRFA); // EET-related mortality. if (rand.NextDouble() <= mortality) { patientIn.Die("RFA_Mortality"); return; // If the patient dies, the execution of this function is terminated. } // EET-related adverse events. if (rand.NextDouble() <= adverseEvent.Probability) { patientIn.adverseEventHistory.Add(cycleIn.ID, BE_AdverseEventType.RFA); patientIn.UpdateCost(adverseEvent.Cost); this.UpdateCost(adverseEvent.Cost); cycleIn.UpdateCost(adverseEvent.Cost); } int nextStateID = FindEfficacyState(patientIn.RealPreEETState.ID, rand); patientIn.MoveEETEfficacy(statesIn[nextStateID], cycleIn); }
public void FollowUpSurveilPatient(BE_Patient patientIn, BE_Cycle cycleIn, Random rand) { patientIn.CountFollowUp++; // It increases whether the patient complies or not, because the follow-up intervals must be in conjunction with the guideline recommendations. if (rand.NextDouble() <= adherence) { // Intervention history is added to the patient's records. patientIn.interventionHistory.Add(cycleIn.ID, BE_InterventionType.FollowUpSurveillance); // Cost is recorded on the patient, the surveillance modality, and the cycle. patientIn.UpdateCost(cost); this.UpdateCost(cost); cycleIn.UpdateCost(cost); // Surveillance-related mortality. if (rand.NextDouble() <= mortality) { patientIn.Die("Follow-up surveillance"); return; // If the patient dies, the execution of this function is terminated. } // Surveillance-related adverse events. if (rand.NextDouble() <= adverseEvent.Probability) { patientIn.adverseEventHistory.Add(cycleIn.ID, BE_AdverseEventType.FollowUpSurveillance); patientIn.UpdateCost(adverseEvent.Cost); this.UpdateCost(adverseEvent.Cost); cycleIn.UpdateCost(adverseEvent.Cost); } if (rand.NextDouble() <= sensitivity) // Correct diagnosis of the health state. { patientIn.ConfirmedState = patientIn.CurrentState; FollowUpSurveillanceDecision(patientIn, cycleIn); } else { // Assumption: In the case of misdiagnosis, the follow-up intervals continue the same based on patients pre-EET state. if (patientIn.PreEETState.Type == BE_StateType.NDBE || patientIn.PreEETState.Type == BE_StateType.LGD) { patientIn.NextSurveillance = cycleIn.ID + postIntervalLGD[Math.Min(patientIn.CountFollowUp, postIntervalLGD.Length - 1)]; } else if (patientIn.PreEETState.Type == BE_StateType.HGD || patientIn.PreEETState.Type == BE_StateType.IMC) { patientIn.NextSurveillance = cycleIn.ID + postIntervalHGD[Math.Min(patientIn.CountFollowUp, postIntervalHGD.Length - 1)]; } else { Console.WriteLine(new System.ComponentModel.WarningException("Wrong follow-up surveillance!").Message); } } } else { patientIn.interventionHistory.Add(cycleIn.ID, BE_InterventionType.FollowUpSurveillanceNoShow); // Assumption: If there is no adherence, the follow-up intervals continue the same based on patients pre-EET state. if (patientIn.PreEETState.Type == BE_StateType.NDBE || patientIn.PreEETState.Type == BE_StateType.LGD) { patientIn.NextSurveillance = cycleIn.ID + postIntervalLGD[Math.Min(patientIn.CountFollowUp, postIntervalLGD.Length - 1)]; } else if (patientIn.PreEETState.Type == BE_StateType.HGD || patientIn.PreEETState.Type == BE_StateType.IMC) { patientIn.NextSurveillance = cycleIn.ID + postIntervalHGD[Math.Min(patientIn.CountFollowUp, postIntervalHGD.Length - 1)]; } else { Console.WriteLine(new System.ComponentModel.WarningException("Wrong follow-up surveillance!").Message); } } }