Alexa, how’s my health?

Andy Powell
· 4 min read

I’m a great believer in personal ownership of health data and the ability of individuals to store and maintain their own health records and other information if they want to.

Several years ago, I was knocked off my bike. Luckily, my injuries were nothing more serious than a dislocated middle finger and a broken helmet. At the A&E department where I was taken after the accident they took and X-ray of my hand to determine any immediate treatment. As the doctor showed me the results I pulled out my phone (with my other hand!) and took a photo of the X-ray.

Several weeks later I was referred to a consultant in a private practice (outsourced from the NHS) in a nearby hospital. I turned up to my appointment expecting him to have access to my X-ray. Of course, he had no such access and almost seemed surprised that I was expecting him to have it. “Ah ha”, I said, “I have a copy of the X-ray on my phone”. I showed him the image I had taken and he used it both to determine my likely prognosis and to explain to me the detail of my injuries.

A small anecdote but one that shows, albeit in a small way, the value of taking ownership of your own health records.

On a slightly different tack, if you wear a Fitbit or smart watch then data about your heart rate, exercise levels, sleep patterns and so on are routinely being collected and stored by the manufacturer of that device. This is your data (of course) but by default it is only made available to you in ways chosen by the manufacturer. The data is stored within the confines of that provider and wouldn’t necessarily be easy to get hold of if you moved to a different smart-watch or fitness tracker.

In the case of Fitbit, the data is actually readily available, accessible via their API — which looks to be pretty comprehensive to me. So, yes, if you want to, you can get hold of your own data. Of course, getting hold of that data and having the medical knowledge to understand it are two different things… but let’s take things one step at a time.

It strikes me that if I can collect the data that my Fitbit is recording about me and store it somewhere within my control — in my case that means in the cloud — over long(ish) periods of time (say, 2 to 5 years or possibly even longer) then I’ll be sitting on a resource which might actually be useful to me in terms of analysing, monitoring and assessing otherwise undetected changes in my health.

As a first step towards understanding the kind of data that Fitbit now holds about me I have built a simple Alexa skill, allowing me to say things like “Alexa, ask my Fitbit checker how I slept” or “Alexa, ask my Fitbit checker how my heart is”. The source code and full instructions about how to deploy it are available on Github.

See https://github.com/andypowe11/Alexa-Fitbit-Checker-Skill if you are interested.

As a slight aside, the Fitbit API uses OAuth 2.0 to control access to people’s personal data. The Alexa skill uses an AWS Lambda function to provide the ‘business logic’ of the skill. OAuth 2.0 is primarily designed to be used to control access between applications on the web, i.e. where you are accessing the application using your web browser. It doesn’t work so well in scenarios, like this one, where you are accessing the data using something that isn’t a browser.

The Alexa Skills Kit gets round this by using something they call ‘Account Linking’. By using this, Alexa implements the OAuth 2.0 protocol for you, handling the authentication step that would normally be done by your web browser using the Alexa app on your phone instead. This process seems to work pretty well, though it is nowhere near as usable as the native OAuth 2.0 experience on the web.

Anyway, this Alexa skill is just a first step — basically helping me to understand the Fitbit API and what data is available. My next task is to start capturing the data routinely, putting it into an S3 bucket, AWS DynamoDB database or similar and then finding a way to apply some ML or AI to it. Then it’ll just be the small matter of a 5 year degree in medicine to see if I can do anything useful with it!

Foundations

A blog by andypowe11

Andy Powell

Written by

Chief Technical Officer, Eduserv

Foundations

A blog by andypowe11