Pt 3. Visualising the data for Food and Migraines

Home Assistant Logo

If you regularly experience any of the symptoms I list in this article, it is entirely possible that like me your migraines may be triggered by something in your diet! This is not medical advice, I am not a Medical Professional, do not take medical advice from internet strangers. If you are suffering from similar symptoms, consider approaching a medical professional before biohacking your life. This was my journey, I hope it brings relief to others.

Introduction Link to heading

Practically every single day, for the last 15 years, I’ve woken up with a migraine and gone to bed with one. It started 15 years ago at a friend’s wedding. The evening before we’re sharing a beer (Budweiser) chatting about the upcoming wedding, we go to bed, then at 3am in the morning I’m woken by the worst headache I’ve ever experienced. Cue 15 years of near daily migraines, not as devastating as the first migraine, but debilitating none the less.

Then I started to track my diet and symptoms with the help of Home Assistant. The goal? Identifying if something in my diet was the trigger for my migraines (And other symptoms).

Read more about my journey here

Collecting the Data Link to heading

Note that Home Assistant is not necessary to collect data, a paper and pen works just as well. While paper and pen didn’t work for me, I wanted machine readable data, Paper and pen may work for you. Don’t get hung up on the data collection methodology, there are apps out there, use them or don’t.

The Data Structure Link to heading

Using Python, Pandas and Plotly, I developed a lookup to add suspect ingredients to the initial dataset, along with a visualisation to visualise the relationship between my diet and migraines.

The initial collected data Link to heading

DateTimeCategoryItemData
2025-01-1613:36FOODChip Shop Burger Chips60
2025-01-1613:36HEADACHERECORD1
2025-01-1617:28WEIGHTRECORD75.4Kg
2025-01-1619:37FOODRice48
2025-01-1619:37FOODRoast Pork0
2025-01-1619:37FOODVegetables0
2025-01-1701:30FOODApple Juice10
2025-01-1704:20FOODApple Juice10
2025-01-1708:35FOODLactose Free Milk0
2025-01-1708:35FOODSugar4
2025-01-1708:35FOODWeetabix13
2025-01-1708:35FOODWeetabix13
2025-01-1712:35FOODChipolata Sausages0

Adding Ingredients to Foods in the dataset Link to heading

During my data collection and the initial discovery phase, I started to draw a conclusion that it wasn’t a food item, i.e. bread or cheese, it was a component of that food item, an ingredient. To build a more comprehensive data set, I needed to add the ingredients to my data so I setup a small lookup table and kept note of suspect ingredients that I could later add to the initial collected data.

ItemIngredientsIngredients_list
ButterCasein/Whey/LactoseButter - Casein/Whey/Lactose
CheeseCasein/Whey/LactoseCheese - Casein/Whey/Lactose
Choccie CoffeeCasein/Whey/LactoseChoccie Coffee - Casein/Whey/Lactose
Diabetic ChocolateCasein/Whey/LactoseDiabetic Chocolate - Casein/Whey/Lactose
Lactose Free CheeseCasein/Whey/LactoseLactose Free Cheese - Casein/Whey/Lactose
Parmaggio Regianna CheeseCasein/Whey/LactoseParmaggio Regianna Cheese - Casein/Whey/Lactose
CeleryCeleryCelery - Allergenic
Black Bean SauceWheat/GlutenBlack Bean Sauce - Wheat/Gluten
Chicken SatayWheat/GlutenChicken Satay - Wheat/Gluten
Chipolata SausagesWheat/GlutenChipolata Sausages - Wheat/Gluten
Cofast Potato Spicy SnackWheat/GlutenCofast Potato Spicy Snack - Wheat/Gluten
Cornish PastyWheat/GlutenCornish Pasty - Wheat/Gluten
Frozen BurgersWheat/GlutenFrozen Burgers - Wheat/Gluten
Chip Shop Burger ChipsWheat/Gluten’, ‘Casein/Whey/LactoseChip Shop Burger Chips - Wheat/Gluten,Chip Shop Burger Chips – Casein/Whey/Lactose

The Visualisation Link to heading

Using Python, Pandas and Plotly I merged the Food / Symptom Diary and Ingredients datasets to produce this interactive visualisation:

snapshot of the Food / Ingredient / Symptom Visualisation

http://rodders.me/health_data_tracker_visualisation/vertical_food_timeline.html

Click on the image or link to open the visualisation, hover over the dots for details of foods consumed (Blue) and Suspect ingredients of those foods (Green), click drag to select an area to zoom into, double click to zoom out. Additional controls are in the top right of the plot.

Read more about my journey here