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 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.
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?
Questions on values present in the sleep-export.csv file:
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?
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.
How are the value of Cycles and DeepSleep calculated?
I assume it is (at least) influenced by movement data I ask about above.
If heart rate and O2 are recorded do those affect the sleep levels, DeepSleep and Cycles values?
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.
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.
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?
I notice that the page for converting the CSV file to JSON format has been out of commission for a while, so it might help to note that I have a webpage for people to do this if they wish to use it: Reference Desk Projects.
Alternatively, the code I wrote to do this is also publicly available under the GPL-3.0 licence, so feel free to use and expand upon that if it suits: Sleep Parser.