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.
Login or Create an Account
OSCAR: Questions regarding a potential import for Garmin data
Hi
I am currently considering writing an importer for data from Garmin devices into OSCAR.
In the first development step, I would get the data from Garmin Connect as a JSON file via a Python script and an importer integrated into OSCAR would import the JSON file.
Later, the data could then be downloaded from Garmin Connect directly from within OSCAR.
After looking through the source code a bit, I have a few questions.
1) When checking the ChannelID, I found the following existing channels that are relevant for Garmin devices:
OXI_Pulse, OXI_SPO2
Journal_Weight
ZEO_SleepStage, ZEO_ZQ, ZEO_TotalZ, ZEO_TimeInWake, ZEO_TimeInREM,
ZEO_TimeInLight, ZEO_TimeInDeep, ZEO_Awakenings,
POS_Movement
The loader_plugin only implements one MachineType at a time. But I had ChannelID from different MachineType.
What is the best way to deal with an import that imports a wide range of channels?
If I see it right, no import supports this scope so far.
2) The data is provided in different frequencies.
While measurement values for pulse are available every 2 minutes, time frames are always given for the sleep level, which can sometimes be 1 1/2 hours long.
Can the data structures in OSCAR handle this if the measured values are available in different time intervals and types (measured values at time X vs. time ranges).?
3) Some Garmin data is only available for the sleep time (sleep level) while others are available for the whole day (pulse).
A few tests with CVS files showed that it can lead to strange effects when measurements are suddenly available for the whole day. My guess is that OSCAR is actually designed so that only measurements for the sleep time should be imported.
What would you recommend? Is there a way to determine the sleep time based on the CPAP so that I don't import the pulse outside of these times, for example?
I think that's enough questions for the first round.
RE: OSCAR: Questions regarding a potential import for Garmin data
#1. I believe you would need to create the additional channel declarations to address this.
#2. & #3. If each observation is timestamped, then it would be easy to parse the data to compare against a sleep session. Otherwise, that could be a biddy.
Have you looked at the Somnopose loader? It parses a CSV file.
- Red
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.
RE: OSCAR: Questions regarding a potential import for Garmin data
(10-19-2024, 10:03 AM)Crimson Nape Wrote: Have you looked at the Somnopose loader? It parses a CSV file.
- Red
yes, I have look on different loaders. I had already written a Python program that transforms the garmin data into Zeo and md300w1/somnopose files. But handling so many files is no fun.
And in the end, every file format had its limitations and problems.
My main "concerns" are that each loader only supports one machine type and I am not sure what role the machine types play in OSCAR or how I can implement a loader that would fill so many channels over different machine types.
I hope that one of the developers can say something about this.
12-14-2024, 11:34 AM (This post was last modified: 12-14-2024, 11:40 AM by littleyoda. Edited 3 times in total.)
RE: OSCAR: Questions regarding a potential import for Garmin data
[I'm not allowed to post links]
Hi
I have a working fork of Oscar where you can import Garmin data.
Currently you have to run a Python programme which generates data and which you can later import into OSCAR.
github.com/littleyoda/oscar/tree/garmin
And the issue in the gitlab repository:
gitlab.com/CrimsonNape/OSCAR-code/-/issues/5
As the approach works for me and no one has shown any further interest so far, I have not developed it any further.
I'm not sure if I really want to port relevant parts of the Python garmin connect library[/url] to C++.
Attached an example with movement and stress level from a garmin watch.
RE: OSCAR: Questions regarding a potential import for Garmin data
Notes:
- Compiling OSCAR from source is straight forward on Ubuntu (- it took a bit of effort to figure out what packages to install on Fedora though)
- Garmin .json downloader works fine, and the importer too
- i have a DST or timezone offset of one hour I need to straighten out - I'll tinker a bit aournd and possibly add a command-line switch to the python downloader, to sort this out.
Unresolved:
I suspect the time in my AirSense is a few minutes off - Is it a known phenomenen, that the time drift on these devices?
(the fact that the normal Oximeter import has fineadjust on the imported timestamps kind of hints to this)
I would like to get as-precise-as-possible sync between Airsense and Garmin data, to try to identify patterns.
An error in sync of the clocks of e.g. 10 seconds could be a problem if I want to distinguish between 1) i move because I wake up or 2) I wake up because I move.
RE: OSCAR: Questions regarding a potential import for Garmin data
Thank you for trying out my changes.
Yes, time zones is still a problem with the Airsense 11. My source code tries to corrected it for Europe (CET/CEST), but I couldn't test it outside of Europe yet.
I also thought about correcting the timestamp in the Python script, but I wasn't happy with this approach. Best way is to correct it in oscar, but since oscar stores the time as local times, as I understand it, this is not easy either.
I have not yet tested how accurate the time is in Airsense 11. Since it had a GSM module built in, I assumed that it should be accurate to the second.
Unfortunately, your desired accuracy in the seconds range will not be achievable. Garmin only provides the information for one minute at a time:
12-29-2024, 05:48 AM (This post was last modified: 12-29-2024, 06:01 AM by bedeee. Edited 7 times in total.)
RE: OSCAR: Questions regarding a potential import for Garmin data
Let me repeat: This is great :-)
A lot of things to observe here (nothing related to the quality of the software):
Garmin Sp02 is always 3~5% off on me (I have two samples of this from the sleep lab, where I was allowed to try a medical Ox sensor while awake)
I suspect the difference between the plateaus of 90 and 95% is because I'm sleeping on the arm, thus restricting flow a bit to/near the skin, where Garmin measures. Or just sleeping on that side moves the watch a bit. But I have no data to back that claim.
The resolution is 2 minutes for heart rate on my Phenix 6
The (3D) accelerometer-data is aggregated into "movement-data", and with a resolution of 1 minute.
There is no (3D) magnetometer data available at all. I was planning on having a second cheap garmin on my chest, to show sleep position (right/left side, back). But that seems not possible.
But hey - the watch was free (I had it already) so the possibility of having this data integrated for free is great.