Apnea Board Forum - CPAP | Sleep Apnea
OSCAR SpO2 CSV import - 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: OSCAR SpO2 CSV import (/Thread-OSCAR-SpO2-CSV-import)

Pages: 1 2 3


RE: OSCAR SpO2 CSV import - ST Dog - 12-03-2023

(12-02-2023, 08:31 PM)joeblough Wrote: 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.


Awesome.

I'll try to test tomorrow with tonight's results.


RE: OSCAR SpO2 CSV import - joeblough - 12-03-2023

(12-03-2023, 09:14 AM)ST Dog Wrote: Awesome.

I'll try to test tomorrow with tonight's results.

cool - note also that i wrote an emay to MD300W1 converter that produces the binary file that OSCAR expects. when i woke up in the middle of the night last night (lol) i realized that i should add some more error checking, and maybe try to get it so you can choose an input file from a dialog box. however, i won't be able to test that stuff on windows.

i'll start a new thread when i release that.


RE: OSCAR SpO2 CSV import - joeblough - 12-03-2023

(12-18-2021, 10:31 AM)ST Dog Wrote: Thanks. I'll look at it tonight or Sunday.  I have a busy day away grom home with family.

i cant post a link due to my low post count, but see the software forum for a new post with the EMAY->dat converter


RE: OSCAR SpO2 CSV import - capman - 03-14-2024

@ST Dog: how is it going ?

@joeblough: your converter threw a syntax-error on line 6.


RE: OSCAR SpO2 CSV import - capman - 03-14-2024

@joeblough: after figuring the code is simple, i ported it into a shellscript.


RE: OSCAR SpO2 CSV import - joeblough - 03-15-2024

(03-14-2024, 06:55 PM)capman Wrote: @ST Dog: how is it going ?

@joeblough: your converter threw a syntax-error on line 6.

i guess there is something wrong with your python installation, or maybe you don't have struct installed because there is no syntax error on line 6...

at any rate ElectricalPaul has adopted the code and cleaned it up...

https://github.com/ElectricalPaul/emay2medview


edit: oops, sorry i forgot about this script. i was referring to my other script - it is of course different (emay2somnopose vs. emay2md300w1) - not sure where the problem is in emay2somnopose, on line 6 open() should be built-in to python. unless your interpreter is stripping all comments in which case it's dying on file.readlines(), and i suppose maybe then the python version is to blame?


RE: OSCAR SpO2 CSV import - capman - 03-15-2024

can't wait for the md300 script ;-)


some more about the error:
my cursor becomes a cross and when i draw 3 rectangles with it,
i find 3 adobe postscript 3 files, made by imagemagick,
called sys, datetime and time on disc.

it puts the following errors ,exactly:
./emay_to_somnopose.py EMAY\ SpO2-20211210-113214.csv
./emay_to_somnopose.py: line 6: syntax error near unexpected token `('
./emay_to_somnopose.py: line 6: `file = open(sys.argv[1])'

i have python 3.11.8 installed on debian
and after installing python3-structlog, the error remains there.


i also tried the new converter. it says:

python3 ./emay2medview.py EMAY\ SpO2-20211210-113214.csv
Converting EMAY SpO2-20211210-113214.csv into EMAY SpO2-20211210-113214.dat ...
ERROR:root:Invalid date/time '2021/12/10 11:32:14' on line 2

it creates a datfile with three zeros.


RE: OSCAR SpO2 CSV import - joeblough - 03-15-2024

(03-15-2024, 06:05 AM)capman Wrote: can't wait for the md300 script ;-)


some more about the error:
my cursor becomes a cross and when i draw 3 rectangles with it,
i find 3 adobe postscript 3 files, made by imagemagick,
called sys, datetime and time on disc.

it puts the following errors ,exactly:
./emay_to_somnopose.py EMAY\ SpO2-20211210-113214.csv
./emay_to_somnopose.py: line 6: syntax error near unexpected token `('
./emay_to_somnopose.py: line 6: `file = open(sys.argv[1])'

i have python 3.11.8 installed on debian
and after installing python3-structlog, the error remains there.


i also tried the new converter. it says:

python3 ./emay2medview.py EMAY\ SpO2-20211210-113214.csv
Converting EMAY SpO2-20211210-113214.csv into EMAY SpO2-20211210-113214.dat ...
ERROR:root:Invalid date/time '2021/12/10 11:32:14' on line 2

it creates a datfile with three zeros.

the script emay_to_somnopose.py doesn't call the python interpreter, i should have put the #! line there but i wouldn't know where python resides on your system. so you need to do 'python3 ./emay_to_somnopose.py' to get it to work. the errors you are seeing are from your shell trying to interpret the file, which it can't, because the shell can't understand python programs.

as for emay2medview.py, i haven't actually tried ElectricalPaul's script. you can file an issue on his github page. i'm wondering if the problem is that you are using european dates - my emay files have dates like 12/5/2023. so both his script and my script would need to be internationalized to make them work for you.


RE: OSCAR SpO2 CSV import - capman - 03-15-2024

still.

with "12/10/2021,11:32:14,98,85":
python3 ./emay2medview.py emay_us.csv
Converting emay_us.csv into emay_us.dat ...
ERROR:root:Invalid date/time '12/10/2021 11:32:14' on line 2

with "10/12/2021,11:32:14,98,85":
python3 ./emay2medview.py emay_us.csv
Converting emay_us.csv into emay_us.dat ...
ERROR:root:Invalid date/time '10/12/2021 11:32:14' on line 2


RE: OSCAR SpO2 CSV import - joeblough - 03-15-2024

(03-15-2024, 04:06 PM)capman Wrote: still.

with "12/10/2021,11:32:14,98,85":
python3 ./emay2medview.py emay_us.csv
Converting emay_us.csv into emay_us.dat ...
ERROR:root:Invalid date/time '12/10/2021 11:32:14' on line 2

with "10/12/2021,11:32:14,98,85":
python3 ./emay2medview.py emay_us.csv
Converting emay_us.csv into emay_us.dat ...
ERROR:root:Invalid date/time '10/12/2021 11:32:14' on line 2

probably it's also the european time causing problems. my EMAY CSV files say:

12/10/2023,9:57:32 PM,96,93

anyway yeah, the script needs localization...