Skip to content

Takes a CSV file from the Sleep as Android app and generates monthly JSON files with the data provided, excluding noise recording information.

License

Notifications You must be signed in to change notification settings

GwynHannay/sleep_parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sleep Parser

Top Language Licence Last Commit Latest Release Total Downloads

Data in the Sleep as Android app comes in a CSV file that is very difficult to process with the aim of examining it because each sleep record is of variable length. It's made up of header rows and values rows.

This project is designed to process sleep data in its raw format and output it into a more friendly format.

Right now, this just takes a CSV file from the Sleep as Android app and converts it into a JSON file, but future goals are to allow for more options and move on to sleep data from other systems, including CPAP machines.

Screenshots

Original Sleep as Android CSV file:

Screenshot 2021-12-26 061759

Screenshot 2021-12-26 061830

Script output:

Screenshot 2021-12-26 062027

Resulting JSON file:

Screenshot 2021-12-26 061838

image

Usage

Using this is easy! From the main folder of this repository, simply create the path /sleep-as-android/csv/ and place your sleep-export.csv file there.

image

Alternatively, you can change the relative file path in main.py. You can do this for the location of the CSV file, and specify where the JSON files should go as well (don't include a forward slash after the directory name).

image

Release History

  • 1.0.4
    • FIX: Time zones are now added when converting Unix timestamps into datetimes for events.
  • 1.0.3
    • CHANGE: Raise an exception if the CSV file is not detected as being a valid Sleep as Android export.
  • 1.0.2
    • FIX: Errors when running on a web server caused by attempt to subscript types such as dict[str, str].
    • ADD: Ability to specify output directory for JSON files.
  • 1.0.1
    • CHANGE: Update of README.
  • 1.0.0
    • Original project launch.

General Information

Language: Python 3.9.7

Handles files: CSV, JSON

Distributed under the GNU GPL v3 license. See LICENSE for more information.

About

Takes a CSV file from the Sleep as Android app and generates monthly JSON files with the data provided, excluding noise recording information.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages