Confidence & provenance
aggregate_nutrition(...) returns a confidence_breakdown alongside totals, so
a report can be honest about estimate quality.
{% set wk = aggregate_nutrition(plan.all_ingredients) %}
Overall: {{ wk.totals.confidence }} (weighted: {{ wk.totals.confidence_weighted }})
{% if wk.confidence_breakdown.estimated_share_of_micronutrients %}
Estimated entries affect
{{ (wk.confidence_breakdown.estimated_share_of_micronutrients * 100) | round(1) }}%
of total micronutrients.
{% endif %}
totals.confidence— worst-of across items (strict).totals.confidence_weighted— mass-weighted; less pessimistic when one small-contribution item is estimated.confidence_breakdown.estimated_share_of_micronutrients— the fraction of the batch's micronutrient magnitude coming from partial/estimated entries (nullwhen there are no micronutrients).
Each resolved item also carries a source (e.g. USDA confirmed vs estimated)
and confidence, so a template can flag individual rows as well as the total.