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

How export all days for oximeter (O2 Ring) data only (no CPAP) ?
#1
Question 
How export all days for oximeter (O2 Ring) data only (no CPAP) ?
Is there a way, via O2 Insight or OSCAR, to export (eg as CSV) all oximeter (only) data ever recorded/imported?

My oximeter is an O2Ring, I import from it daily into O2 Insight and (then) OSCAR.
I see OSCAR has a CSV Export Wizard but when I use it, all I get is headings, no data (maybe only works when there is CPAP data?)

Reason for wanting to export the data:
To quickly/easily experiment with making my own prototype metrics (for oxygen deprivation) and predictors (of energy, mood and headaches)
I am aware of conventional metrics like SpO2 levels and ODI (3% & 4%) but consider these too crude - more "easy to measure" than targeted.
BTW if anyone has interest/opinions/links regarding such metrics/predictord, please let me know.
Post Reply Post Reply
#2
RE: How export all days for oximeter (O2 Ring) data only (no CPAP) ?
Export the oximeter data as csv from the O2 Insight Pro app on your computer.
Jeff8356

NOTE:
Jeff8356 has not been active on forums since October, 2023.
He cannot reply to you.


MacBook Air (2017, Intel) | macOS Monterey (12.7) | OSCAR v1.5.1 | VM = Win10/Win11 |
How to Links:
Installing OSCAR on a Mac
Organizing your OSCAR charts
Attaching screenshots and files for the forum
OSCAR Help
OSCAR - The Guide


Post Reply Post Reply
#3
Question 
RE: How export all days for oximeter (O2 Ring) data only (no CPAP) ?
(06-05-2023, 06:48 AM)Jeff8356 Wrote: Export the oximeter data as csv from the O2 Insight Pro app on your computer.

Thanks Jeff,

I tried that (O2 Insight's [Export as CSV] button), but it only seems to export for a single session.

Even when I selected all the sessions (nights) so far for this month (June), after I exported, the CSV file only contained data for 1 to 2 June (overnight).

Is that (one day at a time) definitely the only option here, or is there a (user-friendly or hack-y) way to get it to export over multiple sessions?
(Even if only to put my mind at rest that I'm not missing something)

I (just now) tried a more hack-y way - opening the (O2 Insight) application's (SQLite) database (db_o2.db, opened in DB Browser for SQLite), but it only contains daily aggregate/summary/score data, not down to the individual samples level.  Shame...

I see also there is code (e.g. Java) on GitHub for reading individual Viatom pulse oximeter binary files, I guess it should in principle be easy to run that (e.g. in a commandline or java for-loop) over all the files in a directory/folder.  But I would prefer "an easy route" if possible.
Post Reply Post Reply
#4
RE: How export all days for oximeter (O2 Ring) data only (no CPAP) ?
The database name is, PlusebitO2.db. The data is stored as a blob type. The path is sleepData/dataBuf. Each record is stored sequentially, and uses the date/time filename field (mFileName) for parsing. I'm sure there must be instructions on the internet to extract and format this data to your needs.

Good luck!
- Red
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: How export all days for oximeter (O2 Ring) data only (no CPAP) ?
I may be wrong, but as near as I can tell the db names for Apple versions are:
  • iOS v16.3.1 - jkdb.sqlite
  • macOS v12.6.6 - db_o2.db

Both db's only hold the summary data for each session. All of the binary files are in their respective locations and hold the detailed data.
Jeff8356

NOTE:
Jeff8356 has not been active on forums since October, 2023.
He cannot reply to you.


MacBook Air (2017, Intel) | macOS Monterey (12.7) | OSCAR v1.5.1 | VM = Win10/Win11 |
How to Links:
Installing OSCAR on a Mac
Organizing your OSCAR charts
Attaching screenshots and files for the forum
OSCAR Help
OSCAR - The Guide


Post Reply Post Reply
#6
RE: How export all days for oximeter (O2 Ring) data only (no CPAP) ?
You're correct, Sir!

I went back and found that in some versions, Viatom had changed the database names. For the databases named, db_o2.db, this is the location to find the data: tb_check/checktime.

Good catch! Thanks

- Red
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
#7
RE: How export all days for oximeter (O2 Ring) data only (no CPAP) ?
Ok, so there is no option apart from getting/writing some custom code to go through all the binary files themselves.

I found what looks like suitable java code here: https://github.com/rileyg98/ViatomDataReader

According to its README.md file:
Code:
Reads raw binary files extracted from Viatom pulse oximeters.
Inspiration (and the header definition) was borrowed from OSCAR, over at https://gitlab.com/pholy/OSCAR-code.
This takes an input file name and an output file name. It does basic sanity checking of the file structure.
This will output a CSV formatted with the following columns: Unix Timestamp, Pulse, Heartrate.

I am on macOS
I tried downloading the above and running it on a binary file ("20230611204719") as follows, in a Terminal window:
Code:
java ViatomReader.java ~/Desktop/20230611204719 ~/Desktop/20230611204719.csv
But it failed with error message: "package com.opencsv does not exist"
So I guess I need to load that package somehow.  Anyone know the most appropriate wat to do this?
From a websearch, so far, it seems recommended to use a tool called 'maven', which (AFAICT) automatically downloads dependencies (presumably to wherever they ought to be!).
Am I on the right track, or is there some nice simple slick and friendly GUI-based java IDE I could be using instead?
Any tips welcome
Post Reply Post Reply
#8
RE: How export all days for oximeter (O2 Ring) data only (no CPAP) ?
The Bing-ChatGPT language-model's recommendation was to use NetBeans as an IDE - easy to learn and quite functional, supports maven.
I found information on that here on StackOverflow.
I will try that out.

Programming in java is new to me.
Post Reply Post Reply
#9
RE: How export all days for oximeter (O2 Ring) data only (no CPAP) ?
For anyone coming across this (including OP) yes this will work. It took me quite a long time to get everything working, but it is possible. The basic steps are:

- grab binary data files (".dat") from phone. It is in "com.viatom.vihealth\files\20\host" where 20 may be different for you. They are names after the timestamp of the recording

- convert them using the tool linked by David, found at the link above (I am new and can't link). It is called "ViatomDatareader" on github. This was kind of the hard part. I downloaded the entire github repository. I then downloaded the Eclipse Java IDE and was able to get it to run. I then outputted it as an executable jar file. I can upload if anyone wants it.

If doing a lot of files, I found it best to list the entire contents of the folder with the data. I opened it in a spreadsheet app (Libreoffice) and then created a column with the following string:

=CONCATENATE("java -jar test.jar ",A1," ",A1,".csv")

where A1 was the column with the filename.

I then ran the entire list of
java -jar test.jar name.dat name.csv
in a windows Powershell. It took a while. I then merged all the .csv's into a single file using

Get-Content .\*.csv | Out-File .\Combined.csv

in Powershell. That also took quite a while.

In the end, I now have a csv with all my timestamped SpO2 and heart rate data.

Sorry this wasn't written out better, it's been a while since I've posted like this and it is getting late. I will try and help if anyone has questions that wants to do this process.

I can upload the executable jar file to save a step (not having to download and run the Eclipse thing). Of course you'd have to trust some random person on the internet in not giving you a virus.
Post Reply Post Reply
#10
RE: How export all days for oximeter (O2 Ring) data only (no CPAP) ?
Not sure if this answers the question, but wanted to share my experience, I wanted to download all the O2 Ring data at the end of the month in bulk and downloading them day by day was teddies so this is what I figured out, this was for an iPhone but an Android phone should have similar steps

  1. Use iTunes to download ViHealth data (Click on you Device icon in itunes -> File Sharing -> pick viHealth for the apss list -> click on O2Data -> save the file to your PC).
    Note: you may find all the shared O2 files in the root directory but this does not include all your O2 Data only the data that you saved as binary and shared from the app, so just pick O2Data directory to get the full device data.

  2. You need to rename all files by removing the .dat extension from them so OSCAR can import them, for that I used Chat-GPT to get me a script to do it on windows, if you are using mac try google or just ask Chat-GPT for some help, to rename all these files.
    * I create a file named script.bat in Folder beside my O2Data.
    * Create a new text file and past this code inside, make sure to rename the directory to what match where your files are.
    * Rename the text file to script.bat and double click on it.
    Note: This script will only work on windows pc.
    Code:
    @echo off
    setlocal enabledelayedexpansion

    rem Specify the directory where your files are located
    set "directory=C:\Users\user1\Desktop\temp\O2Data\"

    rem Loop through each .dat file in the directory
    for %%F in ("%directory%\*.dat") do (
       rem Get the file name without extension
       set "newName=%%~nF"
       
       rem Rename the file by removing the .dat extension
       ren "%%F" "!newName!"
    )

    echo All .dat files in %directory% have been renamed.



  3. Just import the stuff from OSCAR (Data -> Import Viatom/Wellue Data).

Hope this could be helpful for any one searching for downloading O2 Ring Data from ViHealth app directly in bulk.
Post Reply Post Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Oscar crashes when importing Wellue O2 ring data Armorwolf 15 352 Yesterday, 11:35 AM
Last Post: dbottomley
  Export breath by breath data from oscar? lisaistired 3 268 11-21-2024, 02:44 PM
Last Post: notausername
  OSCAR displaying summary only for 13 out of 16 days imported EnigmaOfSleep 6 273 11-18-2024, 02:40 PM
Last Post: ClaudeL
Information EzShareApp - CPAP Data Downloader from EzShare SD card for macOS adrianfeeger 24 1,016 11-07-2024, 11:18 PM
Last Post: walshy1009
  Löwenstein-Prisma sd card increase days k.mooijman 6 1,060 11-05-2024, 03:03 PM
Last Post: donsburg
  Trouble understanding how to import O2 ring info into Oscar katbrat 6 498 10-26-2024, 08:25 PM
Last Post: katbrat
  No stats on some days. Why ? bouks 7 409 10-14-2024, 09:02 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.