{
  "schema_version": 1,
  "diagram_type": "architecture",
  "meta": {
    "title": "SSA: đường đi của dữ liệu",
    "quality_profile": "showcase",
    "viewBox": [
      850,
      446
    ],
    "output": "docs/ssa-miniapp/archify/lineage.html",
    "repository": {
      "url": "git@github.com:skan2026/ssa.git",
      "revision": "05bb7ca2dfe249d1bfb325b901ee8d7d2958d19e",
      "link_mode": "local-only"
    }
  },
  "components": [
    {
      "id": "misa-export",
      "type": "external",
      "label": "Excel MISA",
      "sublabel": "SSA xuất file theo lịch",
      "pos": [
        36,
        94
      ],
      "size": [
        166,
        65
      ],
      "sources": [
        {
          "path": "docs/ssa-miniapp/PLAN.md",
          "line": 250,
          "end_line": 300
        }
      ]
    },
    {
      "id": "airflow-dag",
      "type": "backend",
      "label": "Airflow tại Việt Nam",
      "sublabel": "Schedule / run ID / retry",
      "pos": [
        342,
        94
      ],
      "size": [
        166,
        65
      ],
      "sources": [
        {
          "path": "docs/ssa-miniapp/PLAN.md",
          "line": 250,
          "end_line": 300
        }
      ]
    },
    {
      "id": "import-worker",
      "type": "backend",
      "label": "Import Worker",
      "sublabel": "Hash / validate / staging",
      "pos": [
        648,
        94
      ],
      "size": [
        166,
        65
      ],
      "sources": [
        {
          "path": "docs/ssa-miniapp/PLAN.md",
          "line": 250,
          "end_line": 300
        }
      ]
    },
    {
      "id": "human-review",
      "type": "security",
      "label": "Đối soát và duyệt",
      "sublabel": "Counts / diff / approval",
      "pos": [
        648,
        317
      ],
      "size": [
        166,
        65
      ],
      "sources": [
        {
          "path": "docs/ssa-miniapp/PLAN.md",
          "line": 250,
          "end_line": 300
        }
      ]
    },
    {
      "id": "atomic-publish",
      "type": "database",
      "label": "Publish snapshot",
      "sublabel": "CAS + audit + outbox",
      "pos": [
        342,
        317
      ],
      "size": [
        166,
        65
      ],
      "sources": [
        {
          "path": "docs/ssa-miniapp/PLAN.md",
          "line": 250,
          "end_line": 300
        }
      ]
    },
    {
      "id": "authorized-api",
      "type": "frontend",
      "label": "API / Mini App",
      "sublabel": "Generation / sourceAsOf",
      "pos": [
        36,
        317
      ],
      "size": [
        166,
        65
      ],
      "sources": [
        {
          "path": "docs/ssa-miniapp/PLAN.md",
          "line": 250,
          "end_line": 300
        }
      ]
    }
  ],
  "connections": [
    {
      "id": "misa-export-to-airflow-dag",
      "from": "misa-export",
      "to": "airflow-dag",
      "label": "Nguồn file được duyệt"
    },
    {
      "id": "airflow-dag-to-import-worker",
      "from": "airflow-dag",
      "to": "import-worker",
      "label": "Service principal"
    },
    {
      "id": "import-worker-to-human-review",
      "from": "import-worker",
      "to": "human-review",
      "label": "Preview / batch ID",
      "labelDy": 79
    },
    {
      "id": "human-review-to-atomic-publish",
      "from": "human-review",
      "to": "atomic-publish",
      "label": "Approval / CAS"
    },
    {
      "id": "atomic-publish-to-authorized-api",
      "from": "atomic-publish",
      "to": "authorized-api",
      "label": "Read model theo quyền"
    }
  ],
  "cards": [
    {
      "dot": "amber",
      "title": "Không dùng Apps Script",
      "items": [
        "Airflow không ghi trực tiếp D1.",
        "Không raw file / PII trong XCom hoặc logs."
      ]
    },
    {
      "dot": "cyan",
      "title": "Không mất lịch sử",
      "items": [
        "Delta carry-forward; không suy xóa từ dòng thiếu.",
        "Coach tạo draft; không tự publish."
      ]
    },
    {
      "dot": "emerald",
      "title": "Truy ngược được",
      "items": [
        "Screen → request → generation → batch → row.",
        "DAG run gắn batch ID; contact authority riêng."
      ]
    }
  ]
}
