@nexalink/coding-contracts 0.1.0 → 0.3.0

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.
@@ -0,0 +1,430 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://nexalink.care/contracts/coding-decision.schema.json",
4
+ "title": "CodingDecision",
5
+ "description": "The canonical, reconstructable decision for a CodingCase. caseRef is an analytics-safe reference (the case's analyticsId or a runtime opaque reference) and never a direct identifier. provenance pins the pack, model, terminology, rules, and schema versions needed to replay every recommendation.",
6
+ "version": "1.0.0",
7
+ "x-wire-version": "coding-decision-v1",
8
+ "x-wire-constant": "CODING_DECISION_SCHEMA_VERSION",
9
+ "x-code": "coding_decision",
10
+ "x-keys-code": "coding_decision_keys",
11
+ "x-semantic": [
12
+ {
13
+ "rule": "reconstructable_provenance",
14
+ "on": "lineDecisions",
15
+ "code": "decision_provenance_replay"
16
+ }
17
+ ],
18
+ "type": "object",
19
+ "additionalProperties": false,
20
+ "required": [
21
+ "decisionId",
22
+ "caseRef",
23
+ "disposition",
24
+ "humanReviewRequired",
25
+ "rationale",
26
+ "lineDecisions",
27
+ "provenance"
28
+ ],
29
+ "properties": {
30
+ "decisionId": {
31
+ "type": "string",
32
+ "minLength": 1,
33
+ "maxLength": 128,
34
+ "x-code": "decision_id"
35
+ },
36
+ "caseRef": {
37
+ "type": "string",
38
+ "minLength": 1,
39
+ "maxLength": 128,
40
+ "x-code": "decision_case_ref"
41
+ },
42
+ "disposition": {
43
+ "type": "string",
44
+ "enum": ["review_required", "abstain", "escalate"],
45
+ "x-code": "decision_disposition"
46
+ },
47
+ "humanReviewRequired": {
48
+ "type": "boolean",
49
+ "const": true,
50
+ "x-code": "decision_human_review_required"
51
+ },
52
+ "rationale": {
53
+ "type": "string",
54
+ "minLength": 1,
55
+ "maxLength": 4000,
56
+ "x-strip-nonempty": true,
57
+ "x-code": "decision_rationale"
58
+ },
59
+ "overallConfidence": {
60
+ "type": "string",
61
+ "enum": ["low", "medium", "high"],
62
+ "x-code": "decision_overall_confidence"
63
+ },
64
+ "lineDecisions": {
65
+ "type": "array",
66
+ "maxItems": 100,
67
+ "x-code": "decision_lines",
68
+ "items": {
69
+ "$ref": "coding-decision-line.schema.json"
70
+ }
71
+ },
72
+ "facts": {
73
+ "type": "array",
74
+ "maxItems": 50,
75
+ "x-code": "decision_facts",
76
+ "items": {
77
+ "type": "object",
78
+ "additionalProperties": false,
79
+ "required": ["factId", "statement"],
80
+ "x-code": "decision_fact",
81
+ "x-keys-code": "decision_fact_keys",
82
+ "properties": {
83
+ "factId": {
84
+ "type": "string",
85
+ "minLength": 1,
86
+ "maxLength": 60,
87
+ "x-code": "decision_fact_id"
88
+ },
89
+ "statement": {
90
+ "type": "string",
91
+ "minLength": 1,
92
+ "maxLength": 2000,
93
+ "x-strip-nonempty": true,
94
+ "x-code": "decision_fact_statement"
95
+ },
96
+ "evidenceRefs": {
97
+ "type": "array",
98
+ "maxItems": 10,
99
+ "x-code": "decision_fact_evidence_refs",
100
+ "items": {
101
+ "type": "string",
102
+ "minLength": 1,
103
+ "maxLength": 64,
104
+ "x-code": "decision_fact_evidence_refs"
105
+ }
106
+ }
107
+ }
108
+ }
109
+ },
110
+ "gaps": {
111
+ "type": "array",
112
+ "maxItems": 30,
113
+ "x-code": "decision_gaps",
114
+ "items": {
115
+ "type": "object",
116
+ "additionalProperties": false,
117
+ "required": ["gapId", "type", "description", "severity"],
118
+ "x-code": "decision_gap",
119
+ "x-keys-code": "decision_gap_keys",
120
+ "properties": {
121
+ "gapId": {
122
+ "type": "string",
123
+ "minLength": 1,
124
+ "maxLength": 60,
125
+ "x-code": "decision_gap_id"
126
+ },
127
+ "type": {
128
+ "type": "string",
129
+ "enum": [
130
+ "missing_documentation",
131
+ "unsupported_scope",
132
+ "insufficient_evidence",
133
+ "policy_conflict",
134
+ "terminology_unavailable",
135
+ "other"
136
+ ],
137
+ "x-code": "decision_gap_type"
138
+ },
139
+ "description": {
140
+ "type": "string",
141
+ "minLength": 1,
142
+ "maxLength": 1000,
143
+ "x-strip-nonempty": true,
144
+ "x-code": "decision_gap_description"
145
+ },
146
+ "severity": {
147
+ "type": "string",
148
+ "enum": ["low", "medium", "high", "blocking"],
149
+ "x-code": "decision_gap_severity"
150
+ }
151
+ }
152
+ }
153
+ },
154
+ "conflicts": {
155
+ "type": "array",
156
+ "maxItems": 20,
157
+ "x-code": "decision_conflicts",
158
+ "items": {
159
+ "type": "object",
160
+ "additionalProperties": false,
161
+ "required": ["conflictId", "type", "summary"],
162
+ "x-code": "decision_conflict",
163
+ "x-keys-code": "decision_conflict_keys",
164
+ "properties": {
165
+ "conflictId": {
166
+ "type": "string",
167
+ "minLength": 1,
168
+ "maxLength": 60,
169
+ "x-code": "decision_conflict_id"
170
+ },
171
+ "type": {
172
+ "type": "string",
173
+ "enum": [
174
+ "payer_vs_national",
175
+ "plan_vs_contract",
176
+ "terminology_period",
177
+ "rule_vs_rule",
178
+ "model_vs_rule",
179
+ "other"
180
+ ],
181
+ "x-code": "decision_conflict_type"
182
+ },
183
+ "summary": {
184
+ "type": "string",
185
+ "minLength": 1,
186
+ "maxLength": 1000,
187
+ "x-strip-nonempty": true,
188
+ "x-code": "decision_conflict_summary"
189
+ },
190
+ "references": {
191
+ "type": "array",
192
+ "maxItems": 10,
193
+ "x-code": "decision_conflict_references",
194
+ "items": {
195
+ "type": "string",
196
+ "minLength": 1,
197
+ "maxLength": 120,
198
+ "x-code": "decision_conflict_references"
199
+ }
200
+ }
201
+ }
202
+ }
203
+ },
204
+ "evidenceItems": {
205
+ "type": "array",
206
+ "maxItems": 40,
207
+ "x-code": "decision_evidence_items",
208
+ "items": {
209
+ "$ref": "coding-evidence.schema.json"
210
+ }
211
+ },
212
+ "ruleTraces": {
213
+ "type": "array",
214
+ "maxItems": 50,
215
+ "x-code": "decision_rule_traces",
216
+ "items": {
217
+ "$ref": "coding-rule-result.schema.json"
218
+ }
219
+ },
220
+ "provenance": {
221
+ "type": "object",
222
+ "additionalProperties": false,
223
+ "required": [
224
+ "decisionSchemaVersion",
225
+ "caseSchemaVersion",
226
+ "pack",
227
+ "model",
228
+ "terminology",
229
+ "rules",
230
+ "generatedAt"
231
+ ],
232
+ "x-code": "decision_provenance",
233
+ "x-keys-code": "decision_provenance_keys",
234
+ "properties": {
235
+ "decisionSchemaVersion": {
236
+ "type": "string",
237
+ "minLength": 1,
238
+ "maxLength": 40,
239
+ "x-code": "decision_provenance_decision_schema_version"
240
+ },
241
+ "caseSchemaVersion": {
242
+ "type": "string",
243
+ "minLength": 1,
244
+ "maxLength": 40,
245
+ "x-code": "decision_provenance_case_schema_version"
246
+ },
247
+ "pack": {
248
+ "type": "object",
249
+ "additionalProperties": false,
250
+ "required": ["packId", "packVersion"],
251
+ "x-code": "decision_provenance_pack",
252
+ "x-keys-code": "decision_provenance_pack_keys",
253
+ "properties": {
254
+ "packId": {
255
+ "type": "string",
256
+ "minLength": 1,
257
+ "maxLength": 120,
258
+ "x-code": "decision_provenance_pack_id"
259
+ },
260
+ "packVersion": {
261
+ "type": "string",
262
+ "minLength": 1,
263
+ "maxLength": 40,
264
+ "x-code": "decision_provenance_pack_version"
265
+ }
266
+ }
267
+ },
268
+ "model": {
269
+ "type": "object",
270
+ "additionalProperties": false,
271
+ "required": ["modelId", "modelVersion"],
272
+ "x-code": "decision_provenance_model",
273
+ "x-keys-code": "decision_provenance_model_keys",
274
+ "properties": {
275
+ "modelId": {
276
+ "type": "string",
277
+ "minLength": 1,
278
+ "maxLength": 120,
279
+ "x-code": "decision_provenance_model_id"
280
+ },
281
+ "modelVersion": {
282
+ "type": "string",
283
+ "minLength": 1,
284
+ "maxLength": 40,
285
+ "x-code": "decision_provenance_model_version"
286
+ }
287
+ }
288
+ },
289
+ "terminology": {
290
+ "type": "array",
291
+ "maxItems": 20,
292
+ "x-code": "decision_provenance_terminology",
293
+ "items": {
294
+ "type": "object",
295
+ "additionalProperties": false,
296
+ "required": ["system", "editionVersion", "licenseApproved"],
297
+ "x-code": "decision_provenance_terminology_item",
298
+ "x-keys-code": "decision_provenance_terminology_item_keys",
299
+ "properties": {
300
+ "system": {
301
+ "type": "string",
302
+ "enum": [
303
+ "ICD-10-CM",
304
+ "ICD-10-PCS",
305
+ "CPT",
306
+ "HCPCS",
307
+ "NDC",
308
+ "CDT",
309
+ "REVENUE_CODE",
310
+ "DRG",
311
+ "MODIFIERS",
312
+ "OTHER"
313
+ ],
314
+ "x-code": "decision_provenance_terminology_system"
315
+ },
316
+ "editionVersion": {
317
+ "type": "string",
318
+ "minLength": 1,
319
+ "maxLength": 40,
320
+ "x-code": "decision_provenance_terminology_edition"
321
+ },
322
+ "licenseApproved": {
323
+ "type": "boolean",
324
+ "x-code": "decision_provenance_terminology_license"
325
+ }
326
+ }
327
+ }
328
+ },
329
+ "rules": {
330
+ "type": "array",
331
+ "maxItems": 30,
332
+ "x-code": "decision_provenance_rules",
333
+ "items": {
334
+ "type": "object",
335
+ "additionalProperties": false,
336
+ "required": ["ruleId", "ruleVersion"],
337
+ "x-code": "decision_provenance_rule",
338
+ "x-keys-code": "decision_provenance_rule_keys",
339
+ "properties": {
340
+ "ruleId": {
341
+ "type": "string",
342
+ "minLength": 1,
343
+ "maxLength": 120,
344
+ "x-code": "decision_provenance_rule_id"
345
+ },
346
+ "ruleVersion": {
347
+ "type": "string",
348
+ "minLength": 1,
349
+ "maxLength": 40,
350
+ "x-code": "decision_provenance_rule_version"
351
+ }
352
+ }
353
+ }
354
+ },
355
+ "retrievalCorpus": {
356
+ "type": "object",
357
+ "additionalProperties": false,
358
+ "x-code": "decision_provenance_corpus",
359
+ "x-keys-code": "decision_provenance_corpus_keys",
360
+ "properties": {
361
+ "corpusId": {
362
+ "type": "string",
363
+ "minLength": 1,
364
+ "maxLength": 120,
365
+ "x-code": "decision_provenance_corpus_id"
366
+ },
367
+ "corpusVersion": {
368
+ "type": "string",
369
+ "minLength": 1,
370
+ "maxLength": 120,
371
+ "x-code": "decision_provenance_corpus_version"
372
+ }
373
+ }
374
+ },
375
+ "generatedAt": {
376
+ "type": "string",
377
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|[+-](?:[01]\\d|2[0-3]):[0-5]\\d)$",
378
+ "format": "date-time",
379
+ "maxLength": 64,
380
+ "x-code": "decision_provenance_generated_at"
381
+ }
382
+ }
383
+ },
384
+ "reviewerAction": {
385
+ "$ref": "coding-reviewer-action.schema.json"
386
+ },
387
+ "extensions": {
388
+ "type": "array",
389
+ "maxItems": 25,
390
+ "x-code": "decision_extensions",
391
+ "items": {
392
+ "$ref": "coding-extension.schema.json"
393
+ }
394
+ }
395
+ },
396
+ "if": {
397
+ "properties": {
398
+ "disposition": {
399
+ "const": "review_required"
400
+ }
401
+ },
402
+ "required": ["disposition"]
403
+ },
404
+ "then": {
405
+ "properties": {
406
+ "lineDecisions": {
407
+ "minItems": 1
408
+ },
409
+ "provenance": {
410
+ "properties": {
411
+ "terminology": {
412
+ "minItems": 1
413
+ },
414
+ "rules": {
415
+ "minItems": 1
416
+ }
417
+ }
418
+ }
419
+ },
420
+ "x-code": "decision_review_required_lines"
421
+ },
422
+ "else": {
423
+ "properties": {
424
+ "lineDecisions": {
425
+ "maxItems": 0
426
+ }
427
+ },
428
+ "x-code": "decision_disposition_lines"
429
+ }
430
+ }
@@ -0,0 +1,100 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://nexalink.care/contracts/coding-evidence.schema.json",
4
+ "title": "CodingEvidence",
5
+ "description": "One typed, traced evidence item attached to a decision. Every item carries source, scope, version, effective period, and a stable identifier so reviews can be reconstructed. Licensed terminology content is never distributed through evidence excerpts.",
6
+ "version": "1.0.0",
7
+ "x-wire-version": "coding-evidence-v1",
8
+ "x-wire-constant": "CODING_EVIDENCE_SCHEMA_VERSION",
9
+ "x-code": "evidence",
10
+ "x-keys-code": "evidence_keys",
11
+ "type": "object",
12
+ "additionalProperties": false,
13
+ "required": [
14
+ "evidenceId",
15
+ "type",
16
+ "source",
17
+ "sourceVersion",
18
+ "scope",
19
+ "effectiveFrom",
20
+ "stableId",
21
+ "excerpt",
22
+ "retrievedAt"
23
+ ],
24
+ "properties": {
25
+ "evidenceId": {
26
+ "type": "string",
27
+ "minLength": 1,
28
+ "maxLength": 64,
29
+ "x-code": "evidence_id"
30
+ },
31
+ "type": {
32
+ "type": "string",
33
+ "enum": [
34
+ "clinical",
35
+ "coding_guideline",
36
+ "payer_policy",
37
+ "plan_policy",
38
+ "contract_configuration",
39
+ "terminology_validity",
40
+ "rule_execution"
41
+ ],
42
+ "x-code": "evidence_type"
43
+ },
44
+ "source": {
45
+ "type": "string",
46
+ "minLength": 1,
47
+ "maxLength": 240,
48
+ "x-strip-nonempty": true,
49
+ "x-code": "evidence_source"
50
+ },
51
+ "sourceVersion": {
52
+ "type": "string",
53
+ "minLength": 1,
54
+ "maxLength": 80,
55
+ "x-code": "evidence_source_version"
56
+ },
57
+ "publisher": {
58
+ "type": "string",
59
+ "minLength": 1,
60
+ "maxLength": 240,
61
+ "x-code": "evidence_publisher"
62
+ },
63
+ "scope": {
64
+ "type": "string",
65
+ "enum": ["national", "payer", "plan", "contract", "tenant"],
66
+ "x-code": "evidence_scope"
67
+ },
68
+ "effectiveFrom": {
69
+ "type": "string",
70
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
71
+ "format": "date",
72
+ "x-code": "evidence_effective_from"
73
+ },
74
+ "effectiveTo": {
75
+ "type": "string",
76
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
77
+ "format": "date",
78
+ "x-code": "evidence_effective_to"
79
+ },
80
+ "stableId": {
81
+ "type": "string",
82
+ "minLength": 1,
83
+ "maxLength": 240,
84
+ "x-code": "evidence_stable_id"
85
+ },
86
+ "excerpt": {
87
+ "type": "string",
88
+ "minLength": 1,
89
+ "maxLength": 2000,
90
+ "x-strip-nonempty": true,
91
+ "x-code": "evidence_excerpt"
92
+ },
93
+ "retrievedAt": {
94
+ "type": "string",
95
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
96
+ "format": "date",
97
+ "x-code": "evidence_retrieved_at"
98
+ }
99
+ }
100
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://nexalink.care/contracts/coding-extension.schema.json",
4
+ "title": "CodingExtension",
5
+ "description": "A namespaced, bounded extension attached to a CodingCase or CodingDecision. Extensions carry pack-specific data without turning the shared envelope into an unbounded bag of specialty fields. Namespace ownership follows reverse-domain convention; Nexalink reserves com.nexalink and org.nexalink.",
6
+ "version": "1.0.0",
7
+ "x-wire-version": "coding-extension-v1",
8
+ "x-wire-constant": "CODING_EXTENSION_SCHEMA_VERSION",
9
+ "x-code": "extension",
10
+ "x-keys-code": "extension_keys",
11
+ "type": "object",
12
+ "additionalProperties": false,
13
+ "required": ["namespace", "schemaVersion", "payload"],
14
+ "properties": {
15
+ "namespace": {
16
+ "type": "string",
17
+ "pattern": "^[a-z0-9]+([._-][a-z0-9]+)*$",
18
+ "minLength": 3,
19
+ "maxLength": 160,
20
+ "x-code": "extension_namespace"
21
+ },
22
+ "schemaVersion": {
23
+ "type": "string",
24
+ "minLength": 1,
25
+ "maxLength": 40,
26
+ "x-code": "extension_schema_version"
27
+ },
28
+ "payload": {
29
+ "type": "object",
30
+ "maxProperties": 50,
31
+ "x-code": "extension_payload",
32
+ "x-keys-code": "extension_payload",
33
+ "properties": {}
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,53 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://nexalink.care/contracts/coding-reviewer-action.schema.json",
4
+ "title": "CodingReviewerAction",
5
+ "description": "Attributable human-review disposition appended to an otherwise immutable decision. A decision plus its reviewer actions remains replayable: original and reviewer versions are both preserved.",
6
+ "version": "1.0.0",
7
+ "x-wire-version": "coding-reviewer-action-v1",
8
+ "x-wire-constant": "CODING_REVIEWER_ACTION_SCHEMA_VERSION",
9
+ "x-code": "reviewer_action",
10
+ "x-keys-code": "reviewer_action_keys",
11
+ "type": "object",
12
+ "additionalProperties": false,
13
+ "required": ["reviewerId", "action", "occurredAt"],
14
+ "properties": {
15
+ "reviewerId": {
16
+ "type": "string",
17
+ "minLength": 1,
18
+ "maxLength": 128,
19
+ "x-code": "reviewer_action_id"
20
+ },
21
+ "reviewerRole": {
22
+ "type": "string",
23
+ "minLength": 1,
24
+ "maxLength": 80,
25
+ "x-code": "reviewer_action_role"
26
+ },
27
+ "action": {
28
+ "type": "string",
29
+ "enum": ["approved", "approved_with_changes", "rejected", "escalated"],
30
+ "x-code": "reviewer_action_type"
31
+ },
32
+ "resolutionCode": {
33
+ "type": "string",
34
+ "minLength": 1,
35
+ "maxLength": 80,
36
+ "x-code": "reviewer_action_resolution_code"
37
+ },
38
+ "notes": {
39
+ "type": "string",
40
+ "minLength": 1,
41
+ "maxLength": 2000,
42
+ "x-strip-nonempty": true,
43
+ "x-code": "reviewer_action_notes"
44
+ },
45
+ "occurredAt": {
46
+ "type": "string",
47
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|[+-](?:[01]\\d|2[0-3]):[0-5]\\d)$",
48
+ "format": "date-time",
49
+ "maxLength": 64,
50
+ "x-code": "reviewer_action_occurred_at"
51
+ }
52
+ }
53
+ }