{
  "surface": "report",
  "manifest": {
    "version": 1,
    "surface": "report",
    "title": "8月28日转人工率偏高诊断",
    "description": "UMall AI 客服截至 11:37 的转人工率诊断。",
    "generatedAt": "2026-08-28T11:50:00+09:00",
    "sources": [
      {
        "id": "session-logs",
        "label": "UMall production conversation sessions",
        "path": "analysis.sql",
        "query": {
          "language": "sql",
          "description": "Scans production UMall session JSONL records, applies the same 11:37 JST cutoff to Aug 27 and Aug 28, detects transfer markers, and aggregates only de-identified counts.",
          "tables_used": ["production conversation session JSONL files"],
          "filters": [
            "Production session keys beginning with api:umall-ai-cs-",
            "Created on Aug 27 or Aug 28, 2026",
            "Created at or before 11:37:59 JST"
          ],
          "metric_definitions": [
            "Session transfer rate = sessions containing at least one [转人工] assistant response / all sessions.",
            "Customer transfer rate = unique customers with at least one transferred session / unique customers.",
            "Repeat transfer sessions = transferred sessions minus unique transferred customers."
          ]
        }
      },
      {
        "id": "after-sale-checks",
        "label": "CustomerAi after-sale status checks",
        "query": {
          "language": "api lookup",
          "sql": "python3 scripts/customer_ai_query.py afterSaleInfo --order-id <order-id>",
          "description": "Fresh read-only checks of after-sale status for the orders represented in Aug 28 transferred sessions.",
          "tables_used": ["CustomerAi afterSaleInfo API"],
          "filters": [
            "Orders appearing in transferred production sessions through 11:37 JST",
            "Checked on Aug 28, 2026"
          ],
          "metric_definitions": [
            "Existing after-sale means the order returned at least one recorded after-sale entry at check time."
          ]
        }
      }
    ],
    "blocks": [
      {
        "id": "title",
        "type": "markdown",
        "body": "# 8月28日转人工率偏高诊断"
      },
      {
        "id": "executive-summary",
        "type": "markdown",
        "sourceId": "session-logs",
        "body": "## 核心结论\n\n**偏高来自重复会话，不是客户增多。** 截至 11:37，28日为 12/17（70.6%），27日同期为 8/14（57.1%）；按客户统计均为 7/12（58.3%）。新增 4 次全部来自重复转人工（1→5）。\n\n3 个客户占 8/12 次，单个取消订单占 4 次。工具异常包括 `afterSaleInfo` 拦截 11/17 次、图片引用失败 2 次。建议复用同一客户/订单的人工工单并修复附件引用；全天结束后再复核。"
      },
      {
        "id": "rate-chart-block",
        "type": "chart",
        "chartId": "rate-comparison"
      }
    ],
    "charts": [
      {
        "id": "rate-comparison",
        "title": "同期转人工率对比",
        "description": "8月27日与28日截至 11:37。",
        "type": "bar",
        "intent": "comparison",
        "question": "Did transfer incidence rise at both the session and customer level?",
        "rationale": "Grouped bars compare two discrete dates across the two denominators without implying a longer time-series trend.",
        "dataset": "rate_comparison",
        "encodings": {
          "x": { "field": "date" },
          "y": { "field": "rate" },
          "color": { "field": "denominator" }
        },
        "options": {
          "grouping": "grouped",
          "palette": { "kind": "categorical" },
          "legend": { "show": true },
          "valueFormat": "percent"
        },
        "sourceId": "session-logs"
      }
    ]
  },
  "snapshot": {
    "version": 1,
    "status": "ready",
    "generatedAt": "2026-08-28T11:50:00+09:00",
    "datasets": {
      "rate_comparison": [
        { "date": "Aug 27", "denominator": "Sessions", "rate": 0.5714, "sessions": 14, "transfers": 8, "unique_customers": 12, "transferred_customers": 7, "repeat_transfer_sessions": 1 },
        { "date": "Aug 27", "denominator": "Unique customers", "rate": 0.5833, "sessions": 14, "transfers": 8, "unique_customers": 12, "transferred_customers": 7, "repeat_transfer_sessions": 1 },
        { "date": "Aug 28", "denominator": "Sessions", "rate": 0.7059, "sessions": 17, "transfers": 12, "unique_customers": 12, "transferred_customers": 7, "repeat_transfer_sessions": 5 },
        { "date": "Aug 28", "denominator": "Unique customers", "rate": 0.5833, "sessions": 17, "transfers": 12, "unique_customers": 12, "transferred_customers": 7, "repeat_transfer_sessions": 5 }
      ],
      "transfer_reasons": [
        { "category": "取消订单与退款跟进", "transfer_sessions": 4, "share": 0.3333, "distinct_customer_cases": 1, "repeat_transfer_sessions": 3 },
        { "category": "商品质量与售后", "transfer_sessions": 3, "share": 0.25, "distinct_customer_cases": 2, "repeat_transfer_sessions": 1 },
        { "category": "配送异常与重新配送", "transfer_sessions": 3, "share": 0.25, "distinct_customer_cases": 3, "repeat_transfer_sessions": 0 },
        { "category": "商品信息冲突", "transfer_sessions": 1, "share": 0.0833, "distinct_customer_cases": 1, "repeat_transfer_sessions": 0 },
        { "category": "直接要求人工（资料不足）", "transfer_sessions": 1, "share": 0.0833, "distinct_customer_cases": 1, "repeat_transfer_sessions": 0 }
      ],
      "repeat_clusters": [
        { "case": "取消订单与退款跟进", "transfer_sessions": 4, "repeat_transfers": 3 },
        { "case": "板栗饼质量与退款", "transfer_sessions": 2, "repeat_transfers": 1 },
        { "case": "冷冻商品化冻售后", "transfer_sessions": 2, "repeat_transfers": 1 }
      ]
    }
  },
  "sources": [
    {
      "id": "session-logs",
      "label": "UMall production conversation sessions",
      "path": "analysis.sql",
      "query": {
        "language": "sql",
        "description": "Scans production UMall session JSONL records, applies the same 11:37 JST cutoff to Aug 27 and Aug 28, detects transfer markers, and aggregates only de-identified counts.",
        "tables_used": ["production conversation session JSONL files"],
        "filters": [
          "Production session keys beginning with api:umall-ai-cs-",
          "Created on Aug 27 or Aug 28, 2026",
          "Created at or before 11:37:59 JST"
        ],
        "metric_definitions": [
          "Session transfer rate = sessions containing at least one [转人工] assistant response / all sessions.",
          "Customer transfer rate = unique customers with at least one transferred session / unique customers.",
          "Repeat transfer sessions = transferred sessions minus unique transferred customers."
        ]
      }
    },
    {
      "id": "after-sale-checks",
      "label": "CustomerAi after-sale status checks",
      "query": {
        "language": "api lookup",
        "sql": "python3 scripts/customer_ai_query.py afterSaleInfo --order-id <order-id>",
        "description": "Fresh read-only checks of after-sale status for the orders represented in Aug 28 transferred sessions.",
        "tables_used": ["CustomerAi afterSaleInfo API"],
        "filters": [
          "Orders appearing in transferred production sessions through 11:37 JST",
          "Checked on Aug 28, 2026"
        ],
        "metric_definitions": [
          "Existing after-sale means the order returned at least one recorded after-sale entry at check time."
        ]
      }
    }
  ]
}
