From 01c7f7cdc00e5505f380bc4615be57a347d66dc8 Mon Sep 17 00:00:00 2001 From: sawinglogz <3787776-sawinglogz@users.noreply.gitlab.com> Date: Wed, 29 Apr 2020 10:40:23 -0400 Subject: [PATCH] Exclude additional invalid samples in PRS1 oximetry. Also clean up some function names and remove unnecessary code. --- Htmldocs/release_notes.html | 1 + oscar/SleepLib/loader_plugins/prs1_loader.cpp | 27 +++++++------------ oscar/SleepLib/loader_plugins/prs1_loader.h | 4 +-- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/Htmldocs/release_notes.html b/Htmldocs/release_notes.html index 24050842..4ccde935 100644 --- a/Htmldocs/release_notes.html +++ b/Htmldocs/release_notes.html @@ -29,6 +29,7 @@
  • [fix] Fix the pressure waveform scale for the BiPAP autoSV Advanced 30 (960T)
  • [fix] Add support for rise time mode on DreamStation BiPAP devices (600X-700X).
  • [fix] Remove the ramp time and pressure settings when the ramp is disabled on pre-DreamStation devices.
  • +
  • [fix] Improve import of Philips Respironics oximetry data.
  • [fix] Fix occasional failure to save imported Viatom data.
  • diff --git a/oscar/SleepLib/loader_plugins/prs1_loader.cpp b/oscar/SleepLib/loader_plugins/prs1_loader.cpp index e2f3672a..6e9a3982 100644 --- a/oscar/SleepLib/loader_plugins/prs1_loader.cpp +++ b/oscar/SleepLib/loader_plugins/prs1_loader.cpp @@ -8149,7 +8149,7 @@ QList PRS1Import::CoalesceWaveformChunks(QList } -void PRS1Import::ParseOximetry() +void PRS1Import::ImportOximetry() { int size = oximetry.size(); @@ -8205,10 +8205,10 @@ void PRS1Import::ImportOximetryChannel(ChannelID channel, QByteArray & data, qui quint64 start_ti; int start_i; - // Split eventlist on invalid values (255) + // Split eventlist on invalid values (254-255) for (int i=0; i < data.size(); i++) { unsigned char value = raw[i]; - bool valid = (value != 255); + bool valid = (value < 254); if (valid) { if (pending_samples == false) { @@ -8218,7 +8218,7 @@ void PRS1Import::ImportOximetryChannel(ChannelID channel, QByteArray & data, qui } if (channel == OXI_Pulse) { - if (value > 200) UNEXPECTED_VALUE(value, "<= 200 bpm"); + if (value > 240) UNEXPECTED_VALUE(value, "<= 240 bpm"); } else { if (value > 100) UNEXPECTED_VALUE(value, "<= 100%"); } @@ -8242,7 +8242,7 @@ void PRS1Import::ImportOximetryChannel(ChannelID channel, QByteArray & data, qui } -void PRS1Import::ParseWaveforms() +void PRS1Import::ImportWaveforms() { int size = waveforms.size(); quint64 s1, s2; @@ -8429,25 +8429,16 @@ bool PRS1Import::ParseSession(void) // Parse .005 Waveform files waveforms = ReadWaveformData(m_wavefiles, "Waveform"); - if (session->eventlist.contains(CPAP_FlowRate)) { - if (waveforms.size() > 0) { - // Delete anything called "Flow rate" picked up in the events file if high-resolution data is present - // TODO: Is this still used anywhere? - qWarning() << session->session() << "Deleting flow rate events due to flow rate waveform data"; - session->destroyEvent(CPAP_FlowRate); - } - } - - // Extract raw data into channels. - ParseWaveforms(); + // Extract and import raw data into channels. + ImportWaveforms(); } if (!m_oxifiles.isEmpty()) { // Parse .006 Waveform files oximetry = ReadWaveformData(m_oxifiles, "Oximetry"); - // Extract raw data into channels. - ParseOximetry(); + // Extract and import raw data into channels. + ImportOximetry(); } save = true; diff --git a/oscar/SleepLib/loader_plugins/prs1_loader.h b/oscar/SleepLib/loader_plugins/prs1_loader.h index c7270010..d44d7f4a 100644 --- a/oscar/SleepLib/loader_plugins/prs1_loader.h +++ b/oscar/SleepLib/loader_plugins/prs1_loader.h @@ -313,10 +313,10 @@ public: QList CoalesceWaveformChunks(QList & allchunks); //! \brief Takes the parsed list of Flow/MaskPressure waveform chunks and adds them to the database - void ParseWaveforms(); + void ImportWaveforms(); //! \brief Takes the parsed list of oximeter waveform chunks and adds them to the database. - void ParseOximetry(); + void ImportOximetry(); //! \brief Adds a single channel of continuous oximetry data to the database, splitting on any missing samples. void ImportOximetryChannel(ChannelID channel, QByteArray & data, quint64 ti, qint64 dur);