12-03-2023, 02:16 PM
python file converter for EMAY sleep pulse oximeter
Hi all -
i recently bought the EMAY sleep pulse oximeter and was disappointed that i could not import the data into OSCAR. after having a look around the oscar code, i decided the easiest thing to do was write a python script to convert the CSV file that you can save from the iPhone to a DAT file which conforms to the MD300W1 data file format that oscar already knows how to import.
for now this is a command line program, and needs to be run from the command shell on windows, or terminal.app on OSX. i think giving it any kind of GUI requires tkinter which will be a lot of work (that i have no experience with.) i think perhaps it could be bundled into an application using pyinstaller though, which might alleviate all the problems inherent in setting up a python environment that includes tkinter.
anyway, to use this program on the mac, you just get your CSV file into your mac from the iphone - you can save it into icloud drive from the EMAY app, or you could message or email it to yourself. in Terminal.app, first change directories to where the file lives: example: cd ~/Downloads to go to your downloads folder. then to execute the program, first rename it from emay_to_md300w1.py.txt to emay_to_md300w1.py, and put it in the same directory where your CSV files are. then, type python3 ./emay_to_md300w1.py EMAY_filename.csv and it will run and create EMAY_filename.dat, which you can then import into oscar with the oximetry wizard.
let me know if you have any problems or questions on usage. the script tries to check the first line of the CSV file to make sure it's really an EMAY csv, but beyond that it does not do any other error checking. if the file is malformed the script will probably just terminate without closing the dat file.
i recently bought the EMAY sleep pulse oximeter and was disappointed that i could not import the data into OSCAR. after having a look around the oscar code, i decided the easiest thing to do was write a python script to convert the CSV file that you can save from the iPhone to a DAT file which conforms to the MD300W1 data file format that oscar already knows how to import.
for now this is a command line program, and needs to be run from the command shell on windows, or terminal.app on OSX. i think giving it any kind of GUI requires tkinter which will be a lot of work (that i have no experience with.) i think perhaps it could be bundled into an application using pyinstaller though, which might alleviate all the problems inherent in setting up a python environment that includes tkinter.
anyway, to use this program on the mac, you just get your CSV file into your mac from the iphone - you can save it into icloud drive from the EMAY app, or you could message or email it to yourself. in Terminal.app, first change directories to where the file lives: example: cd ~/Downloads to go to your downloads folder. then to execute the program, first rename it from emay_to_md300w1.py.txt to emay_to_md300w1.py, and put it in the same directory where your CSV files are. then, type python3 ./emay_to_md300w1.py EMAY_filename.csv and it will run and create EMAY_filename.dat, which you can then import into oscar with the oximetry wizard.
let me know if you have any problems or questions on usage. the script tries to check the first line of the CSV file to make sure it's really an EMAY csv, but beyond that it does not do any other error checking. if the file is malformed the script will probably just terminate without closing the dat file.