@htilabs/platform-common-models 0.8.8 → 0.8.10
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/config/index.cjs +191 -0
- package/dist/config/index.cjs.map +1 -0
- package/dist/config/index.d.cts +101 -0
- package/dist/config/index.d.ts +101 -0
- package/dist/config/index.js +165 -0
- package/dist/config/index.js.map +1 -0
- package/dist/{cvcEntry-DaDrEuTa.d.cts → cvcEntry-BCj1OWqL.d.cts} +36 -36
- package/dist/{cvcEntry-DaDrEuTa.d.ts → cvcEntry-BCj1OWqL.d.ts} +36 -36
- package/dist/cvcs/index.cjs +7253 -6350
- package/dist/cvcs/index.cjs.map +1 -1
- package/dist/cvcs/index.d.cts +4459 -3451
- package/dist/cvcs/index.d.ts +4459 -3451
- package/dist/cvcs/index.js +7246 -6350
- package/dist/cvcs/index.js.map +1 -1
- package/dist/{index-EPjPjR0z.d.cts → index-CoVr1jIV.d.cts} +1 -1
- package/dist/{index-C0J3f169.d.ts → index-I-DiX9eQ.d.ts} +1 -1
- package/dist/index.cjs +3218 -2201
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +290 -148
- package/dist/index.d.ts +290 -148
- package/dist/index.js +7433 -6430
- package/dist/index.js.map +1 -1
- package/dist/models/index.d.cts +2 -2
- package/dist/models/index.d.ts +2 -2
- package/dist/schemas/index.d.cts +11 -11
- package/dist/schemas/index.d.ts +11 -11
- package/package.json +7 -1
- package/src/__tests__/__snapshots__/cvc-sot.snap +31 -3
- package/src/__tests__/cvc-sot-snapshot.test.ts +10 -2
- package/src/__tests__/cvc-structural.test.ts +2 -2
- package/src/__tests__/runtime-contract-validator.test.ts +556 -0
- package/src/config/fixtures/valid.yaml +90 -0
- package/src/config/index.ts +352 -0
- package/src/cvcs/assertionDomain.v1.0.0.json +18 -0
- package/src/cvcs/childChangeType.v1.0.0.json +152 -0
- package/src/cvcs/hivStatus.v1.0.0.json +71 -0
- package/src/cvcs/immigrationLegalStatusChangeType.v1.0.0.json +143 -0
- package/src/cvcs/index.ts +15 -1
- package/src/cvcs/mentalHealthStatus.v1.0.0.json +71 -0
- package/src/cvcs/programEnrollmentChangeType.v1.0.0.json +134 -0
- package/src/cvcs/romanticRelationshipChangeType.v1.0.0.json +161 -0
- package/src/cvcs/{serviceCategories.v1.1.0.json → serviceCategories.v1.0.0.json} +1091 -1091
- package/src/cvcs/specialNeedsDisabilities.v1.0.0.json +143 -0
- package/src/generated/cvc-enums.ts +300 -144
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @htilabs/platform-common-models — Runtime Config Contract Validator
|
|
3
|
+
*
|
|
4
|
+
* Implements contract R12.1 (platform-common home):
|
|
5
|
+
* - validateAgainstContract(runtimeYamlPath, opts?) — startup validator (R3.2)
|
|
6
|
+
* - createConfigEndpoint(runtimeYamlPath, opts?) — /api/config factory (R7)
|
|
7
|
+
*
|
|
8
|
+
* Consumers MUST call validateAgainstContract once at process startup, before
|
|
9
|
+
* any other initialization that reads env vars. Build-phase variables
|
|
10
|
+
* (phase: build) are NOT checked at runtime per R3.4.
|
|
11
|
+
*
|
|
12
|
+
* No secret VALUES are read, stored, or returned here. Secret env vars are
|
|
13
|
+
* validated for presence but their values are never logged or exposed.
|
|
14
|
+
*
|
|
15
|
+
* Dual ESM + CJS via tsup. Plain JS consumers (pave, leads) use require():
|
|
16
|
+
* const { validateAgainstContract } = require('@htilabs/platform-common-models/config');
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { readFileSync } from "node:fs";
|
|
20
|
+
import { parse } from "yaml";
|
|
21
|
+
|
|
22
|
+
// ─── Schema types (mirrors thread's runtime-config-lib.ts VariableSpec) ──────
|
|
23
|
+
|
|
24
|
+
export interface VariableSpec {
|
|
25
|
+
type: "string" | "boolean" | "number" | "enum" | "url" | "json";
|
|
26
|
+
required: boolean;
|
|
27
|
+
secret: boolean;
|
|
28
|
+
description: string;
|
|
29
|
+
phase?: "runtime" | "build";
|
|
30
|
+
values?: string[];
|
|
31
|
+
default?: Record<string, unknown>;
|
|
32
|
+
provider?: string;
|
|
33
|
+
name?: string;
|
|
34
|
+
client_visible?: boolean;
|
|
35
|
+
deprecated?: { since: string; remove_after?: string; replacement?: string };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ServiceContract {
|
|
39
|
+
service: string;
|
|
40
|
+
version: number;
|
|
41
|
+
environments: string[];
|
|
42
|
+
// Thread extensions (tolerated, not required — R1.1 note)
|
|
43
|
+
port?: number;
|
|
44
|
+
build_secrets?: string[];
|
|
45
|
+
variables: Record<string, VariableSpec>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Typed config accessor returned by validateAgainstContract. */
|
|
49
|
+
export type TypedConfig = Record<string, string | boolean | number | unknown>;
|
|
50
|
+
|
|
51
|
+
export interface ValidateOptions {
|
|
52
|
+
/**
|
|
53
|
+
* Environment name used to select per-env defaults (e.g. "local", "test").
|
|
54
|
+
* Defaults to process.env.NODE_ENV, then "local".
|
|
55
|
+
*/
|
|
56
|
+
env?: string;
|
|
57
|
+
/**
|
|
58
|
+
* If true, do not call process.exit(1) on failure; throw instead.
|
|
59
|
+
* Useful for tests. Defaults to false (production mode exits).
|
|
60
|
+
*/
|
|
61
|
+
throwOnFailure?: boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface EndpointOptions {
|
|
65
|
+
/** Cache-Control header value. Defaults to "private, no-store". */
|
|
66
|
+
cacheControl?: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A framework-agnostic route handler that returns a JSON response.
|
|
71
|
+
* Compatible with:
|
|
72
|
+
* - Next.js App Router: export const GET = createConfigEndpoint(...)
|
|
73
|
+
* - Fastify: instance.get('/api/config', createConfigEndpoint(...))
|
|
74
|
+
* - Express: app.get('/api/config', createConfigEndpoint(...))
|
|
75
|
+
*/
|
|
76
|
+
export type RouteHandler = (
|
|
77
|
+
req?: unknown,
|
|
78
|
+
res?: unknown,
|
|
79
|
+
) => Promise<Response | void> | Response | void;
|
|
80
|
+
|
|
81
|
+
// ─── YAML parser ──────────────────────────────────────────────────────────────
|
|
82
|
+
|
|
83
|
+
function loadContract(runtimeYamlPath: string): ServiceContract {
|
|
84
|
+
let raw: string;
|
|
85
|
+
try {
|
|
86
|
+
raw = readFileSync(runtimeYamlPath, "utf8");
|
|
87
|
+
} catch (err) {
|
|
88
|
+
const msg =
|
|
89
|
+
err instanceof Error ? err.message : String(err);
|
|
90
|
+
throw new Error(
|
|
91
|
+
`[platform-common/config] Cannot read ${runtimeYamlPath}: ${msg}`,
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
const parsed = parse(raw) as ServiceContract | null;
|
|
95
|
+
if (!parsed || typeof parsed !== "object") {
|
|
96
|
+
throw new Error(
|
|
97
|
+
`[platform-common/config] ${runtimeYamlPath}: not a YAML mapping`,
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
if (parsed.version !== 1) {
|
|
101
|
+
throw new Error(
|
|
102
|
+
`[platform-common/config] ${runtimeYamlPath}: unsupported contract version ${parsed.version} (expected 1)`,
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
if (!parsed.variables || typeof parsed.variables !== "object") {
|
|
106
|
+
throw new Error(
|
|
107
|
+
`[platform-common/config] ${runtimeYamlPath}: missing "variables" map`,
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
return parsed;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ─── Coercion ────────────────────────────────────────────────────────────────
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Coerce a raw environment string value to the declared type.
|
|
117
|
+
* Returns [ok, coerced] or [false, errorMessage].
|
|
118
|
+
*/
|
|
119
|
+
function coerce(
|
|
120
|
+
key: string,
|
|
121
|
+
raw: string,
|
|
122
|
+
spec: VariableSpec,
|
|
123
|
+
): [true, unknown] | [false, string] {
|
|
124
|
+
switch (spec.type) {
|
|
125
|
+
case "boolean": {
|
|
126
|
+
if (raw === "true" || raw === "1") return [true, true];
|
|
127
|
+
if (raw === "false" || raw === "0") return [true, false];
|
|
128
|
+
return [false, `${key}: expected boolean ("true"/"false"/"1"/"0"), got "${raw}"`];
|
|
129
|
+
}
|
|
130
|
+
case "number": {
|
|
131
|
+
const n = Number(raw);
|
|
132
|
+
if (!Number.isFinite(n)) {
|
|
133
|
+
return [false, `${key}: expected number, got "${raw}"`];
|
|
134
|
+
}
|
|
135
|
+
return [true, n];
|
|
136
|
+
}
|
|
137
|
+
case "enum": {
|
|
138
|
+
const vals = spec.values ?? [];
|
|
139
|
+
if (!vals.includes(raw)) {
|
|
140
|
+
return [false, `${key}: expected one of [${vals.join(", ")}], got "${raw}"`];
|
|
141
|
+
}
|
|
142
|
+
return [true, raw];
|
|
143
|
+
}
|
|
144
|
+
case "url": {
|
|
145
|
+
try {
|
|
146
|
+
new URL(raw);
|
|
147
|
+
return [true, raw];
|
|
148
|
+
} catch {
|
|
149
|
+
return [false, `${key}: expected a valid URL, got "${raw}"`];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
case "json": {
|
|
153
|
+
try {
|
|
154
|
+
const parsed = JSON.parse(raw) as unknown;
|
|
155
|
+
return [true, parsed];
|
|
156
|
+
} catch {
|
|
157
|
+
return [false, `${key}: expected valid JSON, got "${raw}"`];
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
default:
|
|
161
|
+
// string
|
|
162
|
+
return [true, raw];
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// ─── Default application ─────────────────────────────────────────────────────
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Returns the default value for a variable in the given environment,
|
|
170
|
+
* or undefined if no default applies.
|
|
171
|
+
*
|
|
172
|
+
* Exact env match only — defaults are per-environment and MUST NOT bleed
|
|
173
|
+
* across envs. (A local default stays local; it does not fall back into prod.)
|
|
174
|
+
*/
|
|
175
|
+
function resolveDefault(
|
|
176
|
+
spec: VariableSpec,
|
|
177
|
+
env: string,
|
|
178
|
+
): string | undefined {
|
|
179
|
+
if (!spec.default) return undefined;
|
|
180
|
+
const v = spec.default[env];
|
|
181
|
+
if (v === undefined) return undefined;
|
|
182
|
+
return String(v);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ─── validateAgainstContract ─────────────────────────────────────────────────
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Parse `runtimeYamlPath`, coerce every runtime-phase variable from
|
|
189
|
+
* `process.env` (with per-env defaults applied), and fail fast on any
|
|
190
|
+
* missing or invalid required variable (R3.2).
|
|
191
|
+
*
|
|
192
|
+
* Build-phase variables (phase: build) are skipped per R3.4.
|
|
193
|
+
*
|
|
194
|
+
* Returns a typed config object keyed by variable name.
|
|
195
|
+
*/
|
|
196
|
+
export function validateAgainstContract(
|
|
197
|
+
runtimeYamlPath: string,
|
|
198
|
+
opts: ValidateOptions = {},
|
|
199
|
+
): TypedConfig {
|
|
200
|
+
const contract = loadContract(runtimeYamlPath);
|
|
201
|
+
const env =
|
|
202
|
+
opts.env ??
|
|
203
|
+
(process.env.NODE_ENV as string | undefined) ??
|
|
204
|
+
"local";
|
|
205
|
+
|
|
206
|
+
const errors: string[] = [];
|
|
207
|
+
const result: TypedConfig = {};
|
|
208
|
+
|
|
209
|
+
for (const [key, spec] of Object.entries(contract.variables)) {
|
|
210
|
+
// R3.4: skip build-phase variables entirely at runtime.
|
|
211
|
+
if (spec.phase === "build") continue;
|
|
212
|
+
|
|
213
|
+
const rawFromEnv = process.env[key];
|
|
214
|
+
const defaultValue = resolveDefault(spec, env);
|
|
215
|
+
const effective = rawFromEnv ?? defaultValue;
|
|
216
|
+
|
|
217
|
+
if (effective === undefined || effective === "") {
|
|
218
|
+
if (spec.required) {
|
|
219
|
+
errors.push(
|
|
220
|
+
`${key}: required but not set (no value in process.env and no default for env "${env}")`,
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
// Not required and not set — omit from result.
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const [ok, coerced] = coerce(key, effective, spec);
|
|
228
|
+
if (!ok) {
|
|
229
|
+
errors.push(coerced as string);
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
result[key] = coerced;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (errors.length > 0) {
|
|
236
|
+
const message = [
|
|
237
|
+
`[platform-common/config] validateAgainstContract failed for ${runtimeYamlPath}`,
|
|
238
|
+
`${errors.length} variable(s) missing or invalid:`,
|
|
239
|
+
...errors.map((e) => ` - ${e}`),
|
|
240
|
+
].join("\n");
|
|
241
|
+
|
|
242
|
+
if (opts.throwOnFailure) {
|
|
243
|
+
throw new Error(message);
|
|
244
|
+
}
|
|
245
|
+
console.error(message);
|
|
246
|
+
process.exit(1);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return result;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// ─── createConfigEndpoint ────────────────────────────────────────────────────
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Build a static JSON payload containing only variables that are
|
|
256
|
+
* client_visible: true AND secret: false (R7.2, R7.3). Reads process.env
|
|
257
|
+
* once at factory call time.
|
|
258
|
+
*/
|
|
259
|
+
function buildClientPayload(
|
|
260
|
+
contract: ServiceContract,
|
|
261
|
+
env: string,
|
|
262
|
+
): Record<string, unknown> {
|
|
263
|
+
const payload: Record<string, unknown> = {};
|
|
264
|
+
|
|
265
|
+
for (const [key, spec] of Object.entries(contract.variables)) {
|
|
266
|
+
// R7.3: never expose secrets.
|
|
267
|
+
if (spec.secret) continue;
|
|
268
|
+
// R7.2: only expose client_visible vars.
|
|
269
|
+
if (!spec.client_visible) continue;
|
|
270
|
+
// R3.4: build-phase vars are not available at runtime.
|
|
271
|
+
if (spec.phase === "build") continue;
|
|
272
|
+
|
|
273
|
+
const raw = process.env[key] ?? resolveDefault(spec, env);
|
|
274
|
+
if (raw === undefined) continue;
|
|
275
|
+
|
|
276
|
+
const [ok, coerced] = coerce(key, raw, spec);
|
|
277
|
+
payload[key] = ok ? coerced : raw;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return payload;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Route-handler factory for GET /api/config (R7.1).
|
|
285
|
+
*
|
|
286
|
+
* Reads the contract and process.env once at factory-call time and caches
|
|
287
|
+
* the JSON payload. The returned handler is compatible with:
|
|
288
|
+
*
|
|
289
|
+
* Next.js App Router:
|
|
290
|
+
* export const GET = createConfigEndpoint(path);
|
|
291
|
+
*
|
|
292
|
+
* Fastify:
|
|
293
|
+
* instance.get('/api/config', createConfigEndpoint(path));
|
|
294
|
+
*
|
|
295
|
+
* Express:
|
|
296
|
+
* app.get('/api/config', createConfigEndpoint(path));
|
|
297
|
+
*
|
|
298
|
+
* The handler detects the calling convention at runtime:
|
|
299
|
+
* - Next.js / fetch-native: called with no arguments; returns a Response.
|
|
300
|
+
* - Express: called with (req, res); calls res.json() and returns void.
|
|
301
|
+
* - Fastify: called with (req, reply); calls reply.send() and returns void.
|
|
302
|
+
*/
|
|
303
|
+
export function createConfigEndpoint(
|
|
304
|
+
runtimeYamlPath: string,
|
|
305
|
+
opts: EndpointOptions = {},
|
|
306
|
+
): RouteHandler {
|
|
307
|
+
const contract = loadContract(runtimeYamlPath);
|
|
308
|
+
const env =
|
|
309
|
+
(process.env.NODE_ENV as string | undefined) ?? "local";
|
|
310
|
+
const payload = buildClientPayload(contract, env);
|
|
311
|
+
const cacheControl = opts.cacheControl ?? "private, no-store";
|
|
312
|
+
const body = JSON.stringify(payload);
|
|
313
|
+
|
|
314
|
+
return function configHandler(
|
|
315
|
+
_req?: unknown,
|
|
316
|
+
res?: unknown,
|
|
317
|
+
): Promise<Response | void> | Response | void {
|
|
318
|
+
// Express-shaped: res has .json()
|
|
319
|
+
if (res && typeof (res as Record<string, unknown>)["json"] === "function") {
|
|
320
|
+
const r = res as {
|
|
321
|
+
setHeader: (k: string, v: string) => void;
|
|
322
|
+
json: (data: unknown) => void;
|
|
323
|
+
};
|
|
324
|
+
r.setHeader("Cache-Control", cacheControl);
|
|
325
|
+
r.setHeader("Content-Type", "application/json");
|
|
326
|
+
r.json(payload);
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Fastify-shaped: res has .send()
|
|
331
|
+
if (res && typeof (res as Record<string, unknown>)["send"] === "function") {
|
|
332
|
+
const r = res as {
|
|
333
|
+
header: (k: string, v: string) => void;
|
|
334
|
+
type: (ct: string) => void;
|
|
335
|
+
send: (data: string) => void;
|
|
336
|
+
};
|
|
337
|
+
r.header("Cache-Control", cacheControl);
|
|
338
|
+
r.type("application/json");
|
|
339
|
+
r.send(body);
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// Next.js / fetch-native (no res argument, or unrecognised res)
|
|
344
|
+
return new Response(body, {
|
|
345
|
+
status: 200,
|
|
346
|
+
headers: {
|
|
347
|
+
"Content-Type": "application/json",
|
|
348
|
+
"Cache-Control": cacheControl,
|
|
349
|
+
},
|
|
350
|
+
});
|
|
351
|
+
};
|
|
352
|
+
}
|
|
@@ -624,6 +624,24 @@
|
|
|
624
624
|
"parentCode": null,
|
|
625
625
|
"childCodes": [],
|
|
626
626
|
"definition": "Assertion domain 'facilitator_entity_type' — the subject/section a CAR asserts against."
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
"code": "964-065-000-000-000-000-000",
|
|
630
|
+
"key": "child_profile",
|
|
631
|
+
"title": "Child profile",
|
|
632
|
+
"selectable": true,
|
|
633
|
+
"parentCode": null,
|
|
634
|
+
"childCodes": [],
|
|
635
|
+
"definition": "assertion_domain partition for CARs on a Child profile subject-record entity (Add Child / Edit Child; core_child_change_type verbs). DRAFT-TEMPORARY direct import from prototype, pending Notion ratification."
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
"code": "964-066-000-000-000-000-000",
|
|
639
|
+
"key": "romantic_relationship",
|
|
640
|
+
"title": "Romantic relationship",
|
|
641
|
+
"selectable": true,
|
|
642
|
+
"parentCode": null,
|
|
643
|
+
"childCodes": [],
|
|
644
|
+
"definition": "assertion_domain partition for CARs on Romantic Relationships (marital status, relationship status, romantic partners; core_romantic_relationship_change_type verbs). DISTINCT from household_relationships (HoH tenure). DRAFT-TEMPORARY direct import from prototype, pending Notion ratification. Resolves the romantic-domain 'new domain vs split' question as a net-new domain, subject to steward ratification."
|
|
627
645
|
}
|
|
628
646
|
]
|
|
629
647
|
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
{
|
|
2
|
+
"domain": "child_change_type",
|
|
3
|
+
"name": "Child Change Type",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"_status": "DRAFT — TEMPORARY: net-new value-CVC not yet in Notion; provisional 900+ numbering; codes from prototype/data/cvcs/core_child_change_type.yaml; PENDING canonical Notion authoring (PAVE Auditability backlog). Lifecycle + sub-block change-event verbs (CHILD_* CARs) emitted by the Add/Edit Child openers and child-profile sub-blocks; routes to StatusLog under assertion_domain child_profile.",
|
|
6
|
+
"_source": "prototype/data/cvcs/core_child_change_type.yaml",
|
|
7
|
+
"levels": {
|
|
8
|
+
"0": "Unknown or Missing",
|
|
9
|
+
"1": "Child profile change event (CAR verb)"
|
|
10
|
+
},
|
|
11
|
+
"entries": [
|
|
12
|
+
{
|
|
13
|
+
"code": "976-000-000-000-000-000-000",
|
|
14
|
+
"key": "missingness_root",
|
|
15
|
+
"title": "Unknown, Redacted, or Missing",
|
|
16
|
+
"selectable": false,
|
|
17
|
+
"parentCode": null,
|
|
18
|
+
"childCodes": [
|
|
19
|
+
"976-000-000-000-000-000-001",
|
|
20
|
+
"976-000-000-000-000-000-002",
|
|
21
|
+
"976-000-000-000-000-000-003"
|
|
22
|
+
],
|
|
23
|
+
"definition": "Root group for values indicating absent, withheld, or uncollected data. Variant: 3-value (unknown, anonymous, data_not_collected). The prototype YAML enumerates only the substantive level-1 CHILD_* change verbs, so the triplet is added per SOT convention."
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"code": "976-000-000-000-000-000-001",
|
|
27
|
+
"key": "unknown",
|
|
28
|
+
"title": "Unknown",
|
|
29
|
+
"selectable": true,
|
|
30
|
+
"parentCode": "976-000-000-000-000-000-000",
|
|
31
|
+
"childCodes": [],
|
|
32
|
+
"definition": "Change-event type is unknown at time of entry (missingness sentinel)."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"code": "976-000-000-000-000-000-002",
|
|
36
|
+
"key": "anonymous",
|
|
37
|
+
"title": "Anonymous / declined to answer",
|
|
38
|
+
"selectable": true,
|
|
39
|
+
"parentCode": "976-000-000-000-000-000-000",
|
|
40
|
+
"childCodes": [],
|
|
41
|
+
"definition": "Value is intentionally withheld or redacted. Combines declined-to-answer and redacted/anonymous semantics under the workspace standard ANON sentinel."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"code": "976-000-000-000-000-000-003",
|
|
45
|
+
"key": "data_not_collected",
|
|
46
|
+
"title": "Data not collected",
|
|
47
|
+
"selectable": true,
|
|
48
|
+
"parentCode": "976-000-000-000-000-000-000",
|
|
49
|
+
"childCodes": [],
|
|
50
|
+
"definition": "No attempt was made to collect the value. System-only sentinel per GLOBAL_DESIGN_RULES."
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"code": "976-001-000-000-000-000-000",
|
|
54
|
+
"key": "child_added",
|
|
55
|
+
"title": "Child added",
|
|
56
|
+
"selectable": true,
|
|
57
|
+
"parentCode": null,
|
|
58
|
+
"childCodes": [],
|
|
59
|
+
"definition": "Fires once per Add Child save when a new HTI_CHILD_PROFILES[] row is created. Carries { subject_id, child_person_id, child_profile_id, relationship_type_code (locked to parent_child / child_of) }. Pairs with separate value-level CARs for sub-block fields populated in the same save. (YAML code CHILD_ADDED.)"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"code": "976-002-000-000-000-000-000",
|
|
63
|
+
"key": "child_updated",
|
|
64
|
+
"title": "Child profile updated",
|
|
65
|
+
"selectable": true,
|
|
66
|
+
"parentCode": null,
|
|
67
|
+
"childCodes": [],
|
|
68
|
+
"definition": "Fires on Edit Child save when a row is updated. Carries the changed-field delta. Per GDR § 5.6.4 trivial-edit policy, single-field micro-edits may suppress the CAR; material multi-field edits emit one row. (YAML code CHILD_UPDATED.)"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"code": "976-003-000-000-000-000-000",
|
|
72
|
+
"key": "child_archived",
|
|
73
|
+
"title": "Child archived",
|
|
74
|
+
"selectable": true,
|
|
75
|
+
"parentCode": null,
|
|
76
|
+
"childCodes": [],
|
|
77
|
+
"definition": "Fires when archiveChild is called. Soft-archive — sets active.to timestamp; row remains queryable. Carries { subject_id, child_person_id, child_profile_id, archived_reason (optional) }. (YAML code CHILD_ARCHIVED.)"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"code": "976-004-000-000-000-000-000",
|
|
81
|
+
"key": "child_restored",
|
|
82
|
+
"title": "Child restored",
|
|
83
|
+
"selectable": true,
|
|
84
|
+
"parentCode": null,
|
|
85
|
+
"childCodes": [],
|
|
86
|
+
"definition": "Fires when restoreChild is called on an archived row. Carries { subject_id, child_person_id, child_profile_id }. (YAML code CHILD_RESTORED.)"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"code": "976-005-000-000-000-000-000",
|
|
90
|
+
"key": "child_education_updated",
|
|
91
|
+
"title": "Child education updated",
|
|
92
|
+
"selectable": true,
|
|
93
|
+
"parentCode": null,
|
|
94
|
+
"childCodes": [],
|
|
95
|
+
"definition": "Fires when school/daycare attendance Y/N/U + name + grade + level fields change in aggregate. Carries the school/daycare snapshot. (YAML code CHILD_EDUCATION_UPDATED.)"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"code": "976-006-000-000-000-000-000",
|
|
99
|
+
"key": "child_health_updated",
|
|
100
|
+
"title": "Child health & needs updated",
|
|
101
|
+
"selectable": true,
|
|
102
|
+
"parentCode": null,
|
|
103
|
+
"childCodes": [],
|
|
104
|
+
"definition": "Fires when special-needs codes / medication needs / accommodations / allergies / immediate health needs change in aggregate. Multi-field aggregate verb keeps the CAR ledger digestible. (YAML code CHILD_HEALTH_UPDATED.)"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"code": "976-007-000-000-000-000-000",
|
|
108
|
+
"key": "child_custody_updated",
|
|
109
|
+
"title": "Child custody arrangement updated",
|
|
110
|
+
"selectable": true,
|
|
111
|
+
"parentCode": null,
|
|
112
|
+
"childCodes": [],
|
|
113
|
+
"definition": "Fires when custody_arrangement_code or any of the Y/N flags (court-ordered custody / documentation / visitation / other contact / Child Welfare involvement) change. Aggregate verb covering the custody sub-block. (YAML code CHILD_CUSTODY_UPDATED.)"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"code": "976-008-000-000-000-000-000",
|
|
117
|
+
"key": "child_parental_rights_updated",
|
|
118
|
+
"title": "Child loss of parental rights updated",
|
|
119
|
+
"selectable": true,
|
|
120
|
+
"parentCode": null,
|
|
121
|
+
"childCodes": [],
|
|
122
|
+
"definition": "Fires when the per-child LoPR sub-block changes (Y/N + court-ordered + voluntary + caregiver + restrictions). Distinct from CHILD_CUSTODY_UPDATED: LoPR captures the historical / terminal-state of rights; custody captures the current arrangement. (YAML code CHILD_PARENTAL_RIGHTS_UPDATED.)"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"code": "976-009-000-000-000-000-000",
|
|
126
|
+
"key": "child_behavioral_concerns_updated",
|
|
127
|
+
"title": "Child behavioral concerns updated",
|
|
128
|
+
"selectable": true,
|
|
129
|
+
"parentCode": null,
|
|
130
|
+
"childCodes": [],
|
|
131
|
+
"definition": "Fires when behavioral_concern_codes[] or behavioral_concerns_other_text changes. Privacy-sensitive disclosure — review surface implications before exposing this CAR's body in cross-org sharing contexts. (YAML code CHILD_BEHAVIORAL_CONCERNS_UPDATED.)"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"code": "976-010-000-000-000-000-000",
|
|
135
|
+
"key": "child_household_linked",
|
|
136
|
+
"title": "Child linked to household roster",
|
|
137
|
+
"selectable": true,
|
|
138
|
+
"parentCode": null,
|
|
139
|
+
"childCodes": [],
|
|
140
|
+
"definition": "Fires when \"Do they live with you?\" toggles to Yes / Sometimes and an HTI_HOUSEHOLD_MEMBERSHIP[] row is auto-created from the Child profile. Carries { subject_id, child_person_id, hh_membership_id }. Pairs with the H3-side HOUSEHOLD_MEMBER_ADDED CAR (which fires from the membership row creation). (YAML code CHILD_HOUSEHOLD_LINKED.)"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"code": "976-011-000-000-000-000-000",
|
|
144
|
+
"key": "child_household_unlinked",
|
|
145
|
+
"title": "Child unlinked from household roster",
|
|
146
|
+
"selectable": true,
|
|
147
|
+
"parentCode": null,
|
|
148
|
+
"childCodes": [],
|
|
149
|
+
"definition": "Fires when \"Do they live with you?\" toggles from Yes / Sometimes back to No / Unknown and the existing HTI_HOUSEHOLD_MEMBERSHIP[] row is archived. Idempotent if already unlinked. (YAML code CHILD_HOUSEHOLD_UNLINKED.)"
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"domain": "hiv_status",
|
|
3
|
+
"name": "HIV Status",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"_status": "DRAFT — TEMPORARY: net-new value-CVC not yet in Notion; provisional 900+ numbering; codes from prototype/data/cvcs/core_hiv_status.yaml; PENDING canonical Notion authoring (PAVE Auditability backlog). Single-select HIV / AIDS or related diagnosis status per HMIS 4.08; YES auto-qualifies HMIS 3.08 Disabling Condition rollup.",
|
|
6
|
+
"_source": "prototype/data/cvcs/core_hiv_status.yaml",
|
|
7
|
+
"levels": {
|
|
8
|
+
"0": "Unknown or Missing",
|
|
9
|
+
"1": "HIV / AIDS status"
|
|
10
|
+
},
|
|
11
|
+
"entries": [
|
|
12
|
+
{
|
|
13
|
+
"code": "973-000-000-000-000-000-000",
|
|
14
|
+
"key": "missingness_root",
|
|
15
|
+
"title": "Unknown, Redacted, or Missing",
|
|
16
|
+
"selectable": false,
|
|
17
|
+
"parentCode": null,
|
|
18
|
+
"childCodes": [
|
|
19
|
+
"973-000-000-000-000-000-001",
|
|
20
|
+
"973-000-000-000-000-000-002",
|
|
21
|
+
"973-000-000-000-000-000-003"
|
|
22
|
+
],
|
|
23
|
+
"definition": "Root group for values indicating absent, withheld, or uncollected data. Standard workspace missingness triplet. The prototype YAML's three HMIS 4.08 non-response codes (DK 'Client doesn't know', PNA 'Client prefers not to answer', UNK 'Data not collected') are folded onto this triplet per SOT convention rather than duplicated as substantive values."
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"code": "973-000-000-000-000-000-001",
|
|
27
|
+
"key": "unknown",
|
|
28
|
+
"title": "Unknown",
|
|
29
|
+
"selectable": true,
|
|
30
|
+
"parentCode": "973-000-000-000-000-000-000",
|
|
31
|
+
"childCodes": [],
|
|
32
|
+
"definition": "Survivor explicitly says they don't know their HIV status. Useful when the survivor hasn't been tested OR doesn't recall test results. Maps the prototype YAML DK value (HMIS 4.08 = Client doesn't know) onto the standard missingness triplet."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"code": "973-000-000-000-000-000-002",
|
|
36
|
+
"key": "anonymous",
|
|
37
|
+
"title": "Anonymous / declined to answer",
|
|
38
|
+
"selectable": true,
|
|
39
|
+
"parentCode": "973-000-000-000-000-000-000",
|
|
40
|
+
"childCodes": [],
|
|
41
|
+
"definition": "Value intentionally withheld or redacted. Survivor explicitly declines to answer. Maps the prototype YAML PNA value (HMIS 4.08 = Client prefers not to answer) onto the standard workspace ANON sentinel."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"code": "973-000-000-000-000-000-003",
|
|
45
|
+
"key": "data_not_collected",
|
|
46
|
+
"title": "Data not collected",
|
|
47
|
+
"selectable": true,
|
|
48
|
+
"parentCode": "973-000-000-000-000-000-000",
|
|
49
|
+
"childCodes": [],
|
|
50
|
+
"definition": "Not collected during this interaction — the question wasn't asked or the conversation didn't reach resolution. Default missing state. Maps the prototype YAML UNK value (HMIS 4.08 = Data not collected) onto the standard missingness triplet."
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"code": "973-001-000-000-000-000-000",
|
|
54
|
+
"key": "yes",
|
|
55
|
+
"title": "Yes",
|
|
56
|
+
"selectable": true,
|
|
57
|
+
"parentCode": null,
|
|
58
|
+
"childCodes": [],
|
|
59
|
+
"definition": "HIV / AIDS or related diagnosis confirmed by a healthcare professional. Auto-qualifies for HMIS 3.08 Disabling Condition rollup (no severity follow-up required per HMIS 4.08 guidance). HMIS 4.08 = Yes. (YAML code YES.)"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"code": "973-002-000-000-000-000-000",
|
|
63
|
+
"key": "no",
|
|
64
|
+
"title": "No",
|
|
65
|
+
"selectable": true,
|
|
66
|
+
"parentCode": null,
|
|
67
|
+
"childCodes": [],
|
|
68
|
+
"definition": "No HIV / AIDS diagnosis. Does not contribute to HMIS 3.08 Disabling Condition rollup. HMIS 4.08 = No. (YAML code NO.)"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|