Exemple #1
0
        /// <summary>
        /// Create a list of ZephyrSummaryData objects from the data read from the csv file selected by the user.
        /// </summary>
        /// <param name="csvReader">csv reader object</param>
        /// <param name="patientData">Patient data record that will be referenced by each zephyr summary data record.</param>
        /// <returns></returns>
        public static List<ZephyrSummaryData> BuildZephyrSummaryDataList(CsvReader csvReader, PatientData patientData)
        {
            List<ZephyrSummaryData> zephyrSummaryData = null;

            if (csvReader != null && patientData != null && patientData.Id != null) {
                zephyrSummaryData = new List<ZephyrSummaryData>();
                while (csvReader.ReadNextRecord()) {
                    if (csvReader != null) {
                        //File should read in the following order.
                        //Time | HR | BR | SkinTemp | Posture | Activity | PeakAccel | BatteryVolts | BatteryLevel | BRAmplitude
                        //cont. BRNoise | BRConfidence | ECGAmplitude | ECGNoise | HRConfidence | HRV | SystemConfidence | GSR
                        //cont. ROGState | ROGTime | VerticalMin | VericalPeak | LateralMin | LateralPeak | SagittalMin | SagittalPeak
                        //cont. DeviceTemp | StatusInfo | LinkQuality | RSSI | TxPower | CoreTemp | AuxADC1 | AuxADC2 | AuxADC3
                        string dateFormat = "dd/MM/yyyy HH:mm:ss.fff";
                        string date = csvReader[0];
                        DateTime dateTime;
                        if (DateTime.TryParseExact(date, dateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) {

                            ZephyrSummaryData zephyrSummary = new ZephyrSummaryData() {
                                Date = dateTime,
                                HeartRate = Convert.ToInt32(csvReader[1]),
                                BreathingRate = (float)Convert.ToDouble(csvReader[2]),
                                SkinTemp = (float)Convert.ToDouble(csvReader[3]),
                                Posture = Convert.ToInt32(csvReader[4]),
                                Activity = (float)Convert.ToDouble(csvReader[5]),
                                PeakAccel = (float)Convert.ToDouble(csvReader[6]),
                                BatteryVolts = (float)Convert.ToDouble(csvReader[7]),
                                BatteryLevel = (float)Convert.ToDouble(csvReader[8]),
                                BRAmplitude = (float)Convert.ToDouble(csvReader[9]),
                                BRNoise = (float)Convert.ToDouble(csvReader[10]),
                                BRConfidence = Convert.ToInt32(csvReader[11]),
                                ECGAmplitude = (float)Convert.ToDouble(csvReader[12]),
                                ECGNoise = (float)Convert.ToDouble(csvReader[13]),
                                HRConfidence = Convert.ToInt32(csvReader[14]),
                                HRV = Convert.ToInt32(csvReader[15]),
                                SystemConfidence = Convert.ToInt32(csvReader[16]),
                                GSR = Convert.ToInt32(csvReader[17]),
                                ROGState = Convert.ToInt32(csvReader[18]),
                                ROGTime = Convert.ToInt32(csvReader[19]),
                                VerticalMin = (float)Convert.ToDouble(csvReader[20]),
                                VerticalPeak = (float)Convert.ToDouble(csvReader[21]),
                                LateralMin = (float)Convert.ToDouble(csvReader[22]),
                                LateralPeak = (float)Convert.ToDouble(csvReader[23]),
                                SagittalMin = (float)Convert.ToDouble(csvReader[24]),
                                SagittalPeak = (float)Convert.ToDouble(csvReader[25]),
                                DeviceTemp = (float)Convert.ToDouble(csvReader[26]),
                                StatusInfo = Convert.ToInt32(csvReader[27]),
                                LinkQuality = Convert.ToInt32(csvReader[28]),
                                RSSI = Convert.ToInt32(csvReader[29]),
                                TxPower = Convert.ToInt32(csvReader[30]),
                                CoreTemp = (float)Convert.ToDouble(csvReader[31]),
                                AuxADC1 = Convert.ToInt32(csvReader[32]),
                                AuxADC2 = Convert.ToInt32(csvReader[33]),
                                AuxADC3 = Convert.ToInt32(csvReader[34]),
                                PatientDataId = patientData.Id
                            };
                            zephyrSummaryData.Add(zephyrSummary);
                        }
                    }
                }
            }

            return zephyrSummaryData;
        }
 /// <summary>
 /// Add a new Zephyr Summary data record to the database
 /// </summary>
 /// <param name="zephyrSummary">ZephyrSummaryData object to add to the database</param>
 public void CreateZephyrSummary(ZephyrSummaryData zephyrSummary)
 {
     if(zephyrSummary != null) {
         _repository.Add(zephyrSummary);
     }
 }
Exemple #3
0
        /// <summary>
        /// Create a list of ZephyrSummaryData objects from the data read from the csv file selected by the user.
        /// </summary>
        /// <param name="csvReader">csv reader object</param>
        /// <param name="patientData">Patient data record that will be referenced by each zephyr general data record.</param>
        /// <returns></returns>
        public static List<ZephyrSummaryData> BuildZephyrGeneralDataList(CsvReader csvReader, PatientData patientData)
        {
            List<ZephyrSummaryData> zephyrSummaryData = null;

            if (csvReader != null && patientData != null && patientData.Id != null) {
                zephyrSummaryData = new List<ZephyrSummaryData>();
                while (csvReader.ReadNextRecord()) {
                    if (csvReader != null) {
                        //File should read in the following order.
                        //Timestamp | HR | BR | Temp | Posture | Activity | Acceleration | Battery | BRAmplitude | ECGAmplitude | ECGNoise
                        //cont. XMin | XPeak | YMin | YPeak | ZMin | ZPeak
                        string dateFormat = "dd/MM/yyyy HH:mm:ss.fff";
                        string date = csvReader[0];
                        DateTime dateTime;
                        if (DateTime.TryParseExact(date, dateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) {

                            ZephyrSummaryData zephyrSummary = new ZephyrSummaryData() {
                                Date = dateTime,
                                HeartRate = Convert.ToInt32(csvReader[1]),
                                BreathingRate = (float)Convert.ToDouble(csvReader[2]),
                                SkinTemp = (float)Convert.ToDouble(csvReader[3]),
                                Posture = Convert.ToInt32(csvReader[4]),
                                Activity = (float)Convert.ToDouble(csvReader[5]),
                                PeakAccel = (float)Convert.ToDouble(csvReader[6]),
                                BatteryVolts = (float)Convert.ToDouble(csvReader[7]),
                                BRAmplitude = (float)Convert.ToDouble(csvReader[8]),
                                ECGAmplitude = (float)Convert.ToDouble(csvReader[9]),
                                ECGNoise = (float)Convert.ToDouble(csvReader[10]),
                                LateralMin = (float)Convert.ToDouble(csvReader[11]),
                                LateralPeak = (float)Convert.ToDouble(csvReader[12]),
                                VerticalMin = (float)Convert.ToDouble(csvReader[13]),
                                VerticalPeak = (float)Convert.ToDouble(csvReader[14]),
                                SagittalMin = (float)Convert.ToDouble(csvReader[15]),
                                SagittalPeak = (float)Convert.ToDouble(csvReader[16]),
                                PatientDataId = patientData.Id
                            };
                            zephyrSummaryData.Add(zephyrSummary);
                        }
                    }
                }
            }

            return zephyrSummaryData;
        }