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

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sleep Parser

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.

State at 26th December 2021: The MVP is almost done, after which a proper versioning process will be put in place. It currently outputs a monthly JSON file for Sleep as Android CSV files, but if there is any noise recording it will simply exclude that row from the output.

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

Screenshot 2021-12-26 061844

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.

Alternatively, you can change the relative file path in main.py.

Technologies

Language: Python 3.9.7

Handles files: CSV, JSON

Badges

Top Language

Last Commit

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