Building a privacy-first health app - update #7
Tags: food, nutrition, opensource, redwoodjs
Published: 2023-09-14 19:09:40

---
title: Building a privacy-first health app - update #7
published: true
date: 2023-09-12 22:31:46 UTC
tags: food, nutrition, opensource, redwoodjs
canonical_url: https://n00bgineer.wordpress.com/2023/09/13/openhealth-update-7/
---

## **Introduction**

In the previous update, I’d mentioned that I’ll be implementing the mutation to add the food items & I did that, but since I didn’t have enough time before submitting the application demo for the **[Redwood Build Competition](https://build.redwoodjs.com/)**, so I went ahead and completed the prototype.

## **Update**

1. I completed the food search screen, which now also allows users to add multiple food items in one go. e.g. Just had a breakfast with a toast, a cup of tea and an apple? Add them to your timeline in one go.
2. I completed the profile screen which shows daily nutritional stats for the user.
3. I completed the timeline screen showing all the foods that a user has consumed.
4. I deployed the application to openhealth.run through Vercel. Luckily, I didn’t the face the same issues as I faced during the development of [Tracepath](https://x.com/n00bgineer/status/1666822883912613892?s=20).
5. I also made a demonstration video for [OpenHealth](https://www.youtube.com/watch?v=vTIqWmfk4tQ&list=PLiPWtqhuUsQCZumW6uf-qxJvbPixBaUXK&index=3&t=1s).

## **Next steps**

1. Before I update or create any feature on OpenHealth, I want to first explore the [FDC dataset](https://fdc.nal.usda.gov/download-datasets.html) from multiple angles by dumping it into a local PostgreSQL database. Some of the things that I want to explore are: 
  - How the nutritional composition of the same food item varies from one brand to another brand. **My hypothesis is that variance for nutritional composition for same food item between any two brands is negligible.** If this is true, then it’ll eliminate the need for the second search tab and simplify the overall search process, but over a discussion with **Chris Boertien** (@chrisbod4) in the Redwood Discord channel, I discovered that even with similar nutritional profiles, food items might actually vary by a particular variable (e.g. %fat in Sausage). ![](https://n00bgineer.files.wordpress.com/2023/09/screenshot-from-2023-09-13-02-57-48.png)
  - Understanding the different derivation codes for different nutrients and how to enable a proper nutritional accounting for the food items that have been added e.g. I found that a single food item can have different values for the same nutrient. e.g. “Energy” can be derived analytically (it’s derivative code is “A”) or by other methods. This is important to understand and create a **hierarchy for nutritional accounting** for showing these stats to the users.
  - Among other things …
2. I also want to understand the ideal way to track **`servingSize`** and `servingSizeUnit` for any given food, solid or liquid, as asking users to add serving information in grams or milligrams or milliliters (for foundational/unbranded food items) is confusing as hell. 
  - e.g. Food items that are available in discrete quantities (e.g. a slice of pizza – small, medium or large) are easy to account for, but what about the food items that have continuous quantities or maybe they have a discrete quantity but it’s impossible to track it’s individual units physically (e.g. Rice)? In fact, yesterday, I queried my mom about the amount of rice that I generally consume during lunch and she mentioned that it must be somewhere between 30-50 grams & I think that for some food items **the answer (probably) lies not with the scientific unit like gram or milligram, but with the size of the container in which we consume these foods or drinks** e.g. A pint of beer, 1/4 cup of Bhakarvadi. Anyway, I have to think more about this question.
3. **Building a bottom up food database**. While having a conversation with Chris, I also realized the need for building a better food database where the nutritional values for the food item is accounted from it’s base ingredients. This way, we can build a nutritional food database even for non-English speaking countries (e.g. India).

## **Screenshots**

![](https://n00bgineer.files.wordpress.com/2023/09/image.png?w=1024)
_Track multiple food items_

![](https://n00bgineer.files.wordpress.com/2023/09/image-1.png?w=1024)
_Profile & stats screen_

![](https://n00bgineer.files.wordpress.com/2023/09/image-2.png?w=1024)
_Timeline screen_