What are Simple Ingredients?


#1

We have a number of our Platform users building apps or services with a nutritional component. As soon as we start talking about nutrition, there’s a whole bunch of things that you’ll discover you need to cover the types of features and functionalities that you need to engage users with different habits and preferences.

Then, once you get into it fully, with real users, you will realise that there’s a bunch of decisions you need to make. Normally decisions that may sacrifice scientific accuracy over usability. You have to decide what’s best for your application and your users. There should be a whole discussion thread on this subject, and I’m sure there will be.

The purpose of this post is to explain how we tackled this problem at Nuwe, when we were building our demo app, called Nutribu and how we ended up with our Simple Ingredients feature, then you can decide if it’s functionality or a variation of it, would be suitable for your product.

Summary

Simple_Ingredients is a nutrition data class we created on the Nuwe platform, to consolidate the USDA raw ingredients data into more simple, human readable objects, each containing a summary of nutritional information for that item.

Deciding how to consolidate the USDA raw ingredients was a process that we took alongside qualified nutritionists, to determine an acceptable nutritional tolerance.

So, to highlight this with an example. If you were to search the USDA database for the ingredient keyword term “banana” and search the Nuwe Simple Ingredients database with the same term, here’s what you would get:

USDA

54 Food items, most of which are pretty useless for us in this context. Compared to:

1 Result. Banana.

So, that’s essentially how it works. Let’s dive a bit deeper into how we’ve done it, as much to raise discussion and suggestions about how this process can evolve to suit your needs.

The Process

It all start with the USDA. Everything here is initially underpinned by the USDA ingredients database. It’s still the most accurate and complete database of ingredients and nutritional data accessible in the marketplace. But it’s a pain to work with. That’s why we imported it and made it more accessible, just like Nutritionix and some other players in the Nutrition/Food API market.

Then we needed to work with the ingredients and make some decisions and have some opinions. This process was led by a qualified nutritionist, and we supported by developing some tools to enable them to experiment with these opinions and decisions, here’s how that looks.

The Admin Tool

Here is a look at the way we structure the ingredients groups. We created a nice drag and drop interface which enables the nutritionist to quickly group and cluster ingredients, into groups and containers.

Containers are just parent groups which only hold child Groups. The Container’s nutritional values are calculated dynamically based on the child items below it in the hierarchy.

Groups are containers, which contain a number of raw ingredients. The Groups nutritional information is based on an aggregation of the selected Raw Ingredients.

And that’s how it works. Cluster raw ingredients into Groups. Groups into Containers.

In the screenshot above, you can see for example, the Container “Drinks”. Inside the Drinks Container, there are Groups, such as Red Wine, White Wine. Both Containers and Groups have nutritional data calculated.

Using this interface, once you’ve created the groups and containers, you can easily sort and structure them by dragging and dropping the items. For instance, you could drag all the groups in Hot Drinks into Drinks Container, to consolidate it. The nutrition for Drinks would update on the fly based on the addition of these new child groups.

In principle, you can go as many levels as you like and further nest groups and and containers. For our use case with Nutribu, we only needed two levels, as you see here.

Creating and Managing Groups and Containers.

In order to do this exercise, we need to have created some Groups and Containers. Here’s how we do that, starting with Groups - the more involved process.

A. The Group Details

  1. GIve your Simple Ingredient group some basic information
  2. Upload an icon (optional, required for Containers)
  3. Determine that it is in fact a Group, as opposed to container.
  4. Set the Group as Live or Test. Test will not be displayed in the endpoint results.
  5. Default Portion Sizes. All the nutritional values are representative of 1g of the Ingredient Group. Users typically will have to specify an amount, at an appropriate unit of measurement (gram, litre, etc.). We decided to manage default portion sizes, so that users could optionally just hit a button in the app’s UI rather than digging around trying to find the exact amount to input. It suck’s for user experience.
  6. The Group’s ingredients are calculated dynamically based on the Ingredients selected in the group (see below). These master values are shown here and can be manually overriden.
  7. And then reset to the defaults when you realise you’re not qualified to make that decision :smile:

B. The Ingredients - Filtering and Selection

You can then search the USDA ingredients database for ingredients to base your Group on. But this is tricky, so first you will want to define some filtering parameters.

So, let’s take our example of our friend, mr “Banana” :banana: . A keyword search here for Banana :banana: , as we know, returns 54 results.

If I select the USDA Category > Fruits and Fruit Juices, I now have a total of 3 results. In this case, I selected the item Bananas, Raw.

Some ingredients, however, require a more complex decision making process, so deciding on the filtering by macro-nutrient value range tolerance would also be useful, especially after having determined a benchmark item - in this case, like our Bananas, Raw item.

You could say, for example, only show me items that have a protein value that is of 10% difference to “Bananas, Raw”.

Then you just select the items and hit “Add Selected”.

At this point, we’ve added one or more ingredients and as a result, the nutrition of the Group is calculated.

That’s it. You can then manually adjust the values if you like, but the basis of the simplified ingredient is set. We then can head back to the drag and drop interface to manage the structure of the groups.

C. Containers

Very simply, these are just like groups, except they are empty.

You can manually assign values if you like. They will automatically calculate the aggregate values of the child Groups.

In Nutribu, we use these containers essentially as Categories.


##Simple Ingredients in Action

So that was quite a long but necessary explanation as to how the process of creating these Simple Ingredients is managed.

The easiest way to understand it, is to see it in action.

The easiest way, is by downloading our Nuwe app, which contains an iOS Framework we created to enable the use of the simple ingredients in an app. In this use case, it’s giving user the fast and simple access to selecting ingredients that they’ve eaten to provide basic food tracking functionalities.


Where to go from here?

  1. Ask us questions. What is / isn’t clear? How can we improve this?
  2. What do you need? We built this feature for our own app - how would you like to use it?
  3. The admin capabilities are currently an internal tool we use - do you want access to these to manage your own Simple Ingredients?
  4. Start using them, take a look at the API Docs here: https://developer.nuwe.co/v1/index.html#get-simple-ingredients