Analyzing the HealthVault Data

Once you have all the data in CSV file, you can open it in Excel (Figure 2-11) and analyze sleep patterns. You will notice that the spreadsheet has data for each sleep session specifying when that session occurred, the total sleep time in minutes, and the time it took to get to bed, termed as SettlingMinutes. I want to understand this data better, so I create a sleep pattern X-Y scatter plot for this information (Figure 2-14).

Sleep session data in an Excel spreadsheet

Figure 2-11. Sleep session data in an Excel spreadsheet

As Figure 2-12 reveals, for the duration of this week the median sleep has been around 400 minutes (i.e., around 6.5 hours), and as the data clearly shows, for the days when it took the longest to get to sleep, the duration of sleep has been lower. So a good indicator of not been able to get to sleep in 10 minutes is a lower and poorer quality of sleep.

Sleep Pattern analysis

Figure 2-12. Sleep Pattern analysis

In fact, for this duration I also want to understand the patterns around awakenings. So using PowerShell we generate another CSV file that focuses on awakenings:

Powershell> get-things sleep | select-object effectivedate -expandproperty awakenings |
Export-Csv d:\sleep-date-aw.csv

We can open the file in Excel and visualize how the awakenings are triggered. It’s very obvious that most awakenings ...

Get Enabling Programmable Self with HealthVault now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.