Hello Guest, Welcome to Apnea Board !
As a guest, you are limited to certain areas of the board and there are some features you can't use.
To post a message, you must create a free account using a valid email address.

or Create an Account


New Posts   Today's Posts

Analyzing CMS50E Raw Data
#1
I recently got a CMS50E pulse oximeter. As you probably know, it will record up to 24 hours of ox sat and pulse data and upload them to analysis software that comes with the device.You can also upload the data to SleepyHead.

I wanted to use the CMS50E to count desats as a way to compare the effectiveness of different sleep positions, pillows, etc. But desat counts between the CMS50E software and SleepyHead often differed by a factor of 2 or 3 even when the "trigger" settings (% decrease in sat and time criteria) were set the same. And there was poor correlation between the two - for example, on one night the CMS50E software would register more events than SleepyHead but on another night it would be the reverse. Neither CMS50E nor SleepyHead disclose the exact algorithm used to detect a desat event.

So I wanted to analyze the data myself. First, I discovered that when you upload data to the CMS50E software, it writes a .csv file to the Data folder in addition to its own .spoR binary format. (NOTE: to see them, you have to click the "Compatibility Files" button when you use Windows Explorer to view the Data folder.) The .csv file has just two columns, SpO2 and Pulse. There are no time marks. But by comparing the length of the file to the clock time you had the device recording, you can see that the sample rate is one per second. You can load and analyze the .csv file using Excel or any scripting language. I found some other scripts out there but they only process streaming data, not recorded data. They may not be aware of the existence of the .csv file.

I wrote a Python script intending to detect desat events by finding time spans where SpO2 was continuously decreasing at some minimum rate. But I found there are a lot of problems doing it that way, which probably account for the differences between the CMS50E software and SleepyHead. For example, what if there is a 1-second jog up during a long desat? Do you count it as two desats? When does the desat stop, after SpO2 stops decreasing? When it starts increasing again? When it reaches its previous maximum? When it reaches your basal SpO2? And how do you calculate the basal value? Etc. etc. Then there were issues with handling obvious data drops and zero values that get recorded after you take the device off your finger. (I often take it off at 4 or 5 am because it starts to hurt my finger, and then end up with a couple hours of zero data. The best way I found to keep the device on is to sort of loosely pull a tube sock over your hand. If it's too tight you can cut a hole for your thumb. Rubber bands hurt and often compress the device too hard on your finger and corrupt the data.)

So I changed to what I think is a more stable and meaningful detection algorithm. First I throw out all sat values below 41 (the device seems to generate a 40 when it's not getting a good read, and generates zeros when the finger is out.) I then calculate the basal value as the MODE of the remaining values. Then, a desat is counted if the sat value falls more than 1 point below the mode before rising to 1 point below the mode again within 100 seconds. Finally, I calculate a "severity index" that is the average sat deficit compared to the mode, over the time span of the desat. I output counts of all desats and of "severe" events that have an index more than 2. And I output the number of desats and "severe" desats per hour OF VALID DATA. It doesn't make sense to include the time you had the device off your finger. The CMS50E software and SleepyHead don't seem able to make this important correction.

(an aside: Originally I thought that the total time below the basal sat, or below some fixed sat value like 93, would be a good, stable indicator of sleep disruption. But if you think about it, you could have sats of 89 all day long and Medicare wouldn't even give you oxygen therapy. So having a desat like dropping to 85 for 40 seconds does not seem to be harmful in itself. The real significance of a single desat event is that it may indicate an apneic event that disrupts your sleep - which appears to be the real harm. I am neither a doctor nor a biophysicist so treat this as speculation.)

Using my "below-mode" method I get event counts that are stable from night to night under the same conditions. But the important thing is that I know exactly how they're counted.

The board won't let me attach my script, but you can probably reproduce what I did with minimal skills. Obviously, this information is only for rough comparisons or fun. Do not use these guidelines to diagnose or treat any disease...

Post Reply Post Reply
#2
(12-22-2016, 12:57 PM)TubeJockey Wrote: ...The board won't let me attach my script...

If you wanted to put it in a Google Doc, or similar, you could then share the link to that.
                                                                                                                                                                                  
Please organize your SleeyHead screenshots like this.
I'm an epidemiologist, not a medical provider. 
Post Reply Post Reply
#3
That is one heck of a first post! Welcome to the Apnea Board.

In case you have not seen it, this may be of interest:
https://github.com/airikka/spo2cms50dplus

I am on a Mac, so that or SleepyHead is my only way of getting the data.
Post Reply Post Reply


#4
as far as it comes to SleepyHead: thank god, no let me rephrase that: thank jedimark - it's open source:

I believe your loader would be that: https://gitlab.com/sleepyhead/sleepyhead...loader.cpp

as a bit of a warning if you want to build sleepyhead on windows: stick to jedimarks requirements to the letter! (using VS 2015 is not a wise idea! and make sure you really get the right QT library)

Post Reply Post Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Sleepyhead Needs YOUR data! [data collection complete] palerider 35 3,674 04-02-2016, 02:28 PM
Last Post: palerider
  Help in analyzing Sleepy Head data A1BSTEG 1 534 01-24-2016, 08:17 PM
Last Post: OpalRose
  CONTEC CMS50E Oximeter and Sleepyhead eseedhouse 12 3,893 02-18-2015, 12:44 PM
Last Post: PaulaO2

Forum Jump:

New Posts   Today's Posts




About Apnea Board

Apnea Board is an educational web site designed to empower Sleep Apnea patients.

For any more information, please use our contact form.