Skip to main content

Overview

GIMA’s failure reporting system allows users to quickly document asset problems, prioritize issues, and automatically create corrective maintenance work orders.

Failure Report Model

Reporte Structure

Failure reports capture critical information about asset problems:
class Reporte extends Model
{
    protected $table = 'reportes';
    
    protected $fillable = [
        'usuario_id',    // User who reported the issue
        'activo_id',     // Affected asset
        'descripcion',   // Problem description
        'prioridad',     // Priority level (enum)
        'estado',        // Report status (enum)
    ];
    
    protected $casts = [
        'prioridad' => 'string',
        'estado' => 'string',
    ];
}

Report States

Failure reports progress through several states:
Estado: abierto
Description: Report has been submitted but not yet reviewed
Label: Abierto

Next actions:
- Supervisor reviews report
- Assign priority
- Assign to technician

Priority Levels

Assign appropriate priority to ensure critical issues receive immediate attention:
Prioridad: alta
Label: Alta

Use for:
- Safety hazards
- Complete asset failure
- Production-stopping issues
- Emergency situations

Response time: Immediate (within 1 hour)

Creating Failure Reports

1

Identify the asset

Locate the failing asset and obtain its activo_id.
2

Document the problem

Write a clear, detailed description of the failure symptoms and circumstances.
3

Assign priority

Evaluate the impact and urgency to set appropriate priority level.
4

Submit the report

Create the report with initial estado of “abierto”.
5

Notify supervisors

System should automatically notify supervisors of new high-priority reports.

API Example: Create Failure Report

Any authenticated user can create failure reports. This enables rapid response to asset problems discovered by any team member.

Endpoint

POST /api/reportes

Request Headers

Authorization
string
required
Bearer token from authentication
Content-Type
string
required
application/json

Request Body

activo_id
integer
required
ID of the affected asset
descripcion
text
required
Detailed description of the failure or problem
prioridad
string
required
Priority level: “alta”, “media”, or “baja”

Example Requests

curl -X POST http://127.0.0.1:8000/api/reportes \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "activo_id": 12,
    "descripcion": "El aire acondicionado central no enciende. Se escucha un zumbido cuando se activa pero el compresor no arranca. Sala de servidores alcanzando temperatura crítica.",
    "prioridad": "alta"
  }'

Response

201 Created
{
  "estado": "exito",
  "mensaje": "Reporte creado correctamente",
  "data": {
    "id": 47,
    "usuario_id": 5,
    "activo_id": 12,
    "descripcion": "El aire acondicionado central no enciende...",
    "prioridad": "alta",
    "estado": "abierto",
    "created_at": "2024-03-06T10:30:00.000000Z",
    "updated_at": "2024-03-06T10:30:00.000000Z"
  }
}

Report Relationships

User Relationship

Access information about who reported the issue:
$reporte = Reporte::find($id);
$usuario = $reporte->usuario;

echo "Reported by: {$usuario->name}";
echo "Contact: {$usuario->email}";

Asset Relationship

Get details about the affected asset:
$reporte = Reporte::find($id);
$activo = $reporte->activo;

echo "Asset: {$activo->articulo->marca} {$activo->articulo->modelo}";
echo "Location: {$activo->ubicacion->edificio}, {$activo->ubicacion->salon}";
echo "Current status: {$activo->estado->label()}";

Maintenance Work Orders

A report can spawn one or more maintenance work orders:
$reporte = Reporte::find($id);
$mantenimientos = $reporte->mantenimientos;

foreach ($mantenimientos as $mantenimiento) {
    echo "Work Order #{$mantenimiento->id}";
    echo "Type: {$mantenimiento->tipo}";
    echo "Status: {$mantenimiento->estado}";
}

Querying Reports

// Get all open reports
$abiertos = Reporte::where('estado', 'abierto')
    ->orderBy('prioridad', 'desc')
    ->orderBy('created_at', 'asc')
    ->with(['activo.articulo', 'usuario'])
    ->get();

