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

OSCAR SpO2 CSV import
#1
OSCAR SpO2 CSV import
So I found a little SpO2 recorder and while it's phone app based, it will export data in a CSV file.
Emay Sleep2 https://www.amazon.com/gp/product/B08XPH8H7X
The price increased a bit since I bought it.

I've saw there clip-on meter mentioned back in March but there was no response to it.


Should be a simple import filter, just have to manually export the files.

Attached is a 1 hr test log.
Here's a snippet from the beginning. 

Date,Time,SpO2(%),PR(bpm)
2021/12/10,11:32:14,98,85
2021/12/10,11:32:15,98,85
2021/12/10,11:32:16,98,85
2021/12/10,11:32:17,98,85


My coding skills has atrophied in the last decade and I know nothing about the code base.
But a CSV import should be pretty simple for someone that knows the code.


Attached Files
.csv   EMAY SpO2-20211210-113214.csv (Size: 82.19 KB / Downloads: 3)
Post Reply Post Reply
#2
RE: OSCAR SpO2 CSV import
Both the Zeo and Dream device listings import their data using a .csv file. Maybe, studying their format may allow you to format your device's file and use an existing importer. That would save a lot of time and energy.

OSCAR's source code is here:
https://www.sleepfiles.com/OSCAR/source-code/
Crimson Nape
Apnea Board Moderator
Project Manager for OSCAR - Open Source CPAP Analysis Reporter
www.ApneaBoard.com
___________________________________
Useful Links -or- When All Else Fails:
The Guide to Understanding OSCAR
OSCAR Chart Organization
Attaching Images and Files on Apnea Board
Apnea Helpful Tips

INFORMATION ON APNEA BOARD FORUMS OR ON APNEABOARD.COM SHOULD NOT BE CONSIDERED AS MEDICAL ADVICE. ALWAYS SEEK THE ADVICE OF A PHYSICIAN BEFORE SEEKING TREATMENT FOR MEDICAL CONDITIONS, INCLUDING SLEEP APNEA. INFORMATION POSTED ON THE APNEA BOARD WEB SITE AND FORUMS ARE PERSONAL OPINION ONLY AND NOT NECESSARILY A STATEMENT OF FACT.
Post Reply Post Reply
#3
RE: OSCAR SpO2 CSV import
(12-16-2021, 01:51 PM)Crimson Nape Wrote: Both the Zeo and Dream device listings import their data using a .csv file.  Maybe, studying their format may allow you to format your device's file and use an existing importer.  That would save a lot of time and energy.

OSCAR's source code is here:
https://www.sleepfiles.com/OSCAR/source-code/


I'll see what I can figure out. Both Zeo and Dreem seem to be far more advanced.

And as if my rusty coding wasn't enough, OSCAR is OO, not a strong suit.
I glanced at the code for Dreem and wasn't following it very well.

It does seem both use 30 second data points, while the Emay is every second.
That might be problematic using either.

And some mention of EDF, but that would take a good bit of work to make a conversion script.

Or SomnoPose importer as a baseline (I followed it a little better). It has a timestamp per line (though using Unix time) instead of just incrementing a fixed time. But the data structure it fills is not pulse or oxygen data.

And of course I don't even have a Windows complier set up.
I think I have a Linux install with a compiler, but it would  still be a few years old. I doubt I have all the needed dev libraries either.

Hopefully a coder like @sawinglogz will come along. They could probably do it in an hour since they already understand the data structures in OSCAR and the CSV library.
Post Reply Post Reply
#4
RE: OSCAR SpO2 CSV import
I was thinking that you format your device's csv file to mimic one of the ones already used.
Crimson Nape
Apnea Board Moderator
Project Manager for OSCAR - Open Source CPAP Analysis Reporter
www.ApneaBoard.com
___________________________________
Useful Links -or- When All Else Fails:
The Guide to Understanding OSCAR
OSCAR Chart Organization
Attaching Images and Files on Apnea Board
Apnea Helpful Tips

INFORMATION ON APNEA BOARD FORUMS OR ON APNEABOARD.COM SHOULD NOT BE CONSIDERED AS MEDICAL ADVICE. ALWAYS SEEK THE ADVICE OF A PHYSICIAN BEFORE SEEKING TREATMENT FOR MEDICAL CONDITIONS, INCLUDING SLEEP APNEA. INFORMATION POSTED ON THE APNEA BOARD WEB SITE AND FORUMS ARE PERSONAL OPINION ONLY AND NOT NECESSARILY A STATEMENT OF FACT.
Post Reply Post Reply
#5
RE: OSCAR SpO2 CSV import
(12-17-2021, 03:20 PM)Crimson Nape Wrote: I was thinking that you format your device's csv file to mimic one of the ones already used.

If I can find example data files I'll try, but the importers imply a lot more than what I have.

And at least one appears to expect the filename to have a specific format.
Post Reply Post Reply
#6
RE: OSCAR SpO2 CSV import
It looks to me like a relatively simple task to restructure your file to conform to the structure linked below. Once done, you can import the SpO2 and PR data into OSCAR via the Somnopose import. I have done this for accelerometer data. Your log time column must be GMT time in seconds after some date long past. After long non-use I expect to revisit such files tonight to prepare some imports of other data and will see if it is easy to hand off the necessities to you. 

