@htilabs/platform-common-models 0.12.4 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/constants/index.cjs +73 -0
  2. package/dist/constants/index.cjs.map +1 -1
  3. package/dist/constants/index.d.cts +1 -1
  4. package/dist/constants/index.d.ts +1 -1
  5. package/dist/constants/index.js +69 -0
  6. package/dist/constants/index.js.map +1 -1
  7. package/dist/{cvcEntry-DaDrEuTa.d.cts → cvcEntry-0BIB9sen.d.cts} +44 -44
  8. package/dist/{cvcEntry-DaDrEuTa.d.ts → cvcEntry-0BIB9sen.d.ts} +44 -44
  9. package/dist/cvcs/index.cjs +1065 -236
  10. package/dist/cvcs/index.cjs.map +1 -1
  11. package/dist/cvcs/index.d.cts +1337 -484
  12. package/dist/cvcs/index.d.ts +1337 -484
  13. package/dist/cvcs/index.js +1065 -236
  14. package/dist/cvcs/index.js.map +1 -1
  15. package/dist/enums/index.cjs +32 -17
  16. package/dist/enums/index.cjs.map +1 -1
  17. package/dist/enums/index.d.cts +38 -23
  18. package/dist/enums/index.d.ts +38 -23
  19. package/dist/enums/index.js +32 -17
  20. package/dist/enums/index.js.map +1 -1
  21. package/dist/{index-C0J3f169.d.ts → index-CDoqrfc1.d.ts} +1 -1
  22. package/dist/{index-EPjPjR0z.d.cts → index-Zu_mOJRn.d.cts} +1 -1
  23. package/dist/index.cjs +1170 -253
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +3 -3
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.js +1166 -253
  28. package/dist/index.js.map +1 -1
  29. package/dist/models/index.d.cts +2 -2
  30. package/dist/models/index.d.ts +2 -2
  31. package/dist/{platform-auth-Dv5fu0Fh.d.cts → platform-auth-64U8jjuw.d.cts} +71 -2
  32. package/dist/{platform-auth-Dv5fu0Fh.d.ts → platform-auth-64U8jjuw.d.ts} +71 -2
  33. package/dist/schemas/index.cjs +62 -0
  34. package/dist/schemas/index.cjs.map +1 -1
  35. package/dist/schemas/index.d.cts +35 -35
  36. package/dist/schemas/index.d.ts +35 -35
  37. package/dist/schemas/index.js +62 -0
  38. package/dist/schemas/index.js.map +1 -1
  39. package/dist/types/index.d.cts +2 -2
  40. package/dist/types/index.d.ts +2 -2
  41. package/package.json +26 -27
  42. package/src/__tests__/__snapshots__/cvc-sot.snap +12 -12
  43. package/src/__tests__/core-information-scope-invariant.test.ts +28 -0
  44. package/src/__tests__/cvc-drift-gate.test.ts +16 -5
  45. package/src/__tests__/cvc-sot-snapshot.test.ts +24 -14
  46. package/src/__tests__/cvc-structural.test.ts +8 -8
  47. package/src/__tests__/incident-participation-roles-canon.test.ts +424 -0
  48. package/src/__tests__/referral-entity-category-canon.test.ts +383 -0
  49. package/src/__tests__/victim-abuse-types-canon.test.ts +301 -0
  50. package/src/constants/ic.ts +158 -0
  51. package/src/cvcs/coreInformationScope.v1.0.0.json +3 -3
  52. package/src/cvcs/{highestEducationLevelCompleted.v1.0.0.json → highestEducationLevelCompleted.v1.1.0.json} +1 -1
  53. package/src/cvcs/incidentParticipationRoles.v1.1.0.json +433 -0
  54. package/src/cvcs/{incomeBenefitsSources.v1.0.0.json → incomeBenefitsSources.v1.1.0.json} +1 -1
  55. package/src/cvcs/index.ts +8 -8
  56. package/src/cvcs/{referralEntityCategory.v1.0.0.json → referralEntityCategory.v1.1.0.json} +192 -54
  57. package/src/cvcs/{serviceStates.v1.0.0.json → serviceStates.v1.1.0.json} +1 -1
  58. package/src/cvcs/{sourceSubtype.v1.1.0.json → sourceSubtype.v1.2.0.json} +1 -1
  59. package/src/cvcs/{verificationMethod.v1.0.0.json → verificationMethod.v1.1.0.json} +1 -1
  60. package/src/cvcs/victimAbuseTypes.v1.1.0.json +744 -0
  61. package/src/generated/cvc-enums.ts +38 -23
  62. package/src/cvcs/incidentParticipationRoles.v1.0.0.json +0 -212
  63. package/src/cvcs/victimAbuseTypes.v1.0.0.json +0 -276
