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

Import Apple Sleep stages into OSCAR with this script
#1
Import Apple Sleep stages into OSCAR with this script
Sharing is caring, right?  Smile

I'm currently too busy to build it right into OSCAR, but here is the Python script to convert your Apple Watch hypnograms to Dreem headband files: 
Apple2Dreem

You can import the result in OSCAR using Data->Import Dreem Data

Try it if you understand how to use it, if you don't then probably leave it alone..

[Image: OSCAR.png]
Post Reply Post Reply
#2
RE: Import Apple Sleep stages into OSCAR with this script
Wow - that is a WONDERFUL job you have done! This functionality has been needed for a long time. I have downloaded your excellent script and used it, but I do have some concerns:

1. The REAME on GitHub is really hard to follow. I assume it screwed up all the lovely formatting you had prepared it with - removing your own newlines and adding its own, somewhat at random! .....Ah, I just thought to download the "README.md" file and that one is formatted almost perfectly.

2. The Sleep Stage chart in OSCAR matches that in my iPhone perfectly - in places! Every night seems to start off well but then, at some point in the night where it rightly switches up to AWAKE mode, it just stays there for the rest of the night. Any idea what is causing this?
Post Reply Post Reply
#3
RE: Import Apple Sleep stages into OSCAR with this script
Thanks for the feedback. 

Send the HealthAutoExport*.json to me, and a screenshot of your Apple hypnogram, then I’ll look at it. (You can PM me your email address).

By the way, each morning I manually add “Time in bed” to the sleep stats on my iPhone. For that start Health on your phone, then Sleep, then Add Data (in the upper right corner) -> In Bed 

Since iOS 18.0 it isn’t added anymore automatically. I recommend to do this, since it is needed for proper sleep efficiency, Sleep latency onset etc. 

(I’ll have a look at the readme later). 

I also have scripts to create hypnograms of it. Which I will share also later. 

Here is an example in which I compare PSG level EEG sleep staging (using OpenBCI+Yasa) with the Apple Watch Ultra.

[Image: Combo-20241110-11-CBD-25mg-Apigenin-730mg-Inositol.png]
Post Reply Post Reply
#4
RE: Import Apple Sleep stages into OSCAR with this script
@BigWing As a follow up, since I haven’t heard from you yet:

For me it works perfectly for a while now. So I assume your HealthAutoExport*.json had the wrong information to begin with. Remember this script converts those files, so if they aren’t okay, than the output of my script will also not be okay.
Post Reply Post Reply
#5
RE: Import Apple Sleep stages into OSCAR with this script
Thanks for doing this, when I import the start time seems to be offset by around 4 hours ie should start at around 9pm but starts at 1 am - any ideas ?
Post Reply Post Reply
#6
RE: Import Apple Sleep stages into OSCAR with this script
Your welcome. Seems like a time zone issue. Can you send me your HealthAutoExport, screenshot of your hypnogram, and the Apple2Dreem.csv? Then I’ll look at it. You can send me your email address via PM if you like.
Post Reply Post Reply
#7
RE: Import Apple Sleep stages into OSCAR with this script
Thanks will do I’m based in Australia if that helps
Post Reply Post Reply
#8
RE: Import Apple Sleep stages into OSCAR with this script
This looks cool, I’m going to try this out soon. 

Will it work for all sleep data from Apple Health, or only sleep data from an Apple Watch?  I own an Apple Watch but don’t wear it while sleeping, but I do wear an Oura ring, which imports its sleep data into Apple Health.
Post Reply Post Reply
#9
RE: Import Apple Sleep stages into OSCAR with this script
I actually don’t know. Could work. It uses Apple Health. Please tell us after you’ve tried.
Post Reply Post Reply
#10
RE: Import Apple Sleep stages into OSCAR with this script
Since Dreem is no longer sold and the company went bankrupt - any idea what the best consumer eeg available is at the moment?
Post Reply Post Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Use OSCAR with CPAP + Oximetry to Determine Sleep Architecture SawyerR 0 90 07-13-2025, 10:34 PM
Last Post: SawyerR
  OSCAR Import Issue from Vihealth CSV? mirkonicoletti 6 185 07-09-2025, 10:15 AM
Last Post: ejbpesca
  Airsense 11 autoset data import only summary data JawsBigFish 6 253 07-08-2025, 05:53 PM
Last Post: JawsBigFish
  Please help me analyze my OSCAR sleep report hazbed999 5 432 04-30-2025, 10:14 AM
Last Post: hazbed999
Ohmy Apple Watch Flagged My Sleep Apnea – Now Navigating CPAP Life snorkslaaper 13 1,046 03-24-2025, 10:27 PM
Last Post: UnicornRider
  Seeking Advice on Persistent Sleep Issues – Fragmented Sleep and Borderline Apnea Jaydeerizle 1 501 03-13-2025, 04:29 PM
Last Post: UnicornRider
  New Apple watch software update, Fine Print. "Sleep Apnea Notification" UnicornRider 2 644 03-10-2025, 06:19 PM
Last Post: UnicornRider


New Posts   Today's Posts


About Apnea Board

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