I am beginning work on a website. Recipes primarily. The backbone of the recipe page looks like this: hidden link
I need to develop the database queries to accomplish my goals. We only need to look at the two sections for Ingredients and Nutrition for this inquiry.
Ingredients:
That section has three fields: Quantity, Units and Item (description) fields. The Quantity is a variable-data custom types field, units and item are both a fixed list (possibly select drop-downs?).
There will be up to 10 ingredients per recipe.
Nutrition:
Fixed-data items which at a minimum will contain the name of the Nutrient and a percentage of the daily recommended amount for that nutrient.
The nutrients are what you see on the example page.
The variable field for Nutrients in the Nutrition Section (the percentage field) will be based on a non-variable amount for each nutrient based on 100 g weight of that ingredient (or for vitamins and minerals a smaller unit but that doesn’t affect our structure).
e.g. The RDA for Carbohydrates (based on a 2,000 calorie diet) is 275 g of carbs per day
So, our database needs to have the name and the RDA in Grams for that nutrient, for up to 30 nutrients.
For Ingredients we need to have the Item Name (e.g. Spinach) and the Nutrient value for 100 grams of that Ingredient. For example: 100 g of Spinach has 3.6 g of Carbohydrates
As I stated, there will be up to 10 different ingredients in a Recipe (currently, for SEO reasons related to the permalink, I’ve made WP Posts (post type) my Recipe post type. There are about 35 Nutrients.
An example: A Creamed Spinach recipe might have:
100 g Spinach
3.3 oz Cream (I’ll have to convert fluid oz to grams but I can likely figure out how to do that)
I will want to pull the data from the fields for the Nutrients (custom-post or taxonomy?), compute the total % of RDA for each nutrient for each Ingredient in the recipe, then TOTAL the percentages of each nutrient for each Ingredient for the Recipe. That TOTAL will then be displayed in that NUTRIENTS section on the page.
I will, of course, have to register a calculate plugin to accomplish the mathematical computations but at this juncture I just want to know the best way to structure the site for these objectives.
I am wanting your opinion as to whether the best way is to make Nutrients and Ingredients custom post types related to Recipes and to each other OR perhaps using taxonomies and repeating fields (which I think may limit my ability to display the data in the correct format)?
P.S. I know nothing about Repeatable Groups. I have not had the occasion to use them yet. Since the Ingredients is a static list I would prefer not to create multiple custom fields with that list of items.