feat: cooked leftovers shelf-life estimator #112

Open
opened 2026-04-19 21:55:45 -07:00 by pyr0ball · 0 comments
Owner

Summary

After a user cooks a recipe, surface an estimate of how long the leftovers will keep. Two storage types: refrigerated and frozen. Different foods have very different windows (fish 1–2 days, most proteins 3–5, soups/stews 4–5, casseroles up to a week; frozen for months).

UX

Post-cook flow: After tapping "I cooked this", a shelf-life section appears inline below the confirmation. User can dismiss it per-instance. A preference ("Show leftover shelf-life after cooking", default on) hides it globally.

Cook log: Always shows the shelf-life info — no preference applies here. It is reference data when looking back at what was cooked.

Shelf-life data is computed at mark-as-cooked time and stored in the cook log entry (or transiently cached by recipe_id + cook date if no storage schema is added yet).

Proposed backend approach

Add cooked_leftovers_shelf_life(recipe_title, ingredients, storage_type) to app/services/expiration_predictor.py — follows the existing LLM fallback pattern already used for raw pantry items.

Return:

  • days: int — conservative estimate
  • storage_advice: str — one-sentence human note (e.g. "Store in an airtight container in the back of the fridge, not the door")
  • freeze_by_day: int | None — if the dish freezes well, how many days from cook date before it should be frozen instead

Implementation notes

  • Deterministic lookup table first (common dish types, shortest-component-wins for proteins, modifiers for acid/dairy/cooking method), LLM fallback for edge cases — same pattern as expiry predictor
  • FDA/USDA safe food handling guidelines anchor the lookup table values
  • Preference key: show_leftover_shelf_life (bool, default true) in user settings store
  • No panic/urgency framing per Kiwi UX policy (feedback_kiwi_no_panic.md) — frame as helpful info, not a countdown
## Summary After a user cooks a recipe, surface an estimate of how long the leftovers will keep. Two storage types: refrigerated and frozen. Different foods have very different windows (fish 1–2 days, most proteins 3–5, soups/stews 4–5, casseroles up to a week; frozen for months). ## UX **Post-cook flow**: After tapping "I cooked this", a shelf-life section appears inline below the confirmation. User can dismiss it per-instance. A preference ("Show leftover shelf-life after cooking", default on) hides it globally. **Cook log**: Always shows the shelf-life info — no preference applies here. It is reference data when looking back at what was cooked. Shelf-life data is computed at mark-as-cooked time and stored in the cook log entry (or transiently cached by recipe_id + cook date if no storage schema is added yet). ## Proposed backend approach Add `cooked_leftovers_shelf_life(recipe_title, ingredients, storage_type)` to `app/services/expiration_predictor.py` — follows the existing LLM fallback pattern already used for raw pantry items. Return: - `days: int` — conservative estimate - `storage_advice: str` — one-sentence human note (e.g. "Store in an airtight container in the back of the fridge, not the door") - `freeze_by_day: int | None` — if the dish freezes well, how many days from cook date before it should be frozen instead ## Implementation notes - Deterministic lookup table first (common dish types, shortest-component-wins for proteins, modifiers for acid/dairy/cooking method), LLM fallback for edge cases — same pattern as expiry predictor - FDA/USDA safe food handling guidelines anchor the lookup table values - Preference key: `show_leftover_shelf_life` (bool, default true) in user settings store - No panic/urgency framing per Kiwi UX policy (`feedback_kiwi_no_panic.md`) — frame as helpful info, not a countdown
pyr0ball added this to the Beta — Recipe Suggestions milestone 2026-04-20 11:43:29 -07:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/kiwi#112
No description provided.