Added a new pulse oximeter importer...
So I have a Viatom pulse oximeter. Commercial Link Removed
It records data and delivers it to an Android app over Bluetooth, but you can get copies of the data from the phone. I figured out (enough of) the data file format and modified the CMS50 file loader to read the files. I have a few questions:
* The Viatom device records every 2 seconds. I worked around this by doubling every record, but is there a "period" setting for OxiRecords?
* I have heart rate, SpO2, and a "motion" reading, which seems to be used for sleep sensing (if you're not moving, you must be sleeping). There's no comparable member in an OxiRecord. How can I best report the 0-255 motion reading for display in OSCAR?
Thanks!
--------
Moderator Action: Link Removed
To maintain our status as an educational organization, certain types of commercial links are prohibited in this forum. This is stated in the Apnea Board Rules with details given in the Commercial Links Policy section.
-----
RE: Added a new pulse oximeter importer...
Hi Folks,
I also have a Viatom VisualOxy pulse oximeter. Is it possible for OSCAR to import data from the Viatom oximeters?
spinon
RE: Added a new pulse oximeter importer...
(11-18-2019, 01:54 AM)spacewrench Wrote: I figured out (enough of) the data file format and modified the CMS50 file loader to read the files.
Nice!
(11-18-2019, 01:54 AM)spacewrench Wrote: * The Viatom device records every 2 seconds. I worked around this by doubling every record, but is there a "period" setting for OxiRecords?
You need to override the value returned by importResolution() in your SerialOximeter subclass. It's in milliseconds, so presumably you'll want yours to return 2000.
Quote:* I have heart rate, SpO2, and a "motion" reading, which seems to be used for sleep sensing (if you're not moving, you must be sleeping). There's no comparable member in an OxiRecord. How can I best report the 0-255 motion reading for display in OSCAR?
This wouldn't go into an OxiRecord, since it's not really oximetry data. More likely you'd want to import it as some form of sleep status, along the lines of the ZEO_SleepStage channel (or possibly the Somnopose POS_Orientation channel).
For now I'd recommend looking at the Zeo and Somnopose importers to see how they add data to channels, then add your own channel definition (see for example the declaration of the CPAP_EPAPSet channel in machine_common.h and schema.cpp) and import the motion reading into that channel, which OSCAR will then chart for you.
Looking briefly at the OximeterImport base class (not my area of expertise), it looks like you'll probably want to stage the data you're importing into another vector (alongside the OxiRecord vector) in your subclass while you read it, and then probably import it into channels via a new overloadable function that gets called within the import loop in on_saveButton_clicked().
That'll also be handy if/when we add support for other hybrid devices, which seem to be getting more common.
When you're done, feel free to make a merge request, and we'll take a look at your changes.
RE: Added a new pulse oximeter importer...
Hi spinon.
The Viatom seems to record data overnight, then upload it via Bluetooth to a cell phone or tablet. Theoretically, you could probably upload to a PC via Bluetooth, but the Viatom tech support people were completely unhelpful when I asked about data formats, and I don't know enough Bluetooth to figure out the upload protocol myself.
What I do is let the device upload to my Android phone, then I use Android Debugger (adb) to copy the file to my laptop, and import the file into OSCAR from there. You might be able to get to the file using a File Manager or something instead; it's stored in the /sdcard directory next to Documents, Downloads, Pictures and so forth.
I know it's not as quick and easy as loading from the CPAP machine (I have a WiFi SD card in mine, so it's really easy!) but it's the best I can manage for now.
I'll fix the 2-seconds thing, and figure out how to import the "motion" data, then send my mods to the OSCAR developers.
RE: Added a new pulse oximeter importer...
spacewrench,
After reading your post above, I was wondering if you could run the Android app on your PC and use something like
Wireshark to capture the Bluetooth communications. Using Anbox on a Linux platform is the preferred route, but I see there are Android emulators for Windows systems as well.
RE: Added a new pulse oximeter importer...
(11-26-2019, 02:24 AM)Crimson Nape Wrote: I was wondering if you could run the Android app on your PC and use something like Wireshark to capture the Bluetooth communications. That'd be my first choice; there's also an Android setting where you can capture (some?) Bluetooth traffic on the phone. But I tried it on communications of a different fitness wrist band (pulse, O2, etc.) and couldn't make enough sense of what I captured to fake it. My day job isn't low-level wireless communication, so it's excruciatingly slow going!
I'm not sure the Viatom is a good choice for (what looks like) a lot of work. The device itself is quite expensive, and although it's nicely packaged and seems to work well, not a lot of people seem to have them. (I got lucky and found mine on Craigslist for $40, but list price is about $200.)
Moving files around isn't inconvenient enough for me (yet!) to be motivated to dig into wireless protocol. Besides, I still have to figure out how to add a non-oximeter channel!
RE: Added a new pulse oximeter importer...
I have an O2 Ring and was looking at adding support to import into OSCAR... their O2 Insight utility will load the data from the ring to a PC. I wonder if those files are the same as what you see on your Android. I assume so. Their tech support even offered to add a new export format to O2 Insight, but I have not found any documentation on the file formats OSCAR currently supports. If you are already adding support for the Wellue file format, that is even better. if you need any help testing, please let me know.
RE: Added a new pulse oximeter importer...
I'd guess that the O2 Ring and SleepU wrist monitor are pretty similar. Here's the beginning of one of my data files:
Code: 00000000 03 00 e3 07 0b 19 17 20 29 9d 71 00 00 c4 5a 00 |....... ).q...Z.|
00000010 00 60 5c 02 00 00 00 00 00 63 00 00 00 00 00 00 |.`\......c......|
00000020 00 00 00 00 00 00 00 00 ff ff ff 00 00 ff ff ff |................|
00000030 00 00 61 3a 00 00 00 61 3a 00 00 00 61 3a 00 08 |..a:...a:...a:..|
00000040 00 61 3a 00 08 00 61 3a 00 01 00 61 3a 00 01 00 |.a:...a:...a:...|
00000050 61 3c 00 00 00 61 3c 00 00 00 61 3b 00 01 00 61 |a<...a<...a;...a|
There's a "signature" 0x0003, followed by binary year (uint16), month, day, hour, minute and second (all uint8), then some stuff I don't understand, and finally 5-byte records of O2, Heart, ???, Motion, ??? (all uint8) at 2 seconds each.
If your file looks the same, it'll probably load OK with my changes.
On the Android app, there's actually an SQLite3 database in the directory, and I think all the data is inserted there. Binary files seem to be created by exporting from the database when you ask the app to show a graph of a particular day.
I'll see if the O2_Insight_Pro PC program from Wellue will talk to my wristband and load the info, but I think it'll still be preferable to work with the data files: there's no Mac or Linux versions, and I don't know whether I can build a Windows version of OSCAR.
RE: Added a new pulse oximeter importer...
Exact same file format. PC O2 Insight import has SQLLite database also... but I believe it is only used to store metadata for the app during downloads from device, so the app does not have to scan the data folder at each startup. The database only has a record referring to each file imported. The file (with format you show above) is what gets directly imported from the device for each session. So, on a PC, you can install O2 Insight, download from device, then in OSCAR, do an O2 import and point to the O2 Insight DATA folder. I'd be happy to test this out when you are ready.
RE: Added a new pulse oximeter importer...
(11-26-2019, 09:45 PM)jtech1 Wrote: Exact same file format. PC O2 Insight import has SQLLite database also... but I believe it is only used to store metadata for the app during downloads from device [...]
On Android, there's actually a binary (BLOB) column in the database that has all the data. You don't see it if you're just poking around with the CLI SQL browser, but if you print out the table schema, it's there, and the length of that column is about the same as the corresponding data file size.
|