Don't be put off by the fact OSCAR will place the results in its viewing windows labeled for Inclination and Orientation. And note that one of the other import features might be more friendly, though this one is not that difficult.

attachment.php (596×586) (apneaboard.com)
I have no particular qualifications or expertise with respect to the apnea/cpap/sleep related content of my posts beyond my own user experiences and what I've learned from others on this site. Each of us bears the burden of evaluating the validity and applicability of what we read here before acting on it.  

Of my 3 once-needed, helpful, and adjunctive devices I have listed, only the accelerometer remains operative (but now idle). My second CMS50I died, too, of old age and the so-so Dreem 2 needs head-positioning band repair--if, indeed, Dreem even supports use of it now.



 
Post Reply Post Reply
#7
RE: OSCAR SpO2 CSV import
(12-18-2021, 01:39 AM)2SleepBetta Wrote: Your log time column must be GMT time in seconds after some date long past.
...
Don't be put off by the fact OSCAR will place the results in its viewing windows labeled for Inclination and Orientation.

I did glance at the Somnopose importer. Looked to be using Unix time (seconds since Jan 1, 1970)

The fact it was dealing with sleep positions didn't look like what I wanted.

Any help would be appreciated.
The Emay device looks like a nice slim alternative to ConTec stuff and comes with a comfortable silicon sensor instead of a clip on sensor.

Guess I need to talk to my Python programming son. Last I did data reformating like this was in Perl 15 years ago. But I haven't written a regular expression in a decade. And Perl on Windows never went well.
Post Reply Post Reply
#8
RE: OSCAR SpO2 CSV import
Shamelessly I offer this mere Excel prototype I've adapted and long used to import various kinds of data into OSCAR. Obviously, it's not ready for prime time and use by others and it's no harm no foul if you don't care to use it. 

It does show key elements that can be used to generate the necessary input and format for OSCAR Somnopose imports. I send it only because I remember my false steps with this simple task; it may help. (Perhaps this cobble-together will induce someone to step up with a clean and simple conversion file for you.)

My actual sheet is too large with lots of vacancies after changes, so I just snipped and presented the relevant matter.

The attachment shows where its numbers came from via formulae. Data from a CSV file produced by a device like your oximeter is pasted in the A to C columns. Time column, as it has been used, begins as zero seconds. For you column A would be 0, 1, 2, 3 . . .  seconds, as I recall the formatting. (I haven't used the spreadsheet recently but will use it tomorrow.) 

You need to adjust for your time zone at 3600 sec/hr; everything is in seconds or appropriate decimal fractions thereof.

I expect your raw heart data will be accommodated as is given those comply with the ranges Somnopose demands. But it must be and will be converted to have ".00 accuracy".

The green-boxed element holds the magic 2001 Somnopose starting date as a constant number of days.

The OSCAR-Somnopose combination is rigid and fussy about exact compliance with formatting requirements as in the linked item I posted.

The bottom right image shows what I paste into the CSV file that will be imported. As you see, it complies with that image I posted.

If you don't have Excel, then I think the free Open Office software is still available and should do the job.

   
I have no particular qualifications or expertise with respect to the apnea/cpap/sleep related content of my posts beyond my own user experiences and what I've learned from others on this site. Each of us bears the burden of evaluating the validity and applicability of what we read here before acting on it.  

Of my 3 once-needed, helpful, and adjunctive devices I have listed, only the accelerometer remains operative (but now idle). My second CMS50I died, too, of old age and the so-so Dreem 2 needs head-positioning band repair--if, indeed, Dreem even supports use of it now.



 
Post Reply Post Reply
#9
RE: OSCAR SpO2 CSV import
Thanks. I'll look at it tonight or Sunday. I have a busy day away grom home with family.
Post Reply Post Reply
#10
RE: OSCAR SpO2 CSV import
here is a small python script that converts an EMAY oximeter CSV file to a somnopose CSV that can be imported into OSCAR. it takes as a single argument the name of an EMAY csv file and outputs the new CSV file to standard out, so you'll have to use redirection to create the new CSV file.


Attached Files
.txt   emay_to_somnopose.py.txt (Size: 929 bytes / Downloads: 46)
Post Reply Post Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
Question Spo2 data format Squid3083 12 3,347 Yesterday, 06:14 AM
Last Post: aradhana
  Export Wellue SpO2 data herenthere 0 56 11-25-2024, 07:37 PM
Last Post: herenthere
  O2 import DST > ST 1:14am happened twice dgconder 5 262 11-03-2024, 08:55 PM
Last Post: dgconder
  Oscar Crash to desktop on SP02 import WallyPepper 7 694 11-01-2024, 09:36 PM
Last Post: Crimson Nape
  Trouble understanding how to import O2 ring info into Oscar katbrat 6 514 10-26-2024, 08:25 PM
Last Post: katbrat
  OSCAR: Questions regarding a potential import for Garmin data littleyoda 2 280 10-19-2024, 10:37 AM
Last Post: littleyoda
Idea Generic import to OSCAR? Oscer? I Ardly Know Er 1 426 10-19-2024, 03:48 AM
Last Post: littleyoda


New Posts   Today's Posts


About Apnea Board

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