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

Added a new pulse oximeter importer...
#1
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.

-----
Post Reply Post Reply
#2
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
Post Reply Post Reply
#3
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.
Post Reply Post Reply
#4
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.
Post Reply Post Reply
#5
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.
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
#6
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!
Post Reply Post Reply
#7
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.
Post Reply Post Reply
#8
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.
Post Reply Post Reply
#9
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.
Post Reply Post Reply
#10
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.
Post Reply Post Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  OSCAR and NONIN 3150 oximeter? Polskafriend 30 2,532 10-12-2024, 12:36 PM
Last Post: PHXSleeper
  Discrepancy with desaturation events between Sleepyhead and Oximeter software Asjb 3 2,193 09-28-2024, 03:23 AM
Last Post: THEVGE
  Importing Data from EMAY Pulse Oximeters Toolworker 0 258 09-04-2024, 10:27 AM
Last Post: Toolworker
Question How export all days for oximeter (O2 Ring) data only (no CPAP) ? DavidEsp 11 3,945 09-04-2024, 01:41 AM
Last Post: Reggie5489
Question AHI from OSCAR from Sp02/Pulse only? djbclark 2 268 08-20-2024, 11:46 AM
Last Post: Crimson Nape
  how to have CA added to OSCARS "Events Flag" Graph Wm kintz 21 1,384 08-04-2024, 06:26 PM
Last Post: Wm kintz
  Adjust Wellvue Ring O2 and Pulse Flags on OSCAR? RainyDog 1 358 06-23-2024, 09:08 PM
Last Post: Crimson Nape


New Posts   Today's Posts


About Apnea Board

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