Skip to main content

Overview

The Waste (Merma) model tracks production losses, shrinkage, and waste during the manufacturing process. Each waste record is associated with a specific production batch and categorized by type.

TypeScript Definition

interface Waste {
  idMerma: string;
  tipo: 'Natural' | 'Tecnica' | 'Administrativa' | 'Danio';
  observacion: string | null;
  cantidad: number;
  fechaCreacion: Date;
  idLote: string;
  lote?: ProductionBatch;
}

enum TipoMerma {
  Natural = 'Natural',
  Tecnica = 'Tecnica',
  Administrativa = 'Administrativa',
  Danio = 'Danio'
}

Fields

idMerma
string
required
Unique identifier for the waste record. Auto-generated UUID.Database: Primary key, UUID format
tipo
enum
required
Type/category of waste or loss.Enum Values:
  • Natural - Natural losses (evaporation, moisture loss, fermentation)
  • Tecnica - Technical losses (equipment malfunction, process errors)
  • Administrativa - Administrative losses (inventory adjustments, miscounts)
  • Danio - Damage losses (spoilage, contamination, physical damage)
Usage: Enables root cause analysis and waste reduction strategies
observacion
string | null
Optional notes or description of the waste incident.Nullable: Can be null or emptyUsage: Provides context for waste analysis and improvementExamples:
  • “Evaporación durante proceso de maduración”
  • “Falla en equipo de refrigeración”
  • “Producto dañado durante transporte interno”
cantidad
decimal
required
Quantity of product lost or wasted.Type: Decimal number for precise measurementsUnit: Uses the same unit as the parent production batch (kg or litros)Example: 5.25, 12.50, 0.75
fechaCreacion
datetime
required
Timestamp when the waste record was created.Default: Current timestampFormat: ISO 8601 datetime stringUsage: Tracks when losses were identified or occurred
idLote
string
required
Foreign key reference to the production batch affected by this waste.Database: Foreign key to LoteProduccion(idLote)Relation: Many-to-One with ProductionBatch

Relationships

Example Response

{
  "idMerma": "m1n2o3p4-5678-90ab-cdef-1234567890ab",
  "tipo": "Natural",
  "observacion": "Evaporación durante proceso de maduración",
  "cantidad": "5.25",
  "fechaCreacion": "2024-03-01T12:30:00.000Z",
  "idLote": "b1c2d3e4-5678-90ab-cdef-1234567890ab",
  "lote": {
    "idLote": "b1c2d3e4-5678-90ab-cdef-1234567890ab",
    "numeroLote": 1001,
    "fechaProduccion": "2024-03-01T08:00:00.000Z",
    "cantidad": "250.50",
    "unidad": "kg",
    "producto": {
      "nombre": "Queso Mozzarella",
      "categoria": "quesos"
    }
  }
}

Example: Multiple Waste Records

[
  {
    "idMerma": "m1n2o3p4-5678-90ab-cdef-1234567890ab",
    "tipo": "Natural",
    "observacion": "Evaporación durante proceso de maduración",
    "cantidad": "5.25",
    "fechaCreacion": "2024-03-01T12:30:00.000Z",
    "idLote": "b1c2d3e4-5678-90ab-cdef-1234567890ab"
  },
  {
    "idMerma": "m2n3o4p5-5678-90ab-cdef-1234567890ab",
    "tipo": "Tecnica",
    "observacion": "Falla en sistema de refrigeración por 2 horas",
    "cantidad": "12.00",
    "fechaCreacion": "2024-03-01T15:45:00.000Z",
    "idLote": "b1c2d3e4-5678-90ab-cdef-1234567890ab"
  },
  {
    "idMerma": "m3n4o5p6-5678-90ab-cdef-1234567890ab",
    "tipo": "Danio",
    "observacion": "Contaminación detectada en una porción del lote",
    "cantidad": "8.50",
    "fechaCreacion": "2024-03-02T09:15:00.000Z",
    "idLote": "b1c2d3e4-5678-90ab-cdef-1234567890ab"
  }
]

Example: Minimal Response

{
  "idMerma": "m1n2o3p4-5678-90ab-cdef-1234567890ab",
  "tipo": "Natural",
  "observacion": null,
  "cantidad": "5.25",
  "fechaCreacion": "2024-03-01T12:30:00.000Z",
  "idLote": "b1c2d3e4-5678-90ab-cdef-1234567890ab"
}

Waste Types Explained

Natural (Natural)

Natural production losses that are expected and inherent to the manufacturing process. Common Examples:
  • Evaporation during heating processes
  • Moisture loss during aging/maturation
  • Whey separation in cheese production
  • Natural fermentation losses
Characteristics:
  • Predictable and recurring
  • Can be estimated based on historical data
  • Typically unavoidable but can be minimized

Technical (Técnica)

Losses caused by technical issues, equipment failures, or process problems. Common Examples:
  • Equipment malfunction or breakdown
  • Temperature control failures
  • Mixing or blending errors
  • Pasteurization issues
  • Timing errors in production process
Characteristics:
  • Often preventable with proper maintenance
  • May indicate need for equipment upgrades
  • Requires root cause analysis

Administrative (Administrativa)

Losses due to administrative errors, inventory discrepancies, or documentation issues. Common Examples:
  • Inventory counting errors
  • Incorrect batch recording
  • Mislabeling corrections
  • Data entry mistakes
  • Stock reconciliation adjustments
Characteristics:
  • Usually non-physical losses
  • Indicates need for process improvement
  • Can be reduced with better systems

Damage (Daño)

Losses due to spoilage, contamination, or physical damage to the product. Common Examples:
  • Microbial contamination
  • Spoilage due to temperature abuse
  • Physical damage during handling
  • Packaging failures
  • Foreign object contamination
  • Product defects requiring disposal
Characteristics:
  • Often requires immediate action
  • May have food safety implications
  • Should be documented for regulatory compliance

Usage Notes

Waste Tracking Workflow

  1. Production batch is created
  2. During or after production, losses are identified
  3. Waste record created with appropriate type and quantity
  4. Observations document the cause and context
  5. Data used for cost analysis and process improvement

Cost Impact Analysis

  • Waste reduces effective yield from production batch
  • Total waste per batch: sum of all cantidad values
  • Net production = batch cantidad - total waste
  • Per-unit cost increases with higher waste percentages

Process Improvement

  • Analyze waste by type to identify improvement areas
  • Track waste trends over time
  • Natural waste may indicate need for process optimization
  • Technical waste suggests maintenance or equipment issues
  • Administrative waste points to documentation improvements
  • Damage waste may require quality control enhancements

Reporting and Analytics

  • Calculate waste percentage: (total waste / batch quantity) × 100
  • Compare waste rates across products, establishments, time periods
  • Identify high-waste batches for investigation
  • Track effectiveness of waste reduction initiatives

Best Practices

  • Record waste as soon as it’s identified
  • Always include detailed observations for non-natural waste
  • Use consistent measurement units (matching parent batch)
  • Review waste records during batch finalization
  • Regularly analyze waste patterns for continuous improvement

Build docs developers (and LLMs) love