Skip to content

Datapoints

Shawn edited this page Jun 11, 2023 · 2 revisions

Snacker is designed to incorporate as much information as possible for every food item. A large amount of this information can be scraped from massive repositories like FoodData Central, but the main appeal is being able to tie additional information, like dietary restrictions, cooking preparation, and more to create a single-destination, completely-comprehensive database.

One additional piece of information to preface everything is that this is built from the perspective of the United States. Specifically, this means that the primary source of data will be sources like the FDA and the USDA. I do also wish to incorporate data from as many countries and regulatory boards as possible, but the structure of the database will treat FDA Nutrition Facts as the "default" nutrition information. That said, there is nothing stopping anyone referencing this API to prefer say, the UK's nutritional information, over the FDA Nutrition Facts.

For all examples of entries moving forward, we will be using a 20-ounce bottle of Coca-Cola as a reference point

Nutrition Facts

Nutrition facts are the most crucial point of data, and they're the ones that will be seen the most. All US Nutrition Facts labes will list Total Fat, Sodium, Carbohydrates and Protein. As such, any manual submission on a food item that is sold in the US is required to have this information at minimum. However, for the full US Nutrition Facts label, the following nutrients are also labeled:

  • Calories
  • Total Fat
    • Saturated Fat
    • Trans Fat
  • Cholesterol
  • Total Carbohydrates
    • Dietary Fiber
    • Total Sugars
      • Added Sugars
  • Vitamin A
  • Vitamin C
  • Vitamin B1-B12
  • Vitamin D
  • Vitamin E
  • Vitamin K
  • Calcium
  • Iron
  • Phoshorus
  • Iodine
  • Magnesium
  • Zinc
  • Selenium
  • Copper
  • Manganese
  • Chromium
  • Molybdenum
  • Chloride

Since these are typically measured per-serving, when added, they must also be submitted alongside the serving and servings per container (typically, it will say "about X servings per container"; when submitting, we will forego the "about" and assume there are precisely X servings per container).

It's also important to note that alongside the measurement of something, there is also a percentage (%DV) that is based on a 2000 calorie diet. Snacker only logs the measurements, not percentages, so there is no need to log the percentages. Any external program looking to get the percentages should be able to run an equation to get the percentage.

Nutrition fact labels will also list ingredients. These will also be tied to the nutrition facts in Snacker.

The nutrition information for an item in Snacker would look something like this:

Base Nutrients:

ID TFat Na Pr
1 0 75 0

Full Nutrients:

ID TFat Na Carb Su AddSu Pr Srv Cal
1 0 75 65 65 65 0 12floz 240

Ingredients:

ID Ingredients
1 carbonated water, high fructose corn syrup, caramel color, phosphoric acid, natorual flavors, caffiene

Product naming, grouping, and identifying

All products should have an additional

Clone this wiki locally