computeBatchMacros
Calculate total macros for a batch from ingredient nutrition sources and weights. Missing ingredients are flagged with candidate matches, and totals are marked incomplete as partial sums.
Instructions
Total the macros of a whole batch from its ingredients. Each ingredient needs a nutrition source and a weight. Any ingredient missing either is returned in unresolved with candidate matches and is never dropped or approximated: the totals then carry isComplete false and are a partial sum.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ingredients | Yes | ||
| suggestCandidates | No | Defaults to true. Costs one food search per unresolved ingredient. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| budget | Yes | ||
| totals | Yes | A partial sum when isComplete is false. Unresolved items are never dropped. | |
| coverage | Yes | Lets the caller tell a missing pinch of salt from a missing 500 g of meat. | |
| warnings | Yes | ||
| totalRawG | Yes | Sum of the resolved ingredient weights only. | |
| isComplete | Yes | ||
| unresolved | Yes | ||
| ingredients | Yes |