@htilabs/platform-common-models 0.4.0-beta.1 → 0.5.1-beta.2
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.
- package/dist/constants/index.cjs +18 -9
- package/dist/constants/index.cjs.map +1 -1
- package/dist/constants/index.d.cts +1 -1
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +18 -9
- package/dist/constants/index.js.map +1 -1
- package/dist/cvcs/index.cjs +316 -1
- package/dist/cvcs/index.cjs.map +1 -1
- package/dist/cvcs/index.d.cts +368 -26
- package/dist/cvcs/index.d.ts +368 -26
- package/dist/cvcs/index.js +314 -1
- package/dist/cvcs/index.js.map +1 -1
- package/dist/index.cjs +373 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -5
- package/dist/index.d.ts +50 -5
- package/dist/index.js +369 -12
- package/dist/index.js.map +1 -1
- package/dist/models/index.cjs +2 -2
- package/dist/models/index.cjs.map +1 -1
- package/dist/models/index.js +2 -2
- package/dist/models/index.js.map +1 -1
- package/dist/{platform-auth-C-G2qeGM.d.cts → platform-auth-CjC57132.d.cts} +10 -7
- package/dist/{platform-auth-C-G2qeGM.d.ts → platform-auth-CjC57132.d.ts} +10 -7
- package/dist/schemas/index.cjs +16 -7
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.js +16 -7
- package/dist/schemas/index.js.map +1 -1
- package/dist/services/index.cjs +2 -2
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.js +2 -2
- package/dist/services/index.js.map +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/validation/index.cjs.map +1 -1
- package/dist/validation/index.d.cts +2 -2
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/__snapshots__/cvc-sot.snap +10 -2
- package/src/__tests__/cvc-sot-snapshot.test.ts +13 -1
- package/src/__tests__/cvc-structural.test.ts +1 -1
- package/src/constants/ic.ts +24 -14
- package/src/cvcs/incidentInvolvementRoles.v1.0.0.json +105 -0
- package/src/cvcs/incidentParticipationRoles.v1.0.0.json +202 -0
- package/src/cvcs/index.ts +4 -0
- package/src/cvcs/serviceStates.v1.0.0.json +1 -1
- package/src/generated/cvc-enums.ts +51 -2
- package/src/models/cvcEntryModel.ts +1 -1
- package/src/models/cvcRegistryModel.ts +1 -1
- package/src/validation/cvc.ts +6 -3
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
{
|
|
2
|
+
"domain": "incident_participation_roles",
|
|
3
|
+
"name": "Core Incident Participation Roles",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"levels": {
|
|
6
|
+
"0": "Unknown or Missing",
|
|
7
|
+
"1": "Group",
|
|
8
|
+
"2": "Role"
|
|
9
|
+
},
|
|
10
|
+
"entries": [
|
|
11
|
+
{
|
|
12
|
+
"code": "069-001-000-000-000-000-000",
|
|
13
|
+
"key": "client_group",
|
|
14
|
+
"title": "Client",
|
|
15
|
+
"selectable": false,
|
|
16
|
+
"parentCode": null,
|
|
17
|
+
"childCodes": [
|
|
18
|
+
"069-001-001-000-000-000-000"
|
|
19
|
+
],
|
|
20
|
+
"definition": "Group of participation roles identifying the person the incident record is about."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"code": "069-001-001-000-000-000-000",
|
|
24
|
+
"key": "client_subject",
|
|
25
|
+
"title": "Client (subject)",
|
|
26
|
+
"selectable": true,
|
|
27
|
+
"parentCode": "069-001-000-000-000-000-000",
|
|
28
|
+
"childCodes": [],
|
|
29
|
+
"definition": "The participant who is the subject of the incident record (the client for whom the episode is framed)."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"code": "069-002-000-000-000-000-000",
|
|
33
|
+
"key": "caller_reporter_group",
|
|
34
|
+
"title": "Caller / Reporter",
|
|
35
|
+
"selectable": false,
|
|
36
|
+
"parentCode": null,
|
|
37
|
+
"childCodes": [
|
|
38
|
+
"069-002-001-000-000-000-000",
|
|
39
|
+
"069-002-002-000-000-000-000",
|
|
40
|
+
"069-002-003-000-000-000-000"
|
|
41
|
+
],
|
|
42
|
+
"definition": "Group of participation roles identifying who contacted or reported the incident to the program."
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"code": "069-002-001-000-000-000-000",
|
|
46
|
+
"key": "caller_self",
|
|
47
|
+
"title": "Caller (self)",
|
|
48
|
+
"selectable": true,
|
|
49
|
+
"parentCode": "069-002-000-000-000-000-000",
|
|
50
|
+
"childCodes": [],
|
|
51
|
+
"definition": "Caller contacting the program on their own behalf."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"code": "069-002-002-000-000-000-000",
|
|
55
|
+
"key": "caller_third_party",
|
|
56
|
+
"title": "Caller (third party)",
|
|
57
|
+
"selectable": true,
|
|
58
|
+
"parentCode": "069-002-000-000-000-000-000",
|
|
59
|
+
"childCodes": [],
|
|
60
|
+
"definition": "Caller contacting the program on behalf of someone else."
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"code": "069-002-003-000-000-000-000",
|
|
64
|
+
"key": "reporter",
|
|
65
|
+
"title": "Reporter",
|
|
66
|
+
"selectable": true,
|
|
67
|
+
"parentCode": "069-002-000-000-000-000-000",
|
|
68
|
+
"childCodes": [],
|
|
69
|
+
"definition": "Participant who filed a formal report about the incident."
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"code": "069-003-000-000-000-000-000",
|
|
73
|
+
"key": "support_network_group",
|
|
74
|
+
"title": "Support network",
|
|
75
|
+
"selectable": false,
|
|
76
|
+
"parentCode": null,
|
|
77
|
+
"childCodes": [
|
|
78
|
+
"069-003-001-000-000-000-000",
|
|
79
|
+
"069-003-002-000-000-000-000"
|
|
80
|
+
],
|
|
81
|
+
"definition": "Group of participation roles identifying people from the client's personal support network."
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"code": "069-003-001-000-000-000-000",
|
|
85
|
+
"key": "family_member_or_guardian",
|
|
86
|
+
"title": "Family member or guardian",
|
|
87
|
+
"selectable": true,
|
|
88
|
+
"parentCode": "069-003-000-000-000-000-000",
|
|
89
|
+
"childCodes": [],
|
|
90
|
+
"definition": "Family member or legal guardian of the client."
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"code": "069-003-002-000-000-000-000",
|
|
94
|
+
"key": "friend_or_peer",
|
|
95
|
+
"title": "Friend or peer",
|
|
96
|
+
"selectable": true,
|
|
97
|
+
"parentCode": "069-003-000-000-000-000-000",
|
|
98
|
+
"childCodes": [],
|
|
99
|
+
"definition": "Friend or peer in the client's support network."
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"code": "069-004-000-000-000-000-000",
|
|
103
|
+
"key": "system_professional_group",
|
|
104
|
+
"title": "System / professional participants",
|
|
105
|
+
"selectable": false,
|
|
106
|
+
"parentCode": null,
|
|
107
|
+
"childCodes": [
|
|
108
|
+
"069-004-001-000-000-000-000",
|
|
109
|
+
"069-004-002-000-000-000-000",
|
|
110
|
+
"069-004-003-000-000-000-000",
|
|
111
|
+
"069-004-004-000-000-000-000",
|
|
112
|
+
"069-004-005-000-000-000-000"
|
|
113
|
+
],
|
|
114
|
+
"definition": "Group of participation roles identifying system-side professionals involved in the incident."
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"code": "069-004-001-000-000-000-000",
|
|
118
|
+
"key": "service_provider_staff",
|
|
119
|
+
"title": "Service provider staff",
|
|
120
|
+
"selectable": true,
|
|
121
|
+
"parentCode": "069-004-000-000-000-000-000",
|
|
122
|
+
"childCodes": [],
|
|
123
|
+
"definition": "Staff of a service provider program or agency involved in the incident."
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"code": "069-004-002-000-000-000-000",
|
|
127
|
+
"key": "medical_provider_staff",
|
|
128
|
+
"title": "Medical provider staff",
|
|
129
|
+
"selectable": true,
|
|
130
|
+
"parentCode": "069-004-000-000-000-000-000",
|
|
131
|
+
"childCodes": [],
|
|
132
|
+
"definition": "Staff of a medical provider (hospital, clinic) involved in the incident."
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"code": "069-004-003-000-000-000-000",
|
|
136
|
+
"key": "data_entry",
|
|
137
|
+
"title": "Data Entry / Editor",
|
|
138
|
+
"selectable": true,
|
|
139
|
+
"parentCode": "069-004-000-000-000-000-000",
|
|
140
|
+
"childCodes": [],
|
|
141
|
+
"definition": "A participant performing data entry or record editing for the incident — typically program staff entering or updating the record rather than participating substantively in the incident response."
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"code": "069-004-004-000-000-000-000",
|
|
145
|
+
"key": "other_incident_responder",
|
|
146
|
+
"title": "VSP or Other Incident Responder",
|
|
147
|
+
"selectable": true,
|
|
148
|
+
"parentCode": "069-004-000-000-000-000-000",
|
|
149
|
+
"childCodes": [],
|
|
150
|
+
"definition": "A participant acting as a Victim Service Provider (VSP) or other non-law-enforcement responder present at the incident (e.g., crisis advocate on scene)."
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"code": "069-004-005-000-000-000-000",
|
|
154
|
+
"key": "responding_officer",
|
|
155
|
+
"title": "LE Responding Officer",
|
|
156
|
+
"selectable": true,
|
|
157
|
+
"parentCode": "069-004-000-000-000-000-000",
|
|
158
|
+
"childCodes": [],
|
|
159
|
+
"definition": "A participant acting as a law-enforcement responding officer on the incident (patrol officer, detective, or equivalent sworn personnel)."
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"code": "069-000-000-000-000-000-000",
|
|
163
|
+
"key": "missingness_root",
|
|
164
|
+
"title": "Unknown, Redacted, or Missing",
|
|
165
|
+
"selectable": false,
|
|
166
|
+
"parentCode": null,
|
|
167
|
+
"childCodes": [
|
|
168
|
+
"069-000-000-000-000-000-001",
|
|
169
|
+
"069-000-000-000-000-000-002",
|
|
170
|
+
"069-000-000-000-000-000-003"
|
|
171
|
+
],
|
|
172
|
+
"definition": "Root group for values indicating absent, withheld, or uncollected data."
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"code": "069-000-000-000-000-000-001",
|
|
176
|
+
"key": "unknown",
|
|
177
|
+
"title": "Unknown",
|
|
178
|
+
"selectable": true,
|
|
179
|
+
"parentCode": "069-000-000-000-000-000-000",
|
|
180
|
+
"childCodes": [],
|
|
181
|
+
"definition": "Value is unknown at time of entry."
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"code": "069-000-000-000-000-000-002",
|
|
185
|
+
"key": "anonymous",
|
|
186
|
+
"title": "Anonymous",
|
|
187
|
+
"selectable": true,
|
|
188
|
+
"parentCode": "069-000-000-000-000-000-000",
|
|
189
|
+
"childCodes": [],
|
|
190
|
+
"definition": "Value is intentionally withheld or redacted."
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"code": "069-000-000-000-000-000-003",
|
|
194
|
+
"key": "data_not_collected",
|
|
195
|
+
"title": "Data not collected",
|
|
196
|
+
"selectable": true,
|
|
197
|
+
"parentCode": "069-000-000-000-000-000-000",
|
|
198
|
+
"childCodes": [],
|
|
199
|
+
"definition": "No attempt was made to collect the value."
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
}
|
package/src/cvcs/index.ts
CHANGED
|
@@ -22,9 +22,13 @@
|
|
|
22
22
|
import serviceCategoriesSot from "./serviceCategories.v1.0.0.json" with { type: "json" };
|
|
23
23
|
import serviceStatesSot from "./serviceStates.v1.0.0.json" with { type: "json" };
|
|
24
24
|
import serviceMechanismsSot from "./serviceMechanisms.v1.0.0.json" with { type: "json" };
|
|
25
|
+
import incidentParticipationRolesSot from "./incidentParticipationRoles.v1.0.0.json" with { type: "json" };
|
|
26
|
+
import incidentInvolvementRolesSot from "./incidentInvolvementRoles.v1.0.0.json" with { type: "json" };
|
|
25
27
|
|
|
26
28
|
export {
|
|
27
29
|
serviceCategoriesSot,
|
|
28
30
|
serviceStatesSot,
|
|
29
31
|
serviceMechanismsSot,
|
|
32
|
+
incidentParticipationRolesSot,
|
|
33
|
+
incidentInvolvementRolesSot,
|
|
30
34
|
};
|
|
@@ -171,9 +171,9 @@ export const ServiceCategoryKeys = {
|
|
|
171
171
|
export type ServiceCategoryKey = keyof typeof ServiceCategoryKeys;
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
|
-
* Key → positional code map for the `
|
|
174
|
+
* Key → positional code map for the `service_states` CVC domain.
|
|
175
175
|
*
|
|
176
|
-
* Domain: `
|
|
176
|
+
* Domain: `service_states` · Version: 1.0.0 · Entries: 14
|
|
177
177
|
*/
|
|
178
178
|
export const ServiceStateKeys = {
|
|
179
179
|
missingness_root: "049-000-000-000-000-000-000",
|
|
@@ -211,3 +211,52 @@ export const ServiceMechanismKeys = {
|
|
|
211
211
|
} as const;
|
|
212
212
|
|
|
213
213
|
export type ServiceMechanismKey = keyof typeof ServiceMechanismKeys;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Key → positional code map for the `incident_participation_roles` CVC domain.
|
|
217
|
+
*
|
|
218
|
+
* Domain: `incident_participation_roles` · Version: 1.0.0 · Entries: 19
|
|
219
|
+
*/
|
|
220
|
+
export const IncidentParticipationRoleKeys = {
|
|
221
|
+
missingness_root: "069-000-000-000-000-000-000",
|
|
222
|
+
unknown: "069-000-000-000-000-000-001",
|
|
223
|
+
anonymous: "069-000-000-000-000-000-002",
|
|
224
|
+
data_not_collected: "069-000-000-000-000-000-003",
|
|
225
|
+
client_group: "069-001-000-000-000-000-000",
|
|
226
|
+
client_subject: "069-001-001-000-000-000-000",
|
|
227
|
+
caller_reporter_group: "069-002-000-000-000-000-000",
|
|
228
|
+
caller_self: "069-002-001-000-000-000-000",
|
|
229
|
+
caller_third_party: "069-002-002-000-000-000-000",
|
|
230
|
+
reporter: "069-002-003-000-000-000-000",
|
|
231
|
+
support_network_group: "069-003-000-000-000-000-000",
|
|
232
|
+
family_member_or_guardian: "069-003-001-000-000-000-000",
|
|
233
|
+
friend_or_peer: "069-003-002-000-000-000-000",
|
|
234
|
+
system_professional_group: "069-004-000-000-000-000-000",
|
|
235
|
+
service_provider_staff: "069-004-001-000-000-000-000",
|
|
236
|
+
medical_provider_staff: "069-004-002-000-000-000-000",
|
|
237
|
+
data_entry: "069-004-003-000-000-000-000",
|
|
238
|
+
other_incident_responder: "069-004-004-000-000-000-000",
|
|
239
|
+
responding_officer: "069-004-005-000-000-000-000",
|
|
240
|
+
} as const;
|
|
241
|
+
|
|
242
|
+
export type IncidentParticipationRoleKey = keyof typeof IncidentParticipationRoleKeys;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Key → positional code map for the `incident_involvement_roles` CVC domain.
|
|
246
|
+
*
|
|
247
|
+
* Domain: `incident_involvement_roles` · Version: 1.0.0 · Entries: 10
|
|
248
|
+
*/
|
|
249
|
+
export const IncidentInvolvementRoleKeys = {
|
|
250
|
+
missingness_root: "130-000-000-000-000-000-000",
|
|
251
|
+
unknown: "130-000-000-000-000-000-001",
|
|
252
|
+
anonymous: "130-000-000-000-000-000-002",
|
|
253
|
+
data_not_collected: "130-000-000-000-000-000-003",
|
|
254
|
+
victim_primary: "130-001-000-000-000-000-000",
|
|
255
|
+
victim_secondary: "130-002-000-000-000-000-000",
|
|
256
|
+
victim_other: "130-003-000-000-000-000-000",
|
|
257
|
+
offender: "130-004-000-000-000-000-000",
|
|
258
|
+
witness: "130-005-000-000-000-000-000",
|
|
259
|
+
dependent: "130-006-000-000-000-000-000",
|
|
260
|
+
} as const;
|
|
261
|
+
|
|
262
|
+
export type IncidentInvolvementRoleKey = keyof typeof IncidentInvolvementRoleKeys;
|
|
@@ -27,6 +27,6 @@ export function compileModel(
|
|
|
27
27
|
connection: Connection,
|
|
28
28
|
schema = buildCvcEntrySchema(),
|
|
29
29
|
): Model<CvcEntry> {
|
|
30
|
-
return connection.models
|
|
30
|
+
return connection.models?.CvcEntry as Model<CvcEntry>
|
|
31
31
|
?? connection.model<CvcEntry>("CvcEntry", schema);
|
|
32
32
|
}
|
|
@@ -30,6 +30,6 @@ export function compileModel(
|
|
|
30
30
|
connection: Connection,
|
|
31
31
|
schema = buildCvcRegistrySchema(),
|
|
32
32
|
): Model<CvcRegistry> {
|
|
33
|
-
return connection.models
|
|
33
|
+
return connection.models?.CvcRegistry as Model<CvcRegistry>
|
|
34
34
|
?? connection.model<CvcRegistry>("CvcRegistry", schema);
|
|
35
35
|
}
|
package/src/validation/cvc.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* segment). Segment 1 is the Notion-aligned domain prefix:
|
|
18
18
|
* `022` service_categories (CVC-22)
|
|
19
19
|
* `025` service_mechanisms (CVC-25)
|
|
20
|
-
* `049`
|
|
20
|
+
* `049` service_states (CVC-49)
|
|
21
21
|
* - Missingness entries are embedded per-domain (synthetic `missingness_root`
|
|
22
22
|
* at `<prefix>-000-000-000-000-000-000` plus three values at segment 7 =
|
|
23
23
|
* `001`/`002`/`003`). The shared `missingness.v1.0.0.json` file was
|
|
@@ -107,7 +107,7 @@ export type ServiceCategoryEntry = z.infer<typeof ServiceCategoryEntrySchema>;
|
|
|
107
107
|
export type CvcEnvelope = z.infer<typeof CvcEnvelopeSchema>;
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
|
-
* SOT family identifier (e.g. `"service_categories"`, `"
|
|
110
|
+
* SOT family identifier (e.g. `"service_categories"`, `"service_states"`,
|
|
111
111
|
* `"service_mechanisms"`, `"missingness"`). The canonical list of domains is
|
|
112
112
|
* enumerated by the SOT JSON files in `src/cvcs/`. Typed as `string` rather
|
|
113
113
|
* than a closed union so adding a new SOT file does not require touching this
|
|
@@ -344,7 +344,10 @@ export function validateCvc(
|
|
|
344
344
|
continue;
|
|
345
345
|
}
|
|
346
346
|
for (const mechKey of raw) {
|
|
347
|
-
if (
|
|
347
|
+
if (
|
|
348
|
+
typeof mechKey !== "string" ||
|
|
349
|
+
!options.mechanismKeys.has(mechKey)
|
|
350
|
+
) {
|
|
348
351
|
errors.push({
|
|
349
352
|
invariant: "C6",
|
|
350
353
|
message: `relevantMechanisms references unknown service_mechanisms key: ${String(mechKey)}`,
|