wr1t3r

Adding foods to your Nutrition Database

Every food you log comes from a table in a note called Nutrition Database, in your own Dropbox or Google Drive. Each row is one food: its name, a serving, then calories, fat, carbs, protein and fiber for that serving, a food group and any other names you call it by. If you don't have the note yet, the Food button's Make one makes it.

There are five ways to fill it.

From a USDA search

On the Food button, type a food and press Search USDA. Picking a result adds it to the table and logs it.

From a photo of the barcode or the label

On the Food button, the 📷 at the end of the search box (or Commands > Add a food from a nutrition label photo) takes a photo of a package, or opens the camera on a phone. The photo is read on your device and never leaves it.

If the photo shows a barcode, wr1t3r first checks your Nutrition Database for it. If it isn't there, it looks the number up in Open Food Facts, a free, open database of packaged foods. Only the barcode's digits are sent. The food is added with its barcode as an alias, so the next scan finds it in your own database.

If there's no barcode, or Open Food Facts doesn't have it, wr1t3r reads the Nutrition Facts label instead. It fills in the serving size, calories, fat, carbs, protein and fiber, and shows them beside the photo. Either way, check the numbers and the name before you save. If the calories are far from what the fat, carbs and protein add up to, it says so, because that usually means a number was misread. Small differences are normal: makers may use each food's own calorie factors. Labels read best when they're flat, well lit and US-style.

By hand

Open the Nutrition Database note and add a row to the table, one cell per column. Put other names in the Aliases cell, separated by commas, and the Food button finds the food by those too.

From a spreadsheet

Commands > Import foods into the Nutrition Database takes a CSV file: Excel, Numbers and Google Sheets all save one, and many food trackers can export one. The first row has to name the columns. Their order doesn't matter, and columns it doesn't know are skipped.

Column Also matches
Food Name, Food Name, Description, Item needed
Calories Energy (kcal), kcal, Energy needed
Serving Size Serving, Amount, Portion "1 serving" if it's missing
Fat Total Fat grams; 0 if it's missing
Carbs Carbohydrates, Total Carbs grams
Protein grams
Fiber Fibre, Dietary Fiber grams
Food Group Group, Category "Other" if it's missing
Aliases other names, separated by commas

Units in brackets, like Fat (g), are fine. A food already in your table (same name) stays as it is, so importing the same file twice doesn't add anything twice. If a file lists a food more than once, the first one wins.

From your recipes

A recipe note gives you one row for a whole dish, per serving. Give the note a yield property with the number of servings it makes, then list what goes in under an Ingredients heading:

## Ingredients
- Ground beef, 2
- Kidney beans, 1.5
- Onion, 1 (diced)
- Chili powder, 0.5

## Instructions
...

With the note open, Commands > Add this recipe to the Nutrition Database adds it as a row named after the note (or its title property), in the Recipe food group. Change the recipe and run it again to update the row. Recipe notes made from the Obsidian Recipe template also have a Sync to Nutrition Database button that does the same thing, with a Find them in USDA foods link when ingredients are missing.