// Get high-priority open reports
$urgentes = Reporte::where('estado', 'abierto')
    ->where('prioridad', 'alta')
    ->get();

Updating Report Status

Assign to Technician

When a supervisor assigns the report:
Update to Asignado
{
  "estado": "asignado"
}
This typically happens when creating a Mantenimiento work order:
// Create maintenance work order from report
$reporte = Reporte::find($reporte_id);

$mantenimiento = Mantenimiento::create([
    'activo_id' => $reporte->activo_id,
    'reporte_id' => $reporte->id,
    'supervisor_id' => $supervisor_id,
    'tecnico_principal_id' => $tecnico_id,
    'tipo' => 'correctivo',
    'fecha_apertura' => now(),
    'estado' => 'abierto',
    'descripcion' => $reporte->descripcion,
]);

// Update report status
$reporte->estado = 'asignado';
$reporte->save();

// Update asset status
$reporte->activo->estado = EstadoActivo::MANTENIMiENTO;
$reporte->activo->save();

Mark as In Progress

When technician starts work:
Update to En Progreso
{
  "estado": "en_progreso"
}

Mark as Resolved

When technician completes repair:
Update to Resuelto
{
  "estado": "resuelto"
}

Close Report

When supervisor verifies the fix:
Update to Cerrado
{
  "estado": "cerrado"
}
Only supervisors or admins should be able to close reports. Implement proper authorization checks to prevent premature closure.

Report Workflow

Complete Failure-to-Fix Workflow

1

User reports failure

Any user discovers an asset problem and creates a Reporte with appropriate priority.
2

Supervisor reviews

Supervisor reviews new reports (especially high-priority) and validates priority level.
3

Create work order

Supervisor creates Mantenimiento work order, assigns technician, and updates report to “asignado”.
4

Technician accepts

Assigned technician reviews work order and updates report to “en_progreso” when starting work.
5

Perform repair

Technician diagnoses issue, orders parts if needed, performs repair, and documents work in SesionesMantenimiento.
6

Mark resolved

Technician completes work and updates report to “resuelto”.
7

Supervisor verifies

Supervisor inspects completed work and updates report to “cerrado” if satisfactory.
8

Asset returned to service

Asset estado is updated to “operativo” and returned to normal operation.

Writing Effective Failure Reports

Quality failure reports lead to faster diagnosis and repair. Include specific details that help technicians understand and resolve issues quickly.

Good Report Checklist

  • Specific symptoms observed
  • When the problem started
  • Frequency (constant, intermittent, only under certain conditions)
  • Any error messages or codes displayed
  • Environmental conditions (temperature, humidity, load)
  • What was happening when failure occurred
  • Any unusual sounds, smells, or visual indicators
  • Previous similar incidents

Examples

"No funciona el aire"

Problems:
- Too vague
- No details about symptoms
- No context

Report Analytics

Common Queries for Analysis

// Calculate average response time by priority
$avgResponseTime = Reporte::selectRaw('
    prioridad,
    AVG(TIMESTAMPDIFF(HOUR, created_at, updated_at)) as avg_hours
')
->where('estado', '!=', 'abierto')
->groupBy('prioridad')
->get();

Best Practices

1

Report immediately

Encourage users to report problems as soon as they’re discovered. Early detection prevents minor issues from becoming major failures.
2

Be specific and detailed

Provide thorough descriptions with symptoms, context, and impact. Detailed reports enable faster diagnosis.
3

Set appropriate priority

Use priority levels consistently across the organization. Don’t mark everything as high priority.
4

Include photos when helpful

Implement photo upload capability for reports. Visual documentation can be invaluable for diagnosis.
5

Follow up on reports

Implement notifications to keep report creators informed of progress and resolution.
6

Analyze patterns

Regularly review failure reports to identify recurring problems and opportunities for preventive maintenance.

Build docs developers (and LLMs) love