Apnea Board Forum - CPAP | Sleep Apnea
Possibly Incorrect Inspiration/Expiration Times from Respironics DreamStation - Printable Version

+- Apnea Board Forum - CPAP | Sleep Apnea (https://www.apneaboard.com/forums)
+-- Forum: Public Area (https://www.apneaboard.com/forums/Forum-Public-Area)
+--- Forum: Software Support Forum (https://www.apneaboard.com/forums/Forum-Software-Support-Forum)
+--- Thread: Possibly Incorrect Inspiration/Expiration Times from Respironics DreamStation (/Thread-Possibly-Incorrect-Inspiration-Expiration-Times-from-Respironics-DreamStation)



Possibly Incorrect Inspiration/Expiration Times from Respironics DreamStation - darral.freund - 09-18-2019

Hello,
 
I’ve noticed that the inspiration and expiration times reported (presumably) from the Respironics DreamStation CPAP machine seem to be incorrect.  I’m basing this on what’s reported by the Sleepyhead software (I haven’t converted to OSCAR yet).  I don’t believe Sleepyhead is modifying these measurements as reported in the CPAP binary files located on the SD card (but I’m not positive about this).  I’m wondering if anyone can comment on this and my thoughts on correcting it.
 
Before going any further, I use a Respironics DreamStation Auto Pap CPAP machine (constant 9cm H2O with no expiratory drop) and a Contec CMS50F pulse oximeter. I’ve been recording data from both devices since 8/1/2016, and using the available data for analysis.  Unfortunately, the Sleepyhead software doesn’t/didn’t provide access to the raw data, so I wrote parsers that read the Sleepyhead .001 files from the CPAP machine and also the pulse oximeter.  I’ve just started using the raw data from the CPAP as stored (and possibly modified?) in the .001 binary file.
 
My problem is as follows:
 
As reported from Sleepyhead, the inspiration times include the tail of many expiration times.  I believe my expiratory tail is probably more pronounced due to moderately severe tracheobronchomalacia.  I’m trying to monitor the extent of this disease as well as my lung disease based on numerous measurements, including inspiration / expiration times, ratios, etc.  I also use other sources of raw data (e.g., PFT data) that I obtain from the hospital (National Jewish Health).
 
In order to derive correct measurements, I reverse-engineered the Sleepyhead-stored flow-rate waveform (5 Hz), so I could conduct my own analysis.  I’m wondering if this waveform data is down sampled and there is a higher data-rate waveform available?
 
I created a basic zero-crossing algorithm, and then used it to find inspiration/expiration times.  I used the zero crossing times to derive inspiration times/rates, expiration times/rates, respiration times/rates, and integrated the area under/over the curve to derive inspiration/expiration volumes.  In order to get around apneas, and other anomalous problems in the waveform, I only used clean inspirations followed by clean expirations to derive these measurements.  I also eliminated outliers, most probably caused by apneas, etc. (kept 2.5 to 97.5 percentile data).
 
Here is a sample breathing waveform (in blue) with my zero crossings identified in red.  If the crossing didn’t occur at a sample point, I used simple interpolation between the two nearest points to determine the zero crossing.  In order to integrate the area under the curve, I added the interpolated zero points (x,y pairs) to the data set and then used trapezoidal integration to calculate the volumes.
 
Here is a sample section of the waveform that shows some of the issues with the way the CPAP machine / Sleepyhead determines inspiration / expiration times, etc.:

[attachment=15591]

In the graph, they y-axis is litres/min and the x-axis is one-up counts (1/5s each), which I normalize after later.  Inspirations are positive (up curves) and expirations negative.  The problem with the CPAP/Sleepyhead measurements is that it I believe expiration time is determined at the point of maximum rate a change close to the zero point or when the first zero point it reached.  On the illustrated graph, that would occur to the left of all of my calculated zero crossings.  In my case, there is periodically a small positive inspiration data point (usually 1L/min) prior to the end of the end of the expiration.  This can be seen in several cases in the above graph.  My algorithm eliminates most of these, but not all.
 
In this day (night of 16 Sep 2019), my calculated inspiration time is 1.31s and expiration time 1.70s.  The Sleepyhead software reports an inspiration time of 1.69s and an expiration time of 1.27s.  My calculated respiration rate is 20.4bpm, and the software reports 20.15bpm.
 
A small portion of the differences might be attributed to my using only pristine inhalations followed by a pristine exhalation and removal of obvious outliers.
 
I calculated an “inspiration tidal volume” of 291.6ml, an “expiration tidal volume” of 279.3ml with a volume differential of 12.3ml.   I’m hoping this difference can be explained by the exhalation port pressures and volumes (and expiration times), and that this knowledge can be used to derive the “true” tidal volume (suggestions on this greatly appreciated).   The software reported a tidal volume of 277.1ml.  
 
Another problem I’m having is reconciling mask leak rates with truncation of the breathing waveform and the fact that the documentation suggests that the CPAP machine can compensate for small leaks.  But this doesn’t seem reflected in the waveform.  Here is a graph generated from Sleepyhead of the flow rate waveform and the leak rate, yet no time was reported over the leak rate red line:
 
[attachment=15591]

There is a lot of variance in the Sleepyhead-reported day-to-day tidal volumes, and I’m thinking that the leak rate is a possible contributor to this variance.  I’m contemplating developing a “correcting” algorithm, but any commentary you have on that would be appreciated.
 
I’m hoping you are interested in these issues and might have some wisdom to bestow.
 
Thanks very much,
 
Darral Freund


RE: Possibly Incorrect Inspiration/Expiration Times from Respironics DreamStation - Sleeprider - 09-18-2019

This issue has been raised with the development team and I think the next release may address it. The Philips machines do not generate I:E times and in Sleepyhead, the author used the zero flow crossover as the change. We have found that a positive flow needs to be used in order to provide a reasonable approximation of the start of inspiration (trigger), and I think that number can be as low as 0.2 mL/second. With a zero flow, the start of inspiration was almost always too early, and resulted in longer inspiration times.

Disregard the inspiration expiration times with Philips machines pending a change in the software. Since you are interested in the software performance and issues like this, you might want to contact Bonjour to join the OSCAR Beta Test group.


RE: Possibly Incorrect Inspiration/Expiration Times from Respironics DreamStation - darral.freund - 09-18-2019

Sleeprider, 

Thanks for your quick response.  I'll follow through on your suggestion to contact Bonjour about the beta test group.

I did some more looking at some of my data sets, and it makes sense that a small positive flow rate would provide a better starting point for the start of the inspiration time.  Thanks for that bit of advice.

My problem with inspiration/expiration times has been exacerbated by long near-zero flow-rate expiration tails, presumably caused by dynamic collapse of the airway during exhalation, which results in inspiration times much longer than expiration times because he expiration tail was tagged as part of inspiration.

Based on what you told me, I'm guessing these numbers are calculated/determined in the software (i.e. Sleepyhead or OSCAR), and not the CPAP machine?  Sorry, but I'm not that familiar with OSCAR/Sleepyhead,  C++ or especially Qt.  Before I retired I was a scientist (not a programmer) and so all my current coding is in Matlab. 

One thing I'm curious about.  As part of writing my Matlab code, I had to completely understand the binary format of the old Sleepyhead binary .001 file so I could read it and parse the data.  I suspect you know this and this is part of my learning experience, but the flow-rate data waveform is stored in signed 16-bit LE integer format sampled at 5Hz.  The units are L/min.  So, I don't think reliably detecting flow rates on a breath-by-breath basis as small as 0.2mL/s would be possible using that data set...  I'm guessing this data is downsampled form what is on the DreamStation SD card for display graphics?  Can you confirm this?

All that said, based on my limited testing, the numbers I'm generating (means of various parameters including I:E times and velocities over the course of the night) seem reasonable.  At least better than what Sleepyhead is reporting.

I have a data set of CPAP and SpO2 data starting around 8/2017, so I've been hesitant to upgrade to OSCAR as Sleepyhead still works on my Macbook Pro (2019 running 10.14.6).  But, I would definitely be interested in participating in the OSCAR testing process and better understanding (or possibly contributing) to the algorithms used to generate the summary statistics.  My problem is that I don't like pictures of data.  I rather have the data.

Thanks,

Darral


RE: Possibly Incorrect Inspiration/Expiration Times from Respironics DreamStation - Sleeprider - 09-18-2019

You’re a perfect fit for the Beta test group or perhaps the developer group. We have inherited a host of problems from Sleepyhead that are being corrected. Please tell Fred your background and interest and he will get you into the right group. Based on what you have already posted, I look forward to your contributions.


RE: Possibly Incorrect Inspiration/Expiration Times from Respironics DreamStation - SleepyHenry - 09-26-2019

Like you I use a Respironic Dream Station Auto CPAP machine and see the Sleepyhead Graphs every time I insert my SD card.....I would like to see the data in a form SAS would recognize.

On the other hand I wonder about the information being collected as Pulmonary Function Studies...I would be great to have them available for statistical analysis. But I have multiple questions on whether it is an apples and oranges situation.

I will tell you that mathematically Minute Ventilation = Respiratory Rate (RR) times Tidal Volume (TV) so it would be interesting to see if this turns out to be true....Looking at my Graphs I suspect RR to be correct.  So my question is about TV being accurate? Its all over the place both internight as intranight...So is the Phillips' algorithim or the measuring device the problem?