Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/EstefanoARG/FridgeRadar/llms.txt

Use this file to discover all available pages before exploring further.

Food waste tracking in FridgeRadar turns every discarded item into a data point. When a product is thrown away — because it expired, spoiled, or was left over — you record a waste event (desperdicio) that links back to the original inventory item. Over time, these events accumulate into household metrics that reveal patterns: which products are wasted most often, how much is typically discarded, and whether waste is trending up or down. All waste endpoints require a valid bearer token.

What counts as a waste event

A waste event should be logged whenever a pantry item is removed from inventory without being fully consumed. Common motives include:
  • vencido — product passed its expiry date
  • dañado — product was physically damaged or spoiled before expiry
  • sobrante — leftover after cooking that will not be used
  • Any other free-text reason you want to record in motivo
FridgeRadar also has a scheduled task that automatically creates waste events for items whose estado_caducidad is "vencido" — so even if you forget to log it manually, expired items will appear in your metrics. See the Scheduled Tasks guide for details.

Logging a waste event

POST /api/v1/desperdicio Send a DesperdicioCreate body referencing the inventory item being discarded.
FieldTypeRequiredDescription
id_inventariointID of the inventory item being discarded
cantidadfloatHow much was discarded (uses inventory unit)
motivostrReason for disposal ("vencido", "dañado", "sobrante", etc.)
comentariostrFree-text additional context
curl -X POST https://your-fridgeradar-host/api/v1/desperdicio \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "id_inventario": 101,
    "cantidad": 1.0,
    "motivo": "vencido",
    "comentario": "Yogurt opened three weeks ago, missed it at the back of the fridge"
  }'
Returns 201 Created with a DesperdicioResponse:
{
  "id_desperdicio": 55,
  "id_inventario": 101,
  "cantidad": 1.0,
  "motivo": "vencido",
  "comentario": "Yogurt opened three weeks ago, missed it at the back of the fridge",
  "fecha_desperdicio": "2024-07-04T09:15:00"
}
FieldTypeDescription
id_desperdiciointAuto-assigned waste event ID
id_inventariointLinked inventory item
cantidadfloat | nullAmount discarded
motivostr | nullReason for disposal
comentariostr | nullAdditional free-text notes
fecha_desperdiciodatetimeTimestamp the event was recorded

Listing waste events for a household

GET /api/v1/desperdicio?id_hogar={id} Retrieves all waste events for the specified household, ordered by most recent first.
curl -X GET "https://your-fridgeradar-host/api/v1/desperdicio?id_hogar=1" \
  -H "Authorization: Bearer <token>"
Returns an array of DesperdicioResponse objects.

Viewing waste metrics

GET /api/v1/desperdicio/metricas/{id_hogar} Returns aggregate statistics for a household — total events, total quantity discarded, breakdown by motive, and trends over time. Use these metrics to understand where waste is happening and take corrective action.
curl -X GET https://your-fridgeradar-host/api/v1/desperdicio/metricas/1 \
  -H "Authorization: Bearer <token>"
Before your weekly shop, filter your inventory by estado=rojo and estado=vencido to identify items at immediate risk:
curl -X GET "https://your-fridgeradar-host/api/v1/inventario/hogar/1?estado=rojo" \
  -H "Authorization: Bearer <token>"
Use or incorporate these items into meals first. Every item consumed rather than discarded keeps it out of your waste metrics.

Reducing waste over time

Monitor the semáforo

Regularly check amarillo and rojo items in the inventory. Act on them before they reach vencido.

Review metrics weekly

Use GET /api/v1/desperdicio/metricas/{id_hogar} to spot which products your household wastes most and adjust buying habits.

Record honest motives

Filling in motivo consistently (e.g. "sobrante" vs "vencido") makes metrics more actionable — you can tell whether the problem is over-buying or poor rotation.

Lean on automation

The nightly task at 02:00 auto-logs expired inventory as waste events so nothing slips through, even if no one manually records it.

Build docs developers (and LLMs) love