Esempio n. 1
0
        private Dictionary <int, List <decimal> > getAllPatientsIntervalMED(Protocol selectedProtocol, Outcome selectedOutcome, Interval startInterval, Interval endInterval)
        {
            Dictionary <int, List <decimal> > patientsIntervalMEDs = new Dictionary <int, List <decimal> >();
            List <Patient> patients = getPatients();

            foreach (Patient patient in patients)
            {
                List <PatientOutcome> patientOutcomes = database.getPatientOutcome(patient)
                                                        .Where(po =>
                                                               po.Interval_Number >= startInterval.Number &&
                                                               po.Interval_Number <= endInterval.Number &&
                                                               po.Protocol.Equals(selectedProtocol) &&
                                                               po.Outcome.Equals(selectedOutcome)).ToList();

                foreach (PatientOutcome po in patientOutcomes)
                {
                    List <PatientMedication> patientMedications = database.getPatientMedications(patient)
                                                                  .Where(pm =>
                                                                         pm.Start_Date <= po.Date &&
                                                                         pm.End_Date > po.Date).ToList();

                    decimal med = 0;
                    foreach (PatientMedication pm in patientMedications)
                    {
                        med += Math.Round(pm.Mg * pm.Medication.Morphine_Equivalent__mg_, 2);
                    }
                    if (!patientsIntervalMEDs.ContainsKey(po.Interval_Number))
                    {
                        patientsIntervalMEDs.Add(po.Interval_Number, new List <decimal>());
                    }
                    patientsIntervalMEDs[po.Interval_Number].Add(med);
                }
            }
            return(patientsIntervalMEDs);
        }
Esempio n. 2
0
        public override Dictionary <int, int> getPatientsIntervalAverageMED(Protocol selectedProtocol, Outcome selectedOutcome, Interval startInterval, Interval endInterval, bool includeOnlyEligibleValues)
        {
            Dictionary <int, List <decimal> > allPatientsIntervalMED = getAllPatientsIntervalMED(selectedProtocol, selectedOutcome,
                                                                                                 startInterval, endInterval);
            Dictionary <int, int> patientsAverageIntervalMED = getPatientsAverageIntervalMED(allPatientsIntervalMED);

            return(patientsAverageIntervalMED);
        }
Esempio n. 3
0
        private Dictionary <int, List <decimal> > getAllPoints(Protocol selectedProtocol, Outcome selectedOutcome, Interval startInterval, Interval endInterval, bool includeOnlyEligibleValues)
        {
            Dictionary <int, List <decimal> > allPoints = new Dictionary <int, List <decimal> >();
            List <PatientOutcome>             patientOutcomes;
            List <Patient> patients = entity.getPatients();

            foreach (Patient patient in patients)
            {
                patientOutcomes = database.getPatientOutcome(patient);
                patientOutcomes = patientOutcomes.Where(po =>
                                                        po.Protocol.Equals(selectedProtocol) &&
                                                        po.Outcome.Equals(selectedOutcome) &&
                                                        po.Interval_Number >= startInterval.Number &&
                                                        po.Interval_Number <= endInterval.Number).ToList();
                if (!includeOnlyEligibleValues || isPatientEligible(patientOutcomes, endInterval))
                {
                    foreach (PatientOutcome po in patientOutcomes)
                    {
                        if (!allPoints.ContainsKey(po.Interval_Number))
                        {
                            allPoints.Add(po.Interval_Number, new List <decimal>());
                        }
                        allPoints[po.Interval_Number].Add(po.Result);
                    }
                }
            }
            return(allPoints);
        }
Esempio n. 4
0
 public override string getSeriesCount(Protocol selectedProtocol, Outcome selectedOutcome, Interval startInterval, Interval endInterval, bool includeOnlyEligibleValues)
 {
     return("Graphed Patients: " + getGraphedPatientsCount(selectedProtocol, selectedOutcome, startInterval, endInterval, includeOnlyEligibleValues));
 }