Ejemplo n.º 1
0
        /// Step A - PREPROCESS
        public void preprocessAlgoData(string currentPatientID)
        {
            /// 1. Get latest sample
            SampleController sampleController = new SampleController();

            latestSample = sampleController.GetLatestSampleForPatient(currentPatientID);

            //insert caregivers to caregiversArr
            PatientController patientController = new PatientController();

            caregiversArr = patientController.GetCaregiversforPatientID(currentPatientID);

            //extract patient's known locations
            LocationController locationController = new LocationController();

            knownLocations = locationController.GetKnownLocationsforPatientID(currentPatientID);

            //get latest sample time
            sampleTime = latestSample.CreatedAt.Value;

            //get avg patient's HR, and set our limits
            AVG_PATIENT_HR          = AlgoUtils.avgHeartRate(currentPatientID);
            HEART_RATE_BOTTOM_LIMIT = 1.7 * AVG_PATIENT_HR;
            HEART_RATE_TOP_LIMIT    = 0.5 * AVG_PATIENT_HR;
        }
Ejemplo n.º 2
0
        /// Step A - PREPROCESS
        public void preprocessAlgoData(string currentPatientID)
        {
            Trace.TraceInformation(String.Format("Current PatientID is {0}", currentPatientID));

            /// 1. Get latest sample
            SampleController sampleController = new SampleController();

            latestSample = sampleController.GetLatestSampleForPatient(currentPatientID);
            Trace.TraceInformation(String.Format("Latest sample timestamp is {0}", latestSample.CreatedAt));

            //insert caregivers to caregiversArr
            PatientController   patientController   = new PatientController();
            CaregiverController caregiverController = new CaregiverController();

            caregiversArr = caregiverController.GetCaregiversforPatientID(currentPatientID);
            patientName   = patientController.GetPatientName(currentPatientID);
            Trace.TraceInformation(String.Format("Patient name is {0}", patientName));
            Trace.TraceInformation(String.Format("Caregivers array first email is {0}", (caregiversArr.First()).Email));


            //extract patient's known locations
            LocationController locationController = new LocationController();

            knownLocations = locationController.GetKnownLocationsforPatientID(currentPatientID);
            Trace.TraceInformation(String.Format("Found {0} known locations for this patient", knownLocations.Length));
            Trace.TraceInformation(String.Format("First known location is {0}", knownLocations[0].Description));

            //set currentLoc and closestKnowLocation
            currentLoc           = new GeoCoordinate(latestSample.Latitude, latestSample.Longitude);
            closestKnownLocation = AlgoUtils.closestKnownLocation(currentLoc, knownLocations);
            Trace.TraceInformation(String.Format("Current location is {0}", currentLoc.ToString()));
            Trace.TraceInformation(String.Format("Closest known location is {0}", closestKnownLocation.Description));


            Trace.TraceInformation(String.Format("Current world time is {0}", DateTime.Now));
            //get latest sample time
            sampleTime = latestSample.CreatedAt.Value;
            Trace.TraceInformation(String.Format("Latest sample time is {0}", sampleTime));

            //get avg patient's HR, and set our limits
            AVG_PATIENT_HR          = AlgoUtils.avgHeartRate(currentPatientID);
            HEART_RATE_TOP_LIMIT    = 1.4 * AVG_PATIENT_HR;
            HEART_RATE_BOTTOM_LIMIT = 0.5 * AVG_PATIENT_HR;
            Trace.TraceInformation(String.Format("Avg patient heartrate is {0}", AVG_PATIENT_HR));
            Trace.TraceInformation(String.Format("BottomLimit patient heartrate is {0}", HEART_RATE_BOTTOM_LIMIT));
            Trace.TraceInformation(String.Format("TopLimit patient heartrate is {0}", HEART_RATE_TOP_LIMIT));
        }