@@ -0,0 +1,301 @@
1
+ /**
2
+ * VICTIM ABUSE TYPES (CVC-73) — the canon v1.1 key-set pin
3
+ * ========================================================
4
+ *
5
+ * platform-common's CVC-73 mirror shipped STALE through 0.12.4: victimAbuseTypes
6
+ * v1.0.0 carried 25 substantive rows in the CVC-52 FUNDER dialect (adult/child
7
+ * age splits, `domestic_and_or_family_violence`, bare `other`, ...) plus an
8
+ * UNK/ANON/DNC block, while canon had been audited (2026-09-01, CVC73-AUDIT) and
9
+ * amended (2026-09-29, cyber_crimes) to 30 codes with no missingness. Nothing
10
+ * failed, because every gate in this package checks a SOT file against ITSELF
11
+ * (shape, tree, counts it was told) — none knew what canon's keys ARE.
12
+ *
13
+ * This test is that knowledge. The tables below are TRANSCRIBED from canon —
14
+ * htilabstech/prototype `data/cvcs/core_victim_abuse_types.yaml` @ 63913935
15
+ * (read from origin/main @ 06734d05) — NOT derived from the JSON, so a
16
+ * regenerated JSON that drifts from canon fails here instead of silently
17
+ * updating its own expectation. Canon line citations are to that blob:
18
+ *
19
+ * - The 30 codes, in canon row order (yaml `entries:` L185-L458).
20
+ * - "MISSINGNESS: deliberately none" (yaml L51-L57; gate G3 "FAILS if
21
+ * UNK/ANON/DNC appear here").
22
+ * - AGE + RECENCY are reporting gates, not codes (yaml L59-L64, Crysta R2):
23
+ * the adult/child split must NEVER come back as separate keys.
24
+ * - `trafficking_context: true` rows — censused, never counted (yaml L66-L72, R1).
25
+ * - `other_voca_ovc` is the only catch-all, `describe_required` (yaml L450-L458, R3).
26
+ *
27
+ * It also pins the FROZEN positional ordinals: a published ordinal is a
28
+ * concept's identity, never renumbered or reused (gen-victim-abuse-types.py).
29
+ */
30
+
31
+ import { readFileSync } from "node:fs";
32
+ import path from "node:path";
33
+ import { fileURLToPath } from "node:url";
34
+
35
+ import { describe, it, expect } from "vitest";
36
+
37
+ import { VictimAbuseTypesKeys } from "../generated/cvc-enums.js";
38
+
39
+ const here = path.dirname(fileURLToPath(import.meta.url));
40
+ const FILE = path.join(here, "..", "cvcs", "victimAbuseTypes.v1.1.0.json");
41
+
42
+ interface Entry {
43
+ code: string;
44
+ key: string;
45
+ title: string;
46
+ selectable: boolean;
47
+ parentCode: string | null;
48
+ childCodes: string[];
49
+ definition: string | null;
50
+ uiGroup: string;
51
+ ageRequired: boolean;
52
+ recencyRequired: boolean;
53
+ traffickingContext: boolean;
54
+ describeRequired: boolean;
55
+ }
56
+ interface Envelope {
57
+ domain: string;
58
+ version: string;
59
+ _status: string;
60
+ _source: string;
61
+ _supersedes: {
62
+ version: string;
63
+ keyMap: Record<string, string | null>;
64
+ retiredCodes: {
65
+ code: string;
66
+ key: string;
67
+ successor: string | null;
68
+ impliedAgeBandAtEvent?: "adult" | "minor";
69
+ }[];
70
+ notes: Record<string, string>;
71
+ };
72
+ uiGroups: { key: string; label: string }[];
73
+ levels: Record<string, string>;
74
+ entries: Entry[];
75
+ }
76
+
77
+ const env = JSON.parse(readFileSync(FILE, "utf8")) as Envelope;
78
+ const keys = env.entries.map((e) => e.key);
79
+
80
+ /** Canon v1.1 code → frozen ordinal, in canon row order (yaml L186-L450). */
81
+ const CANON: ReadonlyArray<readonly [key: string, ordinal: number]> = [
82
+ ["sexual_abuse_assault", 26],
83
+ ["domestic_family_violence", 9],
84
+ ["stalking_harassment", 22],
85
+ ["child_pornography", 7],
86
+ ["physical_abuse_or_neglect", 27],
87
+ ["physical_assault", 28],
88
+ ["commercial_sexual_exploitation_minor", 29],
89
+ ["sexual_exploitation", 30],
90
+ ["labor_exploitation", 31],
91
+ ["teen_dating_victimization", 24],
92
+ ["female_genital_mutilation_cutting", 32],
93
+ ["forced_marriage", 33],
94
+ ["gang_violence", 12],
95
+ ["kidnapping_noncustodial", 17],
96
+ ["kidnapping_custodial", 16],
97
+ ["elder_abuse_or_neglect", 11],
98
+ ["bullying", 4],
99
+ ["homicide", 14],
100
+ ["survivor_of_homicide_victim", 23],
101
+ ["hate_crime", 13],
102
+ ["robbery", 21],
103
+ ["burglary", 5],
104
+ ["arson", 3],
105
+ ["dui_dwi_incident", 10],
106
+ ["identity_theft_fraud_financial_crime", 15],
107
+ ["other_vehicular_victimization", 20],
108
+ ["cyber_crimes", 34],
109
+ ["terrorism", 25],
110
+ ["mass_violence", 18],
111
+ ["other_voca_ovc", 19],
112
+ ];
113
+
114
+ /**
115
+ * Every key v1.0.0 published (platform-common <= 0.12.4) that is NOT a canon
116
+ * key. None may reappear — each is either a funder-dialect spelling, an age
117
+ * split canon R2 forbids encoding, or a missingness token canon G3 forbids.
118
+ */
119
+ const RETIRED_V1_0_0_KEYS = [
120
+ "missingness_root",
121
+ "unknown",
122
+ "anonymous",
123
+ "data_not_collected",
124
+ "adult_physical_assault",
125
+ "adult_sexual_assault",
126
+ "child_physical_abuse_or_neglect",
127
+ "child_sexual_abuse_assault",
128
+ "domestic_and_or_family_violence",
129
+ "dui_dwi_incidents",
130
+ "elder_abuse",
131
+ "identity_theft",
132
+ "other",
133
+ "other_vehicular",
134
+ "survivors_of_homicide_victims",
135
+ ] as const;
136
+
137
+ /** v1.0.0 ordinals whose meaning canon changed — retired, never reused. */
138
+ const RETIRED_ORDINALS = [1, 2, 6, 8] as const;
139
+
140
+ const ord = (n: number): string => `073-${String(n).padStart(3, "0")}-000-000-000-000-000`;
141
+
142
+ describe("CVC-73 victim_abuse_types — canon v1.1 key set", () => {
143
+ it("is the v1.1.0 victim_abuse_types envelope", () => {
144
+ expect(env.domain).toBe("victim_abuse_types");
145
+ expect(env.version).toBe("1.1.0");
146
+ });
147
+
148
+ it("carries exactly canon's 30 keys, in canon row order", () => {
149
+ expect(keys).toEqual(CANON.map(([k]) => k));
150
+ expect(keys).toHaveLength(30);
151
+ });
152
+
153
+ it("every key sits on its FROZEN ordinal", () => {
154
+ const actual = Object.fromEntries(env.entries.map((e) => [e.key, e.code]));
155
+ const expected = Object.fromEntries(CANON.map(([k, n]) => [k, ord(n)]));
156
+ expect(actual).toEqual(expected);
157
+ });
158
+
159
+ it("no retired v1.0.0 ordinal is reused", () => {
160
+ const codes = new Set(env.entries.map((e) => e.code));
161
+ for (const n of RETIRED_ORDINALS) expect(codes.has(ord(n)), ord(n)).toBe(false);
162
+ });
163
+
164
+ it("carries NO missingness (canon L51: 'deliberately none'; G3)", () => {
165
+ expect(env.entries.filter((e) => e.code.split("-")[1] === "000")).toEqual([]);
166
+ expect(Object.keys(env.levels)).toEqual(["1"]);
167
+ });
168
+
169
+ it("no retired v1.0.0 key (funder dialect / age split / missingness) reappears", () => {
170
+ for (const k of RETIRED_V1_0_0_KEYS) expect(keys, k).not.toContain(k);
171
+ });
172
+
173
+ it("every entry is a flat, selectable, defined L1 row", () => {
174
+ for (const e of env.entries) {
175
+ expect(e.selectable, e.key).toBe(true);
176
+ expect(e.parentCode, e.key).toBeNull();
177
+ expect(e.childCodes, e.key).toEqual([]);
178
+ expect(e.definition, e.key).toBeTruthy();
179
+ expect(e.title, e.key).toBeTruthy();
180
+ }
181
+ });
182
+ });
183
+
184
+ describe("CVC-73 — the reporting gates and rulings canon encodes", () => {
185
+ const where = (pred: (e: Entry) => boolean): string[] =>
186
+ env.entries.filter(pred).map((e) => e.key).sort();
187
+
188
+ it("ageRequired marks exactly canon's VOCA age-split codes (R2)", () => {
189
+ expect(where((e) => e.ageRequired)).toEqual(
190
+ [
191
+ "commercial_sexual_exploitation_minor",
192
+ "labor_exploitation",
193
+ "physical_abuse_or_neglect",
194
+ "physical_assault",
195
+ "sexual_abuse_assault",
196
+ "sexual_exploitation",
197
+ ].sort(),
198
+ );
199
+ });
200
+
201
+ it("recencyRequired marks exactly the HMIS 4.11 code", () => {
202
+ expect(where((e) => e.recencyRequired)).toEqual(["domestic_family_violence"]);
203
+ });
204
+
205
+ it("traffickingContext marks exactly the three exploitation codes (R1)", () => {
206
+ expect(where((e) => e.traffickingContext)).toEqual(
207
+ ["commercial_sexual_exploitation_minor", "labor_exploitation", "sexual_exploitation"].sort(),
208
+ );
209
+ });
210
+
211
+ it("other_voca_ovc is the only catch-all, and requires a description (R3)", () => {
212
+ expect(where((e) => e.describeRequired)).toEqual(["other_voca_ovc"]);
213
+ });
214
+
215
+ it("every uiGroup is one of canon's ui_groups, in canon order (yaml L104-L149)", () => {
216
+ expect(env.uiGroups.map((g) => g.key)).toEqual([
217
+ "common",
218
+ "exploitation",
219
+ "ipv",
220
+ "property",
221
+ "public",
222
+ "other",
223
+ ]);
224
+ const groups = new Set(env.uiGroups.map((g) => g.key));
225
+ for (const e of env.entries) expect(groups.has(e.uiGroup), e.key).toBe(true);
226
+ });
227
+ });
228
+
229
+ describe("CVC-73 — supersession of v1.0.0 and provenance", () => {
230
+ it("_supersedes maps EVERY v1.0.0 key, to a live key or null", () => {
231
+ const live = new Set(keys);
232
+ const map = env._supersedes.keyMap;
233
+ expect(env._supersedes.version).toBe("1.0.0");
234
+ // 29 v1.0.0 entries: 4 missingness + 25 substantive.
235
+ expect(Object.keys(map)).toHaveLength(29);
236
+ for (const k of RETIRED_V1_0_0_KEYS) expect(Object.keys(map), k).toContain(k);
237
+ for (const [old, next] of Object.entries(map)) {
238
+ if (next !== null) expect(live.has(next), `${old} -> ${next}`).toBe(true);
239
+ }
240
+ for (const k of ["missingness_root", "unknown", "anonymous", "data_not_collected"]) {
241
+ expect(map[k], k).toBeNull();
242
+ }
243
+ });
244
+
245
+ it("the funder-dialect renames land on canon spellings", () => {
246
+ const map = env._supersedes.keyMap;
247
+ expect(map.domestic_and_or_family_violence).toBe("domestic_family_violence");
248
+ expect(map.adult_sexual_assault).toBe("sexual_abuse_assault");
249
+ expect(map.child_sexual_abuse_assault).toBe("sexual_abuse_assault");
250
+ expect(map.other).toBe("other_voca_ovc");
251
+ });
252
+
253
+ it("each retired age-split code records the age band its key implied", () => {
254
+ // Canon codebook 4: physical_assault Logic Notes "... when age_band_at_event
255
+ // = adult"; physical_abuse_or_neglect Guidance "set age_band_at_event = minor".
256
+ const bands = Object.fromEntries(
257
+ env._supersedes.retiredCodes
258
+ .filter((r) => r.impliedAgeBandAtEvent !== undefined)
259
+ .map((r) => [r.key, r.impliedAgeBandAtEvent]),
260
+ );
261
+ expect(bands).toEqual({
262
+ adult_physical_assault: "adult",
263
+ adult_sexual_assault: "adult",
264
+ child_physical_abuse_or_neglect: "minor",
265
+ child_sexual_abuse_assault: "minor",
266
+ });
267
+ });
268
+
269
+ it("flags that v1.0.0 `other` reads narrower under v1.1.0", () => {
270
+ const note = env._supersedes.notes.other;
271
+ for (const k of [
272
+ "commercial_sexual_exploitation_minor",
273
+ "sexual_exploitation",
274
+ "labor_exploitation",
275
+ "female_genital_mutilation_cutting",
276
+ "forced_marriage",
277
+ "cyber_crimes",
278
+ ]) {
279
+ expect(note, k).toContain(k);
280
+ }
281
+ });
282
+
283
+ it("_source pins the canon yaml at a SHA, read from origin/main", () => {
284
+ expect(env._source).toMatch(
285
+ /htilabstech\/prototype\/data\/cvcs\/core_victim_abuse_types\.yaml @ [0-9a-f]{8}/,
286
+ );
287
+ // The ref commit READ is deliberately NOT pinned (it would churn the SOT on
288
+ // every unrelated prototype commit) — only the canon-file commit is.
289
+ expect(env._source).toMatch(/read from origin\/main\)$/);
290
+ });
291
+
292
+ it("_status is a CANONICAL provenance note", () => {
293
+ expect(env._status.startsWith("CANONICAL — Notion CVC-73")).toBe(true);
294
+ });
295
+
296
+ it("the generated VictimAbuseTypesKeys is the same key → code map", () => {
297
+ expect(VictimAbuseTypesKeys).toEqual(
298
+ Object.fromEntries(env.entries.map((e) => [e.key, e.code])),
299
+ );
300
+ });
301
+ });
@@ -1973,6 +1973,13 @@ export const USER_STATUS_LABELS: Record<UserStatusValue, string> = {
1973
1973
 
1974
1974
  // ─── CVC-69: Incident Participation Role ────────────────────────────
1975
1975
  // Multi-valued: 0+ per person per session. Describes session participation.
1976
+ //
1977
+ // Legacy view of the SOT `src/cvcs/incidentParticipationRoles.v1.1.0.json`
1978
+ // (canon CVC-69 v1.0, audited 2026-09-10). Canon renamed five keys on
1979
+ // 2026-08-13; the old keys are KEPT here (marked `@deprecated`) because
1980
+ // consumers persist these keys on documents — a stored old key still validates
1981
+ // and still has a label. New writes should use the successor: see
1982
+ // `INCIDENT_PARTICIPATION_ROLE_SUPERSEDED_BY` below.
1976
1983
 
1977
1984
  export const INCIDENT_PARTICIPATION_ROLE = {
1978
1985
  CLIENT_SUBJECT: "client_subject", // Exactly 1 per session
@@ -1981,12 +1988,32 @@ export const INCIDENT_PARTICIPATION_ROLE = {
1981
1988
  REPORTER: "reporter",
1982
1989
  FAMILY_MEMBER_OR_GUARDIAN: "family_member_or_guardian",
1983
1990
  FRIEND_OR_PEER: "friend_or_peer",
1991
+ /** @deprecated Superseded by `VSP_STAFF` (canon CVC-69, 2026-08-13). Read-only. */
1984
1992
  SERVICE_PROVIDER_STAFF: "service_provider_staff",
1993
+ /** @deprecated Superseded by `HEALTHCARE_PROVIDER_STAFF` (canon CVC-69, 2026-08-13). Read-only. */
1985
1994
  MEDICAL_PROVIDER_STAFF: "medical_provider_staff",
1995
+ /** @deprecated Superseded by `DATA_ENTRY_STAFF` (canon CVC-69, 2026-08-13). Read-only. */
1986
1996
  DATA_ENTRY: "data_entry",
1997
+ /** @deprecated Superseded by `OTHER_RESPONSE_PERSONNEL` (canon CVC-69, 2026-08-13). Read-only. */
1987
1998
  OTHER_INCIDENT_RESPONDER: "other_incident_responder",
1999
+ /** @deprecated Superseded by `LAW_ENFORCEMENT_PERSONNEL` (canon CVC-69, 2026-08-13). Read-only. */
1988
2000
  RESPONDING_OFFICER: "responding_officer",
1989
2001
  LEGAL_PROFESSIONAL: "legal_professional",
2002
+ // Canon CVC-69 v1.0 — the five renamed codes + task_force.
2003
+ VSP_STAFF: "vsp_staff",
2004
+ HEALTHCARE_PROVIDER_STAFF: "healthcare_provider_staff",
2005
+ LAW_ENFORCEMENT_PERSONNEL: "law_enforcement_personnel",
2006
+ OTHER_RESPONSE_PERSONNEL: "other_response_personnel",
2007
+ DATA_ENTRY_STAFF: "data_entry_staff",
2008
+ TASK_FORCE: "task_force",
2009
+ // Canon Level-2 sub-items (LEADS investigative wing). A sub-item implies its
2010
+ // parent: the first four sit under LAW_ENFORCEMENT_PERSONNEL, PROSECUTOR
2011
+ // under LEGAL_PROFESSIONAL.
2012
+ LEAD_INVESTIGATOR: "lead_investigator",
2013
+ INVESTIGATOR: "investigator",
2014
+ ANALYST: "analyst",
2015
+ LE_OFFICER: "le_officer",
2016
+ PROSECUTOR: "prosecutor",
1990
2017
  UNKNOWN: "unknown",
1991
2018
  ANONYMOUS: "anonymous",
1992
2019
  DATA_NOT_COLLECTED: "data_not_collected",
@@ -2008,11 +2035,29 @@ export const INCIDENT_PARTICIPATION_ROLE_VALUES = [
2008
2035
  INCIDENT_PARTICIPATION_ROLE.OTHER_INCIDENT_RESPONDER,
2009
2036
  INCIDENT_PARTICIPATION_ROLE.RESPONDING_OFFICER,
2010
2037
  INCIDENT_PARTICIPATION_ROLE.LEGAL_PROFESSIONAL,
2038
+ INCIDENT_PARTICIPATION_ROLE.VSP_STAFF,
2039
+ INCIDENT_PARTICIPATION_ROLE.HEALTHCARE_PROVIDER_STAFF,
2040
+ INCIDENT_PARTICIPATION_ROLE.LAW_ENFORCEMENT_PERSONNEL,
2041
+ INCIDENT_PARTICIPATION_ROLE.OTHER_RESPONSE_PERSONNEL,
2042
+ INCIDENT_PARTICIPATION_ROLE.DATA_ENTRY_STAFF,
2043
+ INCIDENT_PARTICIPATION_ROLE.TASK_FORCE,
2044
+ INCIDENT_PARTICIPATION_ROLE.LEAD_INVESTIGATOR,
2045
+ INCIDENT_PARTICIPATION_ROLE.INVESTIGATOR,
2046
+ INCIDENT_PARTICIPATION_ROLE.ANALYST,
2047
+ INCIDENT_PARTICIPATION_ROLE.LE_OFFICER,
2048
+ INCIDENT_PARTICIPATION_ROLE.PROSECUTOR,
2011
2049
  INCIDENT_PARTICIPATION_ROLE.UNKNOWN,
2012
2050
  INCIDENT_PARTICIPATION_ROLE.ANONYMOUS,
2013
2051
  INCIDENT_PARTICIPATION_ROLE.DATA_NOT_COLLECTED,
2014
2052
  ] as const;
2015
2053
 
2054
+ // Labels for the fifteen keys 0.13.0 shipped are kept exactly as shipped: they
2055
+ // are title-cased and several differ from the SOT titles and canon (e.g.
2056
+ // "Legal Professional" vs canon "Legal professional", "Not Collected" vs
2057
+ // "Data not collected"). Consumers display these strings, so re-casing them is a
2058
+ // visible change on repin and belongs in its own announced change, not in this
2059
+ // additive re-mirror. Labels for the eleven keys added in v1.1.0 are the canon
2060
+ // codebook `Acceptable name`, verbatim.
2016
2061
  export const INCIDENT_PARTICIPATION_ROLE_LABELS: Record<
2017
2062
  IncidentParticipationRoleValue,
2018
2063
  string
@@ -2033,6 +2078,22 @@ export const INCIDENT_PARTICIPATION_ROLE_LABELS: Record<
2033
2078
  "VSP or Other Incident Responder",
2034
2079
  [INCIDENT_PARTICIPATION_ROLE.RESPONDING_OFFICER]: "LE Responding Officer",
2035
2080
  [INCIDENT_PARTICIPATION_ROLE.LEGAL_PROFESSIONAL]: "Legal Professional",
2081
+ // Added in v1.1.0: the canon codebook `Acceptable name`, verbatim.
2082
+ [INCIDENT_PARTICIPATION_ROLE.VSP_STAFF]: "Victim Service provider staff",
2083
+ [INCIDENT_PARTICIPATION_ROLE.HEALTHCARE_PROVIDER_STAFF]:
2084
+ "Healthcare provider staff",
2085
+ [INCIDENT_PARTICIPATION_ROLE.LAW_ENFORCEMENT_PERSONNEL]:
2086
+ "Law enforcement personnel",
2087
+ [INCIDENT_PARTICIPATION_ROLE.OTHER_RESPONSE_PERSONNEL]:
2088
+ "Other Response Personnel",
2089
+ [INCIDENT_PARTICIPATION_ROLE.DATA_ENTRY_STAFF]: "Data Entry / Editor",
2090
+ [INCIDENT_PARTICIPATION_ROLE.TASK_FORCE]: "Task Force Partner",
2091
+ [INCIDENT_PARTICIPATION_ROLE.LEAD_INVESTIGATOR]: "Lead Investigator",
2092
+ [INCIDENT_PARTICIPATION_ROLE.INVESTIGATOR]: "Investigator / Detective",
2093
+ [INCIDENT_PARTICIPATION_ROLE.ANALYST]: "Analyst",
2094
+ [INCIDENT_PARTICIPATION_ROLE.LE_OFFICER]: "LE Officer",
2095
+ [INCIDENT_PARTICIPATION_ROLE.PROSECUTOR]: "Prosecutor",
2096
+ // Level 0, as 0.13.0 shipped them (canon: Unknown / Anonymous / Data not collected).
2036
2097
  [INCIDENT_PARTICIPATION_ROLE.UNKNOWN]: "Unknown",
2037
2098
  [INCIDENT_PARTICIPATION_ROLE.ANONYMOUS]: "Anonymous",
2038
2099
  [INCIDENT_PARTICIPATION_ROLE.DATA_NOT_COLLECTED]: "Not Collected",
@@ -2041,6 +2102,12 @@ export const INCIDENT_PARTICIPATION_ROLE_LABELS: Record<
2041
2102
  /**
2042
2103
  * Participation role category groupings for UI organization.
2043
2104
  *
2105
+ * NOT YET RE-KEYED: `SYSTEM_PROFESSIONAL` (and
2106
+ * `DEFAULT_PARTICIPATION_ROLE_BY_CATEGORY.PERSONNEL` below) still name the
2107
+ * superseded `SERVICE_PROVIDER_STAFF` / `MEDICAL_PROVIDER_STAFF` keys. They are
2108
+ * deliberately left as-is: flipping them changes what a consumer WRITES on a
2109
+ * version bump, so that switch belongs to each consumer's own migration.
2110
+ *
2044
2111
  * Note: UNKNOWN, ANONYMOUS, and DATA_NOT_COLLECTED are intentionally excluded.
2045
2112
  * These are data quality states, not selectable participation roles.
2046
2113
  * Handle them via separate UI controls (e.g., "Unknown" / "Anonymous" buttons).
@@ -2070,6 +2137,91 @@ export const CALLER_IS_VICTIM_ROLES: IncidentParticipationRoleValue[] = [
2070
2137
  INCIDENT_PARTICIPATION_ROLE.REPORTER,
2071
2138
  ];
2072
2139
 
2140
+ /**
2141
+ * The five CVC-69 keys canon superseded on 2026-08-13, each mapped to its
2142
+ * canonical successor (SOT `incidentParticipationRoles.v1.1.0.json`:
2143
+ * `deprecated: true` + `supersededBy`).
2144
+ *
2145
+ * A superseded key is still a VALID STORED VALUE: it stays in
2146
+ * `INCIDENT_PARTICIPATION_ROLE_VALUES`, keeps its label, and still resolves in
2147
+ * the seeded registry — nothing persisted has to be rewritten. It is only no
2148
+ * longer offered for NEW writes (`selectable: false` in the SOT;
2149
+ * `ACTIVE_INCIDENT_PARTICIPATION_ROLE_VALUES` below).
2150
+ *
2151
+ * The mapping is canon's rename ruling, not a guarantee of identical meaning:
2152
+ * `other_incident_responder` was labelled "VSP or Other Incident Responder",
2153
+ * while `other_response_personnel` excludes VSP staff. Normalising for display
2154
+ * or grouping is safe; a one-way data migration should review that key.
2155
+ */
2156
+ export const INCIDENT_PARTICIPATION_ROLE_SUPERSEDED_BY = {
2157
+ [INCIDENT_PARTICIPATION_ROLE.SERVICE_PROVIDER_STAFF]:
2158
+ INCIDENT_PARTICIPATION_ROLE.VSP_STAFF,
2159
+ [INCIDENT_PARTICIPATION_ROLE.MEDICAL_PROVIDER_STAFF]:
2160
+ INCIDENT_PARTICIPATION_ROLE.HEALTHCARE_PROVIDER_STAFF,
2161
+ [INCIDENT_PARTICIPATION_ROLE.DATA_ENTRY]:
2162
+ INCIDENT_PARTICIPATION_ROLE.DATA_ENTRY_STAFF,
2163
+ [INCIDENT_PARTICIPATION_ROLE.OTHER_INCIDENT_RESPONDER]:
2164
+ INCIDENT_PARTICIPATION_ROLE.OTHER_RESPONSE_PERSONNEL,
2165
+ [INCIDENT_PARTICIPATION_ROLE.RESPONDING_OFFICER]:
2166
+ INCIDENT_PARTICIPATION_ROLE.LAW_ENFORCEMENT_PERSONNEL,
2167
+ } as const satisfies Partial<
2168
+ Record<IncidentParticipationRoleValue, IncidentParticipationRoleValue>
2169
+ >;
2170
+
2171
+ export type DeprecatedIncidentParticipationRoleValue =
2172
+ keyof typeof INCIDENT_PARTICIPATION_ROLE_SUPERSEDED_BY;
2173
+
2174
+ /** `true` iff `role` is a superseded (read-only) CVC-69 key. */
2175
+ export function isDeprecatedIncidentParticipationRole(
2176
+ role: unknown,
2177
+ ): role is DeprecatedIncidentParticipationRoleValue {
2178
+ return (
2179
+ typeof role === "string" &&
2180
+ Object.prototype.hasOwnProperty.call(
2181
+ INCIDENT_PARTICIPATION_ROLE_SUPERSEDED_BY,
2182
+ role,
2183
+ )
2184
+ );
2185
+ }
2186
+
2187
+ /**
2188
+ * The canonical CVC-69 key for a stored value: the successor of a superseded
2189
+ * key, otherwise the value unchanged. Pure; never validates — an unknown
2190
+ * string is returned as-is.
2191
+ */
2192
+ export function canonicalIncidentParticipationRole<T extends string>(
2193
+ role: T,
2194
+ ): T | IncidentParticipationRoleValue {
2195
+ return isDeprecatedIncidentParticipationRole(role)
2196
+ ? INCIDENT_PARTICIPATION_ROLE_SUPERSEDED_BY[role]
2197
+ : role;
2198
+ }
2199
+
2200
+ /** A CVC-69 value that may be written fresh: any value except the five superseded keys. */
2201
+ export type ActiveIncidentParticipationRoleValue = Exclude<
2202
+ IncidentParticipationRoleValue,
2203
+ DeprecatedIncidentParticipationRoleValue
2204
+ >;
2205
+
2206
+ /**
2207
+ * Every CVC-69 value that may be WRITTEN fresh:
2208
+ * `INCIDENT_PARTICIPATION_ROLE_VALUES` minus the five superseded keys. Use
2209
+ * `INCIDENT_PARTICIPATION_ROLE_VALUES` to VALIDATE stored values.
2210
+ *
2211
+ * This is not a picker list as it stands. It still contains ANONYMOUS and
2212
+ * DATA_NOT_COLLECTED, which canon never offers in a picker: ANONYMOUS is set
2213
+ * by a decline affordance and DATA_NOT_COLLECTED only by the system. The SOT
2214
+ * marks both `neverPickable`, but that flag lives in the JSON only (the
2215
+ * `cvc_entities` schema does not persist it), so a picker built from this
2216
+ * list must drop the two itself.
2217
+ */
2218
+ export const ACTIVE_INCIDENT_PARTICIPATION_ROLE_VALUES = Object.freeze(
2219
+ INCIDENT_PARTICIPATION_ROLE_VALUES.filter(
2220
+ (role): role is ActiveIncidentParticipationRoleValue =>
2221
+ !isDeprecatedIncidentParticipationRole(role),
2222
+ ),
2223
+ );
2224
+
2073
2225
  // ─── Person Display Category ────────────────────────────────────────
2074
2226
  // 5 UI groupings for displaying persons based on involvement role.
2075
2227
 
@@ -2206,6 +2358,12 @@ export function getDisplayCategoryForRole(
2206
2358
 
2207
2359
  // ─── Default Participation Roles by Display Category ───────────────
2208
2360
  // When toggling "Involved" on, these are the default participation roles.
2361
+ //
2362
+ // NOT YET RE-KEYED: PERSONNEL still defaults to the superseded
2363
+ // `SERVICE_PROVIDER_STAFF` (canonical successor `VSP_STAFF`). Deliberate: a
2364
+ // default decides what a consumer WRITES, so changing it here would change
2365
+ // consumer writes on a version bump. Each consumer switches to `VSP_STAFF` in
2366
+ // its own repin. Same for `PARTICIPATION_ROLE_CATEGORIES.SYSTEM_PROFESSIONAL`.
2209
2367
 
2210
2368
  export const DEFAULT_PARTICIPATION_ROLE_BY_CATEGORY: Record<
2211
2369
  PersonDisplayCategoryValue,
@@ -2,8 +2,8 @@
2
2
  "domain": "core_information_scope",
3
3
  "name": "Core Information Scope",
4
4
  "version": "1.0.0",
5
- "_status": "DRAFT: canonical number 236, self-declared by the source YAML (`cvc_id: CVC-236`); CVC_INDEX.md carries no row for it yet, so the drift gate classifies it INDEX_ABSENT. Sourced from canonical CVC-236 `core_information_scope` v2 (authored 2026-08-13, restructured 2026-08-14): 12 categories / 56 units. TWO GRAINS, deliberately modelled as hierarchy: L1 categories are the POLICY grain and are NOT selectable; L2 units are the AUTHORIZATION grain and are what an ROI or a share actually authorizes. This is the axis the sibling `roi_scope` domain deliberately omits — `roi_scope` is the flat item vocabulary, and its 27 substantive keys are a strict SUBSET of the 56 units here, with no renames and no collisions. That subset relationship is what makes adopting this domain additive: every stored ROI keeps its exact recorded meaning. `safe_locations` is PROVISIONAL and may be re-keyed by the Notion steward batch — pin the id with the product owner before any consumer treats it as stable. PENDING canonical Notion authoring + steward ratification.",
6
- "_source": "htilabstech/prototype/data/cvcs/core_information_scope.yaml @ 55088d44 (CVC-236 v2, restructured 2026-08-14, amended 2026-10-01; read from origin/main; structural columns cross-checked against htilabstech/prototype/Final CVCs/System Roles, Permissions, & Account Management (IC-66)/core-information_scope — codebook.csv @ 55088d44)",
5
+ "_status": "DRAFT: canonical number 236, self-declared by the source YAML (`cvc_id: CVC-236`); CVC_INDEX.md carries no row for it yet, so the drift gate classifies it INDEX_ABSENT. Sourced from canonical CVC-236 `core_information_scope` v2 (authored 2026-08-13, restructured 2026-08-14): 12 categories / 56 units. TWO GRAINS, deliberately modelled as hierarchy: L1 categories are the POLICY grain and are NOT selectable; L2 units are the AUTHORIZATION grain and are what an ROI or a share actually authorizes. This is the axis the sibling `roi_scope` domain deliberately omits — `roi_scope` is the flat item vocabulary, and its 27 substantive keys are a strict SUBSET of the 56 units here, with no renames and no collisions. That subset relationship is what makes adopting this domain additive: every stored ROI keeps its exact recorded meaning. `safe_locations` is CANON since CVC236-AUDIT R1 (Crysta, 2026-09-08): id and label ratified and minted in the Notion codebook; the former PROVISIONAL marker is retired. PENDING canonical Notion authoring + steward ratification.",
6
+ "_source": "htilabstech/prototype/data/cvcs/core_information_scope.yaml @ 55088d44 (CVC-236 v2, restructured 2026-08-14, amended 2026-10-01; read from 46a60114; structural columns cross-checked against htilabstech/prototype/Final CVCs/System Roles, Permissions, & Account Management (IC-66)/core-information_scope — codebook.csv @ 55088d44)",
7
7
  "levels": {
8
8
  "0": "Unknown or Missing",
9
9
  "1": "Category (policy grain, not selectable)",
@@ -506,7 +506,7 @@
506
506
  "selectable": true,
507
507
  "parentCode": "236-003-000-000-000-000-000",
508
508
  "childCodes": [],
509
- "definition": "Safe & confidential locations. Category `contact`. NEW 2026-08-18 (CASESHARE ADR settings-deltas WI-3, Ava directive — 'the safety floor sits above any agency's configuration'): the platform safety floor's example class (shelter placements / confidential program addresses) had NO CVC-236 item. Extends the standing agency-side confidential-address practice (surveys `confidential` flag → SRL masking) to the case-sharing layer. platform_floor marks it PLATFORM-OWNED — never enableable by any agency (HTI_PLATFORM_SAFETY_FLOOR + the § 5.79 resolver's floor layer 0); the generator therefore emits it to the platform scopeCatalog with `floor: true` and EXCLUDES it from the monolith PAVE/Thread share-drawer slice (that lane's floor semantics are deferred per the settings-deltas kickoff § 5 — an ordinary default-off toggle there would misstate 'never enableable'). Registry-homed 2026-08-19 after the value was first hand-authored inside the generator-owned platform block (broke the JSON gate — content lands HERE, never in the emitted block). PROVISIONAL vocabulary pending the CVC-236 Notion steward batch; id/label may be re-keyed by that batch.",
509
+ "definition": "Safe & confidential locations. Category `contact`. NEW 2026-08-18 (CASESHARE ADR settings-deltas WI-3, Ava directive — 'the safety floor sits above any agency's configuration'): the platform safety floor's example class (shelter placements / confidential program addresses) had NO CVC-236 item. Extends the standing agency-side confidential-address practice (surveys `confidential` flag → SRL masking) to the case-sharing layer. platform_floor marks it PLATFORM-OWNED — never enableable by any agency (HTI_PLATFORM_SAFETY_FLOOR + the § 5.79 resolver's floor layer 0); the generator therefore emits it to the platform scopeCatalog with `floor: true` and EXCLUDES it from the monolith PAVE/Thread share-drawer slice (that lane's floor semantics are deferred per the settings-deltas kickoff § 5 — an ordinary default-off toggle there would misstate 'never enableable'). Registry-homed 2026-08-19 after the value was first hand-authored inside the generator-owned platform block (broke the JSON gate — content lands HERE, never in the emitted block). RATIFIED 2026-09-08 (CVC236-AUDIT R1, Crysta): id and label are CANON and the row is now minted in the Notion codebook — this WAS the pending steward batch. Superseded the 21-day PROVISIONAL marker; retires RWT-NEW-caseshare-safe-locations-steward-2026-08-19.",
510
510
  "levelFloor": 3,
511
511
  "appRelevance": [
512
512
  "PAVE",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "domain": "highest_education_level_completed",
3
3
  "name": "Core Highest Education Level Completed",
4
- "version": "1.0.0",
4
+ "version": "1.1.0",
5
5
  "levels": {
6
6
  "0": "Unknown or Missing",
7
7
  "1": "Education level"