File size: 2,700 Bytes
1e3bc19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "product-event.schema.json",
  "title": "ProductEvent",
  "description": "One product event (REL-04, R4), measured without mixing records: cohort says whose it is (account, guest, machine, internal, qa) and every count is per cohort; machine, internal and qa never count as people. Only technical public ids, a stage, a latency bucket and an experiment/version: no question text, e-mail, passage, free URL or token, and the subject is a pseudonym (sp_ + HMAC), never the account id. A measurement event exists only with consent 'measurement'; 'essential' events are the ones the product needs to work. Erasure removes a pseudonym's events and stays in force after a restore (privacy/erasure.py).",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "event_id",
    "kind",
    "cohort",
    "subject_ref",
    "tenant_id",
    "consent",
    "occurred_at"
  ],
  "properties": {
    "schema_version": {
      "$ref": "common.schema.json#/$defs/schema_version"
    },
    "event_id": {
      "type": "string",
      "pattern": "^ev_[0-9a-f]{24}$"
    },
    "kind": {
      "enum": [
        "context_ready",
        "analyst_started",
        "analyst_completed",
        "analyst_cancelled",
        "analyst_failed",
        "citation_opened",
        "evidence_opened",
        "scenario_completed",
        "first_lock_confirmed",
        "result_viewed_revision",
        "follows_changed"
      ]
    },
    "cohort": {
      "enum": [
        "account",
        "guest",
        "machine",
        "internal",
        "qa"
      ]
    },
    "subject_ref": {
      "description": "Pseudonym of the subject (HMAC under a server key); null for a machine.",
      "type": [
        "string",
        "null"
      ],
      "pattern": "^sp_[0-9a-f]{32}$"
    },
    "tenant_id": {
      "$ref": "common.schema.json#/$defs/id"
    },
    "consent": {
      "enum": [
        "essential",
        "measurement"
      ]
    },
    "occurred_at": {
      "$ref": "common.schema.json#/$defs/utc"
    },
    "object_id": {
      "description": "A public technical id the event is about (testId, answer id, revision id).",
      "$ref": "common.schema.json#/$defs/id"
    },
    "stage": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]{0,31}$"
    },
    "latency_bucket": {
      "enum": [
        "lt_1s",
        "1_5s",
        "5_20s",
        "gt_20s"
      ]
    },
    "experiment": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9._-]{0,47}$"
    },
    "version": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,31}$"
    }
  }
}