Apnea Board Forum - CPAP | Sleep Apnea
Garmin O2 oximetry import to Oscar - 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: Garmin O2 oximetry import to Oscar (/Thread-Garmin-O2-oximetry-import-to-Oscar)

Pages: 1 2


Garmin O2 oximetry import to Oscar - fillek - 04-28-2021

I'm happy with Oscar. However, it would be nice to import my oximetry sleep data as well, I have about a year of data. I can transform the data, but I don't know the format Oscar needs it. Now I have the data in one file per day in json format, the files look something like example below 20210318.json:

{
  "dailySleepDTO": {
    "_comment": "a lot of stuff removed here",
    "calendarDate": "2021-03-18",
    "sleepTimeSeconds": 28080,
    "sleepStartTimestampGMT": 1616015220000,
    "sleepEndTimestampGMT": 1616044020000,
    "sleepStartTimestampLocal": 1616022420000,
    "sleepEndTimestampLocal": 1616051220000,
    "deepSleepSeconds": 1260,
    "lightSleepSeconds": 19260,
    "remSleepSeconds": 7560,
    "awakeSleepSeconds": 720,
    "averageSpO2Value": 90,
    "lowestSpO2Value": 82,
    "highestSpO2Value": 100,
    "averageSpO2HRSleep": 55,
    "averageRespirationValue": 16,
    "lowestRespirationValue": 11,
    "highestRespirationValue": 21
  },
  "sleepMovement": [
    {
      "_comment": "a lot of stuff removed here",
    }
  ],
  "wellnessSpO2SleepSummaryDTO": {
    "userProfilePk": 00,
    "deviceId": 0000,
    "sleepMeasurementStartGMT": "2021-03-17T21:08:00.0",
    "sleepMeasurementEndGMT": "2021-03-18T05:06:00.0",
    "alertThresholdValue": null,
    "numberOfEventsBelowThreshold": null,
    "durationOfEventsBelowThreshold": null,
    "averageSPO2": 90,
    "averageSpO2HR": 55,
    "lowestSPO2": 82
  },
  "wellnessEpochSPO2DataDTOList": [
    {
      "userProfilePK": 00,
      "epochTimestamp": "2021-03-17T21:09:00.0",
      "deviceId": 0000,
      "calendarDate": "2021-03-17",
      "epochDuration": 60,
      "spo2Reading": 84,
      "readingConfidence": 2,
      "spo2Mode": null
    },
    {
      "userProfilePK": 00,
      "epochTimestamp": "2021-03-17T21:10:00.0",
      "deviceId": 0000,
      "calendarDate": "2021-03-17",
      "epochDuration": 60,
      "spo2Reading": 84,
      "readingConfidence": 2,
      "spo2Mode": null
    },
      
    ...
      
    {
      "userProfilePK": 00,
      "epochTimestamp": "2021-03-18T05:01:00.0",
      "deviceId": 0000,
      "calendarDate": "2021-03-18",
      "epochDuration": 60,
      "spo2Reading": 90,
      "readingConfidence": 13,
      "spo2Mode": null
    },
    {
      "userProfilePK": 00,
      "epochTimestamp": "2021-03-18T05:06:00.0",
      "deviceId": 0000,
      "calendarDate": "2021-03-18",
      "epochDuration": 60,
      "spo2Reading": 90,
      "readingConfidence": 11,
      "spo2Mode": null
    }
  ],
  "wellnessEpochRespirationDataDTOList": [
     ... removed a lot of data
  ],
  "sleepStress": [
     ... removed a lot of data
  ]
}


RE: Garmin O2 oximetry import to Oscar - biorn - 04-28-2021

Hi,

Nothing to do with your question, but data are recorded in which time interval?
Is there a mode to have more records?

thanks.


RE: Garmin O2 oximetry import to Oscar - kappa - 04-28-2021

The data looks like 1 minute samples. Average SpO2 of 90% seems pretty low - is this accurate/normal for you?

