Saltar al contenido principal

Documentation Index

Fetch the complete documentation index at: https://help.treble.ai/llms.txt

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

fact_agent_status_changes

Cada fila representa un cambio de estado (online/offline) de un agente en la plataforma de agentes.

¿Qué preguntas responde?

  • ¿Cuándo se conectaron y desconectaron los agentes?
  • ¿Cuántas horas estuvo disponible cada agente?
  • ¿Cuál fue el horario de conexión de cada agente?

Columnas

ColumnaTipoDescripción
status_change_idInt32Identificador único del evento
company_idInt32Identificador de la empresa (filtrado automáticamente)
agent_idInt32Identificador del agente
agent_nameStringNombre del agente
created_atDateTime64Fecha y hora del cambio de estado
old_statusBoolEstado anterior. true = online, false = offline. NULL si es el primer evento
new_statusBoolNuevo estado. true = online, false = offline

Consultas de ejemplo

Horarios de conexión de agentes hoy

SELECT
    agent_name,
    created_at,
    if(new_status, 'online', 'offline') AS estado
FROM client_analytics.fact_agent_status_changes
WHERE created_at >= today()
ORDER BY agent_name, created_at

Minutos online por agente por día

SELECT
    agent_name,
    toDate(created_at) AS dia,
    round(sum(if(new_status = true,
        dateDiff('minute', created_at,
            leadInFrame(created_at) OVER (PARTITION BY agent_id ORDER BY created_at)
        ), 0)) / 60, 1) AS horas_online
FROM client_analytics.fact_agent_status_changes
WHERE created_at >= now() - INTERVAL 7 DAY
GROUP BY agent_name, dia
ORDER BY dia DESC, agent_name