Esempio n. 1
0
 /// <summary>
 /// Add a new Zephyr ECG WaveForm data record to the database
 /// </summary>
 /// <param name="zephyrEcg">ZephyrECGWaveForm object to add to the database</param>
 public void CreateZephyrECGData(ZephyrECGWaveform zephyrEcg)
 {
     if(zephyrEcg != null) {
         _repository.Add(zephyrEcg);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Create a list of ZephyrECGWaveform 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 ecg data record.</param>
        /// <returns></returns>
        public static List<ZephyrECGWaveform> BuildZephyrEcgDataList(CsvReader csvReader, PatientData patientData)
        {
            List<ZephyrECGWaveform> zephyrEcgData = null;

            if (csvReader != null && patientData != null && patientData.Id != null) {
                zephyrEcgData = new List<ZephyrECGWaveform>();
                while (csvReader.ReadNextRecord()) {
                    if (csvReader != null) {
                        //File should read in the following order.
                        //Time | EcgWaveform
                        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)) {
                            ZephyrECGWaveform zephyrEcg = new ZephyrECGWaveform() {
                                Time = dateTime,
                                Data = Convert.ToInt32(csvReader[1]),
                                PatientDataId = patientData.Id
                            };
                            zephyrEcgData.Add(zephyrEcg);
                        }
                    }
                }
            }

            return zephyrEcgData;
        }