{
  "schema_version": 2,
  "meta": {
    "title": "Pedidos pendentes há mais de 3 dias",
    "description": "Filtra a fila de atendimento: remove cancelados e mantém apenas pedidos pendentes com mais de 3 dias sem resolução.",
    "source_type": "doc",
    "data_origin": "synthetic",
    "entity_schema": {
      "id": "integer",
      "status": "string",
      "created_at": "datetime",
      "age_days": "integer",
      "customer": "string",
      "value": "number"
    },
    "generated_at": "2026-07-23T00:00:00Z"
  },
  "initial_dataset": {
    "count": 20,
    "sample": [
      {
        "id": 1001,
        "status": "cancelled",
        "created_at": "2026-07-21T09:15:00Z",
        "age_days": 2,
        "customer": "Loja das Flores",
        "value": 348.9
      },
      {
        "id": 1002,
        "status": "cancelled",
        "created_at": "2026-07-18T14:30:00Z",
        "age_days": 5,
        "customer": "Tech Imports Ltda",
        "value": 1240
      },
      {
        "id": 1003,
        "status": "cancelled",
        "created_at": "2026-07-20T11:00:00Z",
        "age_days": 3,
        "customer": "Mercado Bom Preço",
        "value": 87.5
      },
      {
        "id": 1004,
        "status": "cancelled",
        "created_at": "2026-07-19T16:45:00Z",
        "age_days": 4,
        "customer": "Papelaria Central",
        "value": 215
      },
      {
        "id": 1005,
        "status": "cancelled",
        "created_at": "2026-07-17T08:00:00Z",
        "age_days": 6,
        "customer": "Distribuidora Norte",
        "value": 3400
      },
      {
        "id": 1006,
        "status": "processing",
        "created_at": "2026-07-22T10:20:00Z",
        "age_days": 1,
        "customer": "Cafeteria Boa Vista",
        "value": 156.75
      },
      {
        "id": 1007,
        "status": "completed",
        "created_at": "2026-07-15T13:00:00Z",
        "age_days": 8,
        "customer": "Ótica Visão Clara",
        "value": 890
      },
      {
        "id": 1008,
        "status": "processing",
        "created_at": "2026-07-19T09:30:00Z",
        "age_days": 4,
        "customer": "Farmácia Saúde+",
        "value": 432.5
      },
      {
        "id": 1009,
        "status": "completed",
        "created_at": "2026-07-16T15:00:00Z",
        "age_days": 7,
        "customer": "Auto Peças Silva",
        "value": 1876
      },
      {
        "id": 1010,
        "status": "pending",
        "created_at": "2026-07-22T08:30:00Z",
        "age_days": 1,
        "customer": "Livraria Cultura",
        "value": 245
      },
      {
        "id": 1011,
        "status": "pending",
        "created_at": "2026-07-21T14:00:00Z",
        "age_days": 2,
        "customer": "Pet Shop Amigo",
        "value": 380
      },
      {
        "id": 1012,
        "status": "pending",
        "created_at": "2026-07-20T10:15:00Z",
        "age_days": 3,
        "customer": "Padaria Pão Quente",
        "value": 92
      },
      {
        "id": 1013,
        "status": "pending",
        "created_at": "2026-07-19T11:00:00Z",
        "age_days": 4,
        "customer": "Supermercado Ideal",
        "value": 1560
      },
      {
        "id": 1014,
        "status": "pending",
        "created_at": "2026-07-18T09:00:00Z",
        "age_days": 5,
        "customer": "Eletrônicos FastBuy",
        "value": 2340
      },
      {
        "id": 1015,
        "status": "pending",
        "created_at": "2026-07-17T16:30:00Z",
        "age_days": 6,
        "customer": "Móveis Conforto",
        "value": 4200
      },
      {
        "id": 1016,
        "status": "pending",
        "created_at": "2026-07-15T10:00:00Z",
        "age_days": 8,
        "customer": "Consultoria Apex",
        "value": 7800
      },
      {
        "id": 1017,
        "status": "pending",
        "created_at": "2026-07-14T14:20:00Z",
        "age_days": 9,
        "customer": "Escola de Idiomas CL",
        "value": 660
      },
      {
        "id": 1018,
        "status": "pending",
        "created_at": "2026-07-13T08:45:00Z",
        "age_days": 10,
        "customer": "Metalúrgica Forte",
        "value": 15300
      },
      {
        "id": 1019,
        "status": "pending",
        "created_at": "2026-07-12T11:30:00Z",
        "age_days": 11,
        "customer": "Estúdio Criativo DM",
        "value": 3100
      },
      {
        "id": 1020,
        "status": "pending",
        "created_at": "2026-07-11T09:00:00Z",
        "age_days": 12,
        "customer": "Distribuidora Verde",
        "value": 8900
      }
    ],
    "note": "Synthetic dataset generated by RuleWalk demo. Fields inferred from the rule description."
  },
  "steps": [
    {
      "step_type": "filter",
      "id": "step-1",
      "name": "Remover cancelados",
      "rule_text": "Excluir todos os pedidos com status \"cancelled\". Pedidos cancelados não aparecem na fila de atendimento, independente da idade.",
      "condition_expr": "status != 'cancelled'",
      "input_count": 20,
      "output_count": 15,
      "passed_sample": [
        {
          "id": 1006,
          "status": "processing",
          "created_at": "2026-07-22T10:20:00Z",
          "age_days": 1,
          "customer": "Cafeteria Boa Vista",
          "value": 156.75
        },
        {
          "id": 1007,
          "status": "completed",
          "created_at": "2026-07-15T13:00:00Z",
          "age_days": 8,
          "customer": "Ótica Visão Clara",
          "value": 890
        },
        {
          "id": 1008,
          "status": "processing",
          "created_at": "2026-07-19T09:30:00Z",
          "age_days": 4,
          "customer": "Farmácia Saúde+",
          "value": 432.5
        },
        {
          "id": 1009,
          "status": "completed",
          "created_at": "2026-07-16T15:00:00Z",
          "age_days": 7,
          "customer": "Auto Peças Silva",
          "value": 1876
        },
        {
          "id": 1010,
          "status": "pending",
          "created_at": "2026-07-22T08:30:00Z",
          "age_days": 1,
          "customer": "Livraria Cultura",
          "value": 245
        },
        {
          "id": 1011,
          "status": "pending",
          "created_at": "2026-07-21T14:00:00Z",
          "age_days": 2,
          "customer": "Pet Shop Amigo",
          "value": 380
        },
        {
          "id": 1012,
          "status": "pending",
          "created_at": "2026-07-20T10:15:00Z",
          "age_days": 3,
          "customer": "Padaria Pão Quente",
          "value": 92
        },
        {
          "id": 1013,
          "status": "pending",
          "created_at": "2026-07-19T11:00:00Z",
          "age_days": 4,
          "customer": "Supermercado Ideal",
          "value": 1560
        },
        {
          "id": 1014,
          "status": "pending",
          "created_at": "2026-07-18T09:00:00Z",
          "age_days": 5,
          "customer": "Eletrônicos FastBuy",
          "value": 2340
        },
        {
          "id": 1015,
          "status": "pending",
          "created_at": "2026-07-17T16:30:00Z",
          "age_days": 6,
          "customer": "Móveis Conforto",
          "value": 4200
        },
        {
          "id": 1016,
          "status": "pending",
          "created_at": "2026-07-15T10:00:00Z",
          "age_days": 8,
          "customer": "Consultoria Apex",
          "value": 7800
        },
        {
          "id": 1017,
          "status": "pending",
          "created_at": "2026-07-14T14:20:00Z",
          "age_days": 9,
          "customer": "Escola de Idiomas CL",
          "value": 660
        },
        {
          "id": 1018,
          "status": "pending",
          "created_at": "2026-07-13T08:45:00Z",
          "age_days": 10,
          "customer": "Metalúrgica Forte",
          "value": 15300
        },
        {
          "id": 1019,
          "status": "pending",
          "created_at": "2026-07-12T11:30:00Z",
          "age_days": 11,
          "customer": "Estúdio Criativo DM",
          "value": 3100
        },
        {
          "id": 1020,
          "status": "pending",
          "created_at": "2026-07-11T09:00:00Z",
          "age_days": 12,
          "customer": "Distribuidora Verde",
          "value": 8900
        }
      ],
      "rejected_sample": [
        {
          "record": {
            "id": 1001,
            "status": "cancelled",
            "created_at": "2026-07-21T09:15:00Z",
            "age_days": 2,
            "customer": "Loja das Flores",
            "value": 348.9
          },
          "reason": "status is 'cancelled'"
        },
        {
          "record": {
            "id": 1002,
            "status": "cancelled",
            "created_at": "2026-07-18T14:30:00Z",
            "age_days": 5,
            "customer": "Tech Imports Ltda",
            "value": 1240
          },
          "reason": "status is 'cancelled'"
        },
        {
          "record": {
            "id": 1003,
            "status": "cancelled",
            "created_at": "2026-07-20T11:00:00Z",
            "age_days": 3,
            "customer": "Mercado Bom Preço",
            "value": 87.5
          },
          "reason": "status is 'cancelled'"
        },
        {
          "record": {
            "id": 1004,
            "status": "cancelled",
            "created_at": "2026-07-19T16:45:00Z",
            "age_days": 4,
            "customer": "Papelaria Central",
            "value": 215
          },
          "reason": "status is 'cancelled'"
        },
        {
          "record": {
            "id": 1005,
            "status": "cancelled",
            "created_at": "2026-07-17T08:00:00Z",
            "age_days": 6,
            "customer": "Distribuidora Norte",
            "value": 3400
          },
          "reason": "status is 'cancelled'"
        }
      ]
    },
    {
      "step_type": "filter",
      "id": "step-2",
      "name": "Filtrar pendentes há mais de 3 dias",
      "rule_text": "Manter apenas pedidos com status \"pending\" e age_days > 3. Pedidos em processamento ou concluídos saem da fila; pedidos pendentes recentes (≤ 3 dias) ainda estão dentro do prazo.",
      "condition_expr": "status == 'pending' AND age_days > 3",
      "input_count": 15,
      "output_count": 8,
      "passed_sample": [
        {
          "id": 1013,
          "status": "pending",
          "created_at": "2026-07-19T11:00:00Z",
          "age_days": 4,
          "customer": "Supermercado Ideal",
          "value": 1560
        },
        {
          "id": 1014,
          "status": "pending",
          "created_at": "2026-07-18T09:00:00Z",
          "age_days": 5,
          "customer": "Eletrônicos FastBuy",
          "value": 2340
        },
        {
          "id": 1015,
          "status": "pending",
          "created_at": "2026-07-17T16:30:00Z",
          "age_days": 6,
          "customer": "Móveis Conforto",
          "value": 4200
        },
        {
          "id": 1016,
          "status": "pending",
          "created_at": "2026-07-15T10:00:00Z",
          "age_days": 8,
          "customer": "Consultoria Apex",
          "value": 7800
        },
        {
          "id": 1017,
          "status": "pending",
          "created_at": "2026-07-14T14:20:00Z",
          "age_days": 9,
          "customer": "Escola de Idiomas CL",
          "value": 660
        },
        {
          "id": 1018,
          "status": "pending",
          "created_at": "2026-07-13T08:45:00Z",
          "age_days": 10,
          "customer": "Metalúrgica Forte",
          "value": 15300
        },
        {
          "id": 1019,
          "status": "pending",
          "created_at": "2026-07-12T11:30:00Z",
          "age_days": 11,
          "customer": "Estúdio Criativo DM",
          "value": 3100
        },
        {
          "id": 1020,
          "status": "pending",
          "created_at": "2026-07-11T09:00:00Z",
          "age_days": 12,
          "customer": "Distribuidora Verde",
          "value": 8900
        }
      ],
      "rejected_sample": [
        {
          "record": {
            "id": 1006,
            "status": "processing",
            "created_at": "2026-07-22T10:20:00Z",
            "age_days": 1,
            "customer": "Cafeteria Boa Vista",
            "value": 156.75
          },
          "reason": "status is 'processing', not 'pending'"
        },
        {
          "record": {
            "id": 1007,
            "status": "completed",
            "created_at": "2026-07-15T13:00:00Z",
            "age_days": 8,
            "customer": "Ótica Visão Clara",
            "value": 890
          },
          "reason": "status is 'completed', not 'pending'"
        },
        {
          "record": {
            "id": 1008,
            "status": "processing",
            "created_at": "2026-07-19T09:30:00Z",
            "age_days": 4,
            "customer": "Farmácia Saúde+",
            "value": 432.5
          },
          "reason": "status is 'processing', not 'pending'"
        },
        {
          "record": {
            "id": 1009,
            "status": "completed",
            "created_at": "2026-07-16T15:00:00Z",
            "age_days": 7,
            "customer": "Auto Peças Silva",
            "value": 1876
          },
          "reason": "status is 'completed', not 'pending'"
        },
        {
          "record": {
            "id": 1010,
            "status": "pending",
            "created_at": "2026-07-22T08:30:00Z",
            "age_days": 1,
            "customer": "Livraria Cultura",
            "value": 245
          },
          "reason": "age_days is 1, must be > 3"
        },
        {
          "record": {
            "id": 1011,
            "status": "pending",
            "created_at": "2026-07-21T14:00:00Z",
            "age_days": 2,
            "customer": "Pet Shop Amigo",
            "value": 380
          },
          "reason": "age_days is 2, must be > 3"
        },
        {
          "record": {
            "id": 1012,
            "status": "pending",
            "created_at": "2026-07-20T10:15:00Z",
            "age_days": 3,
            "customer": "Padaria Pão Quente",
            "value": 92
          },
          "reason": "age_days is 3, must be > 3"
        }
      ]
    }
  ],
  "final_result": {
    "count": 8,
    "sample": [
      {
        "id": 1013,
        "status": "pending",
        "created_at": "2026-07-19T11:00:00Z",
        "age_days": 4,
        "customer": "Supermercado Ideal",
        "value": 1560
      },
      {
        "id": 1014,
        "status": "pending",
        "created_at": "2026-07-18T09:00:00Z",
        "age_days": 5,
        "customer": "Eletrônicos FastBuy",
        "value": 2340
      },
      {
        "id": 1015,
        "status": "pending",
        "created_at": "2026-07-17T16:30:00Z",
        "age_days": 6,
        "customer": "Móveis Conforto",
        "value": 4200
      },
      {
        "id": 1016,
        "status": "pending",
        "created_at": "2026-07-15T10:00:00Z",
        "age_days": 8,
        "customer": "Consultoria Apex",
        "value": 7800
      },
      {
        "id": 1017,
        "status": "pending",
        "created_at": "2026-07-14T14:20:00Z",
        "age_days": 9,
        "customer": "Escola de Idiomas CL",
        "value": 660
      },
      {
        "id": 1018,
        "status": "pending",
        "created_at": "2026-07-13T08:45:00Z",
        "age_days": 10,
        "customer": "Metalúrgica Forte",
        "value": 15300
      },
      {
        "id": 1019,
        "status": "pending",
        "created_at": "2026-07-12T11:30:00Z",
        "age_days": 11,
        "customer": "Estúdio Criativo DM",
        "value": 3100
      },
      {
        "id": 1020,
        "status": "pending",
        "created_at": "2026-07-11T09:00:00Z",
        "age_days": 12,
        "customer": "Distribuidora Verde",
        "value": 8900
      }
    ]
  }
}