Usually when you read about headaches in the context of data science and machine learning, it’s not in a positive context - generally, it involves the painful (so to speak) process of data cleaning that can take up to 80 percent of the time in a data project. But this, friends, is a story of data science and how - in some cases - it can be harnessed to cause fewer headaches - literally. Migraines, to be specific.
As someone who had been riding horses for years, I have sustained four falls - and four concussions. After the first concussion, I began to get migraines two to three times a week. Then, after graduate school I (fortunately) began a job working with data scientists. Though not a data scientist myself, I have a good grasp of the tools and began to realize the potential for a data project that could positively impact my life.
The Data
To be able to better track my migraines and what causes them, I keep a detailed database including:
-
Exact time of migraine.
-
Length of migraine.
-
Foods consumed the day of migraine.
-
Exposure to strong smells the day of migraine.
-
Specific medications taken in response to migraine.
On top of my own migraine data, I added in a few other databases to help enrich the data. Adding in National Oceanic and Atmospheric Administration (NOAA) data about each date I got a migraine allowed for better modeling around what kinds of weather gives me migraines. Specifically, I wondered if looking at the barometer and changes throughout the day would give any clues due to the proven link between migraines and barometric changes.
Data from NOAA on changes in barometric pressure (in this case, extreme - after a tropical storm)
I also added in data from my Fitbit around sleep. Specifically, hours slept for the night before, during and after a migraine. I figured that this would help me understand how sleep affected my migraines.
The Analysis: Storms, Sleep, and Smells
Using all of this data (both my compiled database and the outside sources), I began to do simple analysis using R to understand if there were any correlations or factors causing my migraines - patterns that I might not have easily realized myself.
With quite a lot of help from data scientists I worked with at the time, I was able to unravel the mess of data I had and begin to understand more details about what causes my migraines. I was able to see that only specific types of changes in weather really affect me - primarily dramatic changes. For instance, going from sunny, rainy, sunny, or vice versa. By contrast, prolonged weather patterns (like if it remained rainy for a long period of time) did not show a pattern of migraines. This was different from what I thought before, which was that all stormy weather affected me.
By examining the data as a whole, I also was able to identify larger patterns and indicators in terms of sleep data. For example, before a migraine, I slept an average of two hours less than on a non-migraine night. After a migraine went away, I spelt an average of three hours more for the first night after a migraine.
A sample of sleep data provided by Fitbit
I also saw that specific triggers caused me to have either longer or shorter migraines and were receptive to specific medications. The best example was that when I cleaned my house with harsh chemicals or someone cleaned near me, my migraines averaged 2.3 days, while migraines after I have wine were 1.2 days. I also saw that migraines after I had cheese were by far the easiest to treat, lasting only a few hours and responding after the first dose in almost all circumstances.
Prediction and Prevention (Plus Larger Implications for Data + Health Care)
Though these may seem like minor things to find, analyzing this data helped me to understand my migraines more. I still keep detailed records of my migraines and will soon be analyzing the data using Dataiku - I just started here as an implementation manager, so stay tuned! Who knows, in addition to more effectively treating migraines and cutting out known triggers, I might even be able to better predict their occurrence before onset.
More broadly, that is the crux behind using machine learning (as well as deep learning and even AI) in health care as a whole: being able to predict conditions based on symptoms for better and more timely treatment. If you’re interested in learning about more implications for big data and health care, check out this white paper. Or if you want to do your own analysis using Dataiku, download the free version here.