CSV file documentation - Sleep as Android

The sleep-export.csv file is a backup file that contains data from sleep records. Each record is saved onto two lines (manually inserted sleep records) or three lines (sleep records recorded by sleep tracking).

This is a companion discussion topic for the original entry at https://docs.sleep.urbandroid.org//devs/csv.html
1 Like

This should really mention the ‘Event’ fields, which seem to match the storage API Event Labels, with the exception that there are both ‘DHA’ and ‘DEVICE’ events which are not mentioned under EVENT Labels at all.

Also, it would be useful to have a better explanation of some of the fields, like how exactly the ‘Geo’ field is generated.

1 Like

I am also facing the same problem as zeph.
Could you please provide the meaning of the events? I’m seeing DHA, DEVICE, LUX which are not there in the storage API. Further, there is a floating point after the timestamp for some of these events. What are those?
And there is a list of floating points with the frame rate. Are those actigraphy values?

1 Like

Questions on values present in the sleep-export.csv file:

  1. Movement: accelerometric (actigraphic) - what is the range of values? Is each actigraphic value directly based (simply proportional to) on the raw sensor data, or is it the result of SaA algorithms calculating based on the raw sensor data?
  2. What inputs influences the calculated values of Deep sleep, Light sleep, ~REM, Awake? From the urbandroid.org Blog posts it appears to be magnitude and concentration of movement.
  3. How are the value of Cycles and DeepSleep calculated?
    I assume it is (at least) influenced by movement data I ask about above.
  4. If heart rate and O2 are recorded do those affect the sleep levels, DeepSleep and Cycles values?
  5. What sleep-export.csv values trigger the presence of the “watch” (wearables) symbol? Found it by re-inspecting the file: #watch in the “Comment” field.

I’m continuing work on importing Wellue O2Ring sensor data as a modified sleep-export.csv file.

I want to:

  1. Translate the series of accelerometric (actigraphic) sensor readings recorded every 4 seconds by the O2Ring (magnitude seems to be around 150 full scale) in O2Ring export to the same range and interval expected by SaA during import of sleep-export.csv file.
    If I understand correctly the SaA Wearables API expects the data to be in m/s2 and be sent in batches every 120 seconds containing samples spaced 10 seconds apart). Of course the sleep-export.csv file is not laden with actigraphic samples every 10 seconds, so aggregation must be happening internally to SaA.

  2. Calculate using same method as SaA uses internally with live sensor data:
    a. Cycles value (a count I assume)
    b. DeepSleep value (percentage as a decimal I assume)

Instead of calculating and injecting the Cycles and DeepSleep values myself, can a special cycles value (perhaps a value of -2?) be introduced as a new feature that tells SaA to use its algorithms to generate the Cycles and DeepSleep values based on the actigraph readings included in the modified sleep-export.csv file?