Introduction and my goal
I am trying to build a recipe book app that can convert meals into nutritional information. The user would enter a recipe, an ingredient at a time and the amount of that ingredient. They would automatically receive total nutritional information for the recipe. E.g. this recipe contains 100kcal, 10g of protein etc.
I’d like a recipe to be made up of an undefined number of ingredients and associated quantities. For example, one line of the recipe would look like this:
[Quantity] [Scale] of [Ingredient]
Or, by way of examples:
100 g of banana
1 cup of oat
[Ingredient] is a collection of ingredients containing a comprehensive list of ingredients, which also contains values of different nutrition. For example, the banana contains 20kcal per 100g. I am looking to connect this to published databases through an API.
[Scale] is a collection of scales, e.g. grams, lbs, ozs, etc. I would like the user to input in the scale of their choice. I would like to do some background maths to convert scales into a standard scale. This is because nutritional information will be determined on one standard scale (e.g. g), and so other quantities on other scales (e.g. cups, oz) need to be converted into the standard scale (e.g. g).
[Quantity] is a number that indicates how much of the ingredient is used, in the following scale.
Now that I’ve explained what I’m trying to accomplish, I’ll let you know what I’ve done. I’ve created relevant 2 collections (in addition to standard ones like users). One called ingredients, and the other called recipes.
I have manage to input which ingredients are used in each recipe, but I’m completely lost as to how to indicate how much of each ingredient should be used. The quantity, scale and ingredient values all need to be connected. I think maybe I need to have a separate collection of selected ingredients, which draws nutritional information from the global ingredient list, but has quantities and scales, but I’m quite confused as to how to get this to work.
I don’t know how to get any background maths to work. If I had an excel sheet, I could do it in no time. Have a table scale conversions. Check each recipe’s ingredient’s scale, look this up against the table, convert to a common scale (e.g. grams). Check the ingredients nutritional value (e.g. per 100g), then multiply by quantity used (e.g. x5 for 500g). Is this kind of process possible with Adalo?