Topic Archives: Personal Projects
We recently released our QS Access app, which allows you to see HealthKit data in tabular format. Not very many tools feed data into HealthKit yet, but Apple’s platform does pick up step data gathered by the iPhone itself. I have step data on HealthKit going back about two weeks. When Ernesto Ramirez and I were playing around with QS Access, loading the data into Excel and looking at some simple charts, I learned something: Even when I’m active, I’m sedentary.
My daily step totals ranged from a depressing 3334 steps on Thursday, September 18 to an inspiring 21,634 steps on Friday, September 25, but – as these charts clearly show – even on the extreme days my activity was concentrated into relatively short periods when I got up from my desk and went out to do something. Most hours, every day, were spent with hardly any movement at all. I’m sitting at my desk, and sitting at my desk some more, and sitting at my desk still more. That’s probably not good. No, not good at all.
Pulling my data out of HealthKit and seeing a few simple charts gave me a bit of insight that I hope will lead to a change in how much I sit. It was a great to be able to easily make some simple analysis of my data. I hope you’ll find QS Access useful also (you can learn more about it here). Please share what you learn in the QS Access thread in the QS Forum or by emailing us about your projects: firstname.lastname@example.org.
Earlier this week we posted an update to our How To instructions for downloading your Fitbit data to Google Spreadsheets. This has been one of our most popular posts over the past few years. One of the most common requests we’ve received is to publish a guide to help people download and store their minute-by-minute level step and activity data. Today we’re happy to finally get that up.
The ability to access and download the minute-by-minute level (what Fitbit calls “intraday”) data requires one more step than what we’ve covered previously for downloading your daily aggregate data. Access to the intraday data is restricted to individuals and developers with access to the “Partner API.” In order to use the Partner API you must email the API team at Fitbit to request access and let them know what you intend to do with that data. Please note that they appear to encourage and welcome these type of requests. From their developer documentation:
Fitbit is very supportive of non-profit research and personal projects. Commercial applications require additional review and are subject to additional requirements. To request access, email api at fitbit.com.
In the video and instructions below I’ll walk you through setting up and using the Intraday Script to access and download your minute-by-minute Fitbit Data.
- Set up your FitBit Developer account and register an app.
- Go to dev.fitbit.com and sign in using your FitBit credentials.
- Click on the “Register an App” at the top right corner of the page.
- Fill in your application information. You can call it whatever you want.
- Make sure to click “Browser” for the Application Type and “Read Only” for the Default Access type fields.
- Read the terms of service and if you agree check the box and click “Register.”
- Request Access to the Partner API
- Email the API team at Fitbit
- They should email you back within a day or two with response
- Copy the API keys for the app you registered in Step 1
- Go to dev.fitbit.com and sign in using your FitBit credentials.
- Click on “Manage My Apps” at the top right corner of the page
- Click on the app you created in Step 1
- Copy the Consumer Key.
- Copy the Consumer Secret.
- You can save these to a text file, but they are also available anytime you return to dev.fitbit.com by clicking on the “Manage my Apps” tab.
- Set up your Google spreadsheet and script
- Open your Google Drive
- Create a new google spreadsheet.
- Go to Tools->Script editor
- Download this script, copy it’s contents, and paste into the script editor window. Make sure to delete all text in the editor before pasting. You can then follow along with the instructions below.
- Select “renderConfigurationDialog” in the Run drop down menu. Click run (the right facing triangle).
- Authorize the script to interact with your spreadsheet.
- Navigate to the spreadsheet. You will see an open a dialog box in your spreadsheet.
- In that dialog paste the Consumer Key and Consumer Secret that you copied from your application on dev.fitbit.com. Click “Save”
- Navigate back to the scrip editor window.
- Select “authorize” in the Run drop down menu. Click run (the right facing triangle).
- Select “authorize” in the Run drop down menu. This will open a dialog box in your spreadsheet. Click yes.
- A new browser window will open and ask you to authorize the application to look at your Fitbit data. Click allow to authorize the spreadsheet script.
- Download your Fitbit Data
- Go back to your script editor window.
- Edit the DateBegin and DateEnd variables with the date period you’d like to download. Remember, this script will only allow 3 to 4 days to be downloaded at a time.
- Select “refreshTimeSeries” in the Run drop down menu. Click run (the right facing triangle).
- Your data should be populating the spreadsheet!
If you’re a developer or have scripting skills we welcome your help improving this intraday data script. Feel free to check out the repo on Github!
In this video from the Boston Quantified Self Show&Tell, Matthew Ames describes the self-tracking project that dramatically changed his weight and fitness. Beginning with simply measuring his weight daily using a Withings scale, he added together a number of common QS tools, including Weight Watchers, Runkeeper, MyFitnessPal, Garmin Forerunner watch, and the Nike+ system, to support his self-transformation.
Sami Inkinen, triathalete, self-quantifier, and founder of Trulia, measures his mood on a five point scale every morning, within five minutes of waking up. This method fascinates me. I do something similar (though I use only a three point scale). Sami has found that this quick and easy measurement reliably correlates with his athletic performance, suggesting that it indeed measures something significant about his overall well being in the day ahead.
Read Sami’s full post here: What the first 2 minutes after waking up can tell you about the day ahead?
Typically when the Quantified Self-er talks about using photography and image capture for self-tracking they’re talking about taking pictures of their food. Pictures are a very powerful way to capture information for better understanding, you know, they are worth a thousand words. On the blog here we’ve also highlighted a few really interesting projects that take the idea of using visual images for tracking and decided to turn the lens around such as Jeff Harris and his 13 years of self portraits.
One of the projects that I found super interesting was LifeSlice by Stan James.
For those of you who want to try LifeSlice Stan has put the code online for you to use and possibly tinker with. As a new user I can say that it is pretty interesting to see how my facial characteristics map to what I’m doing on the computer. For examples here’s me looking at a new statistical software package for mac (Wizard).
And here’s me writing this post while listening at a conference on health data.
The last project I want to highlight here is the self-portrait project of Noah Kalina. Noah is a photographer who has been taking self portraits every day for 12.5 years (January 11, 2000 – June 20, 2012). A few months ago he put all 4514 images together into one amazingly insightful video.
Than Tibbetts was so intrigued by this project he decided to work some fancy image processing magic to find out what “Average Noah” looked like and found this:
I’m sure there are more projects out there that involve individuals turning the camera on themselves. We all have cameras with us in our pockets and on our computers. How are you using those image capture technologies to better understand yourself? If you’re working on something interesting let us know!
A great talk on a Polyphasic Sleep experiment by Emi Gal, the CEO of the interactive advertising platform Brainient.
“The main takeaway was that it is fun, but not sustainable. None of the polyphasic sleepers have succeeded in doing it more than six months. You always act tired…”
If you’ve experimented with polyphasic sleep, we’re interested in your stories.
My personal science introduced me to a research method I have never seen used in research articles or described in discussions of scientific method. It might be called wait and see. You measure something repeatedly, day after day, with the hope that at some point it will change dramatically and you will be able to determine why. In other words: 1. Measure something repeatedly, day after day. 2. When you notice an outlier, test possible explanations. In most science, random (= unplanned) variation is bad. In an experiment, for example, it makes the effects of the treatment harder to see. Here it is good.
Here are examples where wait and see paid off for me:
1. Acne and benzoyl peroxide. When I was a graduate student, I started counting the number of pimples on my face every morning. One day the count improved. It was two days after I started using benzoyl peroxide more regularly. Until then, I did not think benzoyl peroxide worked well — I started using it more regularly because I had run out of tetracycline (which turned out not to work).
2. Sleep and breakfast. I changed my breakfast from oatmeal to fruit because a student told me he had lost weight eating foods with high water content (such as fruit). I did not lose weight but my sleep suddenly got worse. I started waking up early every morning instead of half the time. From this I figured out that any breakfast, if eaten early, disturbed my sleep.
3. Sleep and standing (twice). I started to stand a lot to see if it would cause weight loss. It didn’t, but I started to sleep better. Later, I discovered by accident that standing on one leg to exhaustion made me sleep better.
4. Brain function and butter. For years I measured how fast I did arithmetic. One day I was a lot faster than usual. It turned out to be due to butter.
5. Brain function and dental amalgam. My brain function, measured by an arithmetic test, improved over several months. I eventually decided that removal of two mercury-containing fillings was the likely cause.
6. Blood sugar and walking. My fasting blood sugar used to be higher than I would like — in the 90s. (Optimal is low 80s.) Even worse, it seemed to be increasing. (Above 100 is “pre-diabetic.”) One day I discovered it was much lower than expected (in the 80s). The previous day I had walked for an hour, which was unusual. I determined it was indeed cause and effect. If I walked an hour per day, my fasting blood sugar was much better.
This method and examples emphasize the point that different scientific methods are good at different things and we need all of them (in contrast to evidence-based medicine advocates who say some types of evidence are “better” than other types — implying one-dimensional evaluation). One thing we want to do is test cause-effect ideas (X causes Y). This method doesn’t do that at all. Experiments do that well, surveys are better than nothing. Another thing we want to do is assess the generality of our cause-effect ideas. This method doesn’t do that at all. Surveys do that well (it is much easier to survey a wide range of people than do an experiment with a wide range of people), multi-person experiments are better than nothing. A third thing we want to do is come up with cause-effect ideas worth testing. Most experiments are a poor way to do this, surveys are better than nothing. This method is especially good for that.
The possibility of such discoveries is a good reason to self-track. Professional scientists almost never use this method. But you can.
We’ve already published this QS Show&Tell talk by Mark Drangsholt about using self-tracking to identify the triggers of his heart problems, lessen their frequency, and make good decisions about treatment. I’m re-posting it here to focus on attention on the interesting and powerful method Mark used, the case-crossover design, and invite you to think about whether this has promise for your own self-tracking projects.
Mark is a professor and chair of oral medicine at the University of Washington School of Dentistry. He’s a triathlete and long time self-tracker. He is in good physical condition, but suffers from heart ailments that are frightening and dangerous. For instance, he has tachycardia (sudden acceleration of heart rate). At times his heart goes from 60 to 220 beats per minute. It feels like his heart is going to jump out of his chest. He also has atrial fibrillation, with palpitations, a feeling of immanent doom, and a sense that he is choking.
“The first time it happened in 2003 I really thought I was dying,” Mark says in his talk. He had always assumed that if he ever had a heart attack he, of all people, would know to pick up the phone and call 911, but the opposite happened. He just thought to himself “this is it,” and slumped down in his chair. Fortunately, he survived, and when he recovered he asked himself whether he could identify the triggers of these unpleasant events and avoid them. He created a simple Excel table of all episodes for one year, on which he recorded information about his attacks.
Mark is an expert on evidence based medicine, so he was naturally curious about what kind of evidence his self-tracking data contained. In standard reference material on medical evidence, students learn about a hierarchy that goes something like this:
- 1 or more randomized controlled trials
- 1 or more cohort studies
- 1 or more case-control studies
- 1 or more case-series
- expert opinion without above evidence
Mark’s self-tracking data didn’t naturally fit with any of these approaches. To understand whether these triggers actually had an effect on his arrhythmias, he used a special technique originally proposed by the epidemiologists Murray Mittleman and K. Malcolm Maclure. A case-crossover design is a scientific way to answer the question: “Was the patient doing anything unusual just before the onset of the disease?” It is a design that compares the exposure to a certain agent during the interval when the event does not occur to the exposure during the interval when the event occurs.
Using this method, Mark discovered that events linked to his attacks included high intensity exercise, afternoon caffeine, public speaking to large groups, and inadequate sleep on the previous night. While these were not surprising discoveries, it was interesting to him to be able to rigorously analyze them, and see his intuition supported by evidence.
“A citizen scientist isn’t even on the conventional evidence pyramid,” Mark notes. “But you can structure a single subject design to raise the level of evidence and it will be more convincing.”
Please let us know if you use this method in your own projects. We’ll post more reports when we have them.
REFERENCES AND GUIDES
There are some tricks to doing a good case-crossover study on yourself. Mark’s video provides a basic introduction. For technical details, this detailed introduction to case-crossover design by Yue-Fang Chang especially useful.
The seminal paper on case-crossover design is “The Case-Crossover Design: A Method for Studying Transient Effects on the Risk of Acute Events” by Malcom Maclure. (1991) [PDF] A search on Google Scholar for case-crossover design will get you deep into this literature. Unfortunately very little of it involves the kind of n-of-1 studies we’re usually interested in, but there are many technical details that may contain clues for dedicated experimenters.
One paper that will be of special interest is this one: “Should We Use a Case-Crossover Design?” by K. Malcolm Maclure and his collaborator Murray Mittleman. (2000) [PDF] In the midst of discussing technical details important for scientists proposing to use this method in studies funding by research grants whose reviewers may not be familiar with it, Maclure and Mittlemen describe using case-crossover analysis to retrospectively understand more about the death of Maclure’s father. I quote the relevant section below:
We did an n-of-1 case-crossover study of hypothesized triggers of repeated syncope experienced by Kenneth Maclure (MM’s father), who was diagnosed with sick sinus syndrome and died of fatal MI at age 73 during a morning swim, after several other potential triggers. The target person times wereKenneth’s 62nd–74th years (and subsequent years if he had lived longer). The study base comprised the years 1980–1981 and 1986, during which there were 33 instances of syncope. We restricted the study base to those years because his wife, Margaret, was willing to review only 3 years of her diaries because the memories rekindled her grief. We had no intention to generalize the findings to other individuals, only to other years. Our goal was to identify triggers to which Kenneth may have been susceptible and to test Margaret’s general hypothesis, “Perhaps I should have done more to help him avoid stress.” Hypothesized triggers included visitors to the home, trips out of town, eating out, unusual exertion, and so on. The 24-h period before an episode of syncope was classified as a case day. Each case day was matched with a control day, the same 24-h period 2 weeks before. Margaret was surprised by our null findings and relieved some lingering feelings of guilt.
Aarti Vashisht has done some interesting QS-related work for her MFA at Art Center College Design.
She designed some prototype sensors that could be worn on our bodies in the future, and interviewed people to learn their thoughts on how these integrated sensors might impact their lives.
This is an image of the sensors she designed, to be worn across the shoulders and on the wrist, among other places. Take a look at her report here, called Temple of Self.