Currently there is no way to import this SpO2 data in to OSCAR. You could potentially convert it in to a format that OSCAR recognises such as the Viatom file format (which has 4 second samples). I don't know how useful 1 minute samples are but I guess it's better than nothing. We could potentially create a new importer for smart watch type data - could pull sleep stage, movement, HR and SpO2 data.

What mechanism have you used to get this json data from Garmin? I've done a bit of data extract from Garmin by means of downloading daily zip files using "Export Original" from the daily summary on connect.garmin and then extracting historical heart rate data from the .fit files. It's a bit clunky so a cleaner approach would be useful.

[Edit: looks like your data is coming from connect.garmin via /modern/proxy/wellness-service/wellness/dailySleepData/<user>?date=YYYY-MM-DD or similar?]


RE: Garmin O2 oximetry import to Oscar - fillek - 04-29-2021

Data is recorded once a minute, usually there are some slots missing in the data when e.g. the clock could not read the data for 20 min. It is always one minute, but today I guess a software update could change that any time.
For me 90% is about average for a night, seems to be 88-93 average per night. We should not trust too much the exact numbers but the trend seems to be trustable.
I used garmin-connect from github, it works fine but you need coding experience to use it (this package use connect.garmin as you suggested). I agree that the .fit file handling wasn't that fun so I tried this other way.
It would be great to be able to import those data you suggest directly to Oscar, we will definitely see more smart watches in the future.
I looked the web for the Viatom file format, some example files, but didn't find any, is there some good place to dig into that?


RE: Garmin O2 oximetry import to Oscar - kappa - 04-29-2021

The OSCAR code for the viatom loader is here:
https://gitlab.com/pholy/OSCAR-code/-/blob/master/oscar/SleepLib/loader_plugins/viatom_loader.cpp


RE: Garmin O2 oximetry import to Oscar - Daniel Goh - 05-25-2021

Can someone create the Oscar software as an apps and that it can have bluetooth connection to our cpap machines. So we don't have to pull out the simcard daily just to check how we are doing, Thanks


RE: Garmin O2 oximetry import to Oscar - Ratchick - 05-26-2021

(05-25-2021, 07:20 AM)Daniel Goh Wrote: Can someone create the Oscar software as an apps and that it can have bluetooth connection to our cpap machines. So we don't have to pull out the simcard daily just to check how we are doing, Thanks

There's no way to do this, currently. AFAIK. The internal modem doesn't allow end user access (assuming one is present as in the Resmed 10).

You CAN set up a way around that, using a Toshiba FlashAir wifi-enabled SDCard - but these are no longer manufactured and tend to go for excessively high prices now. I was very lucky to find an unused but opened one for almost the same as it would have initially cost, but that's the exception, not the rule). Once you have that configured correctly, you can copy the data from your machine to your computer where you run OSCAR without having to remove the card every day.  

The main thread is quite long but all the info you need, if you go that route, is right HERE.


RE: Garmin O2 oximetry import to Oscar - Daniel Goh - 05-26-2021

Thanks you so much for the quick response. I shall try it if it work. I am using Phillip dream station. a big big thanks you


RE: Garmin O2 oximetry import to Oscar - misterneil - 09-26-2021

I'd love to see this too. I recently upgraded from a Garmin Vivosmart 4 to a Fenix 6. As well as the Sp02, movement etc I now see a calculated Sleep Score. Sleep Score should be visible on all Garmin watches that have the Respiration feature. It combines all the other readings and calculates a score out of 100. In the same way the Body Battery does. Picture attached.

Garmin do provide API access for commercial entities. I applied as a private individual but was knocked back as they wanted to see evidence of commercial activity, website, privacy policy. I gave up at that point.

I dabbled with a couple of the unofficial connectors but didn't manage to get properly into it due to work / babies / chronic lack of sleep...


RE: Garmin O2 oximetry import to Oscar - Crimson Nape - 09-26-2021

How does the Garmin store the data? If locally to your PC or phone, is it in a binary file for each session or is it in a database (.db file type)?