@nexalink/coding-contracts 0.2.0 → 0.4.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.
package/README.md CHANGED
@@ -108,14 +108,54 @@ approved evidence set.
108
108
 
109
109
  ## Main exports
110
110
 
111
- | Category | Exports |
112
- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
113
- | Types | `RcmCodingInput`, `RcmCodingOutput`, `RcmSupportingReference`, `RcmModelPrompt`, `RcmRetrievalMetadata`, `RcmRuntimeEvent`, `RcmWorkflowCatalog` |
114
- | Zod schemas | `rcmCodingInputSchema`, `rcmCodingOutputSchema`, and one schema for each additional contract type |
115
- | Validation | `rcm*ValidationError` functions and `validRcm*` boolean helpers |
116
- | Workflow policy | `RCM_WORKFLOW_ID`, `RCM_MODEL_POLICY_ID`, `RCM_HUMAN_REVIEW_POLICY_ID`, `RCM_HUMAN_REVIEW_INSTRUCTION`, `RCM_OUTPUT_SCHEMA_NAME` |
117
- | Schema versions | `RCM_INPUT_SCHEMA_VERSION`, `RCM_OUTPUT_SCHEMA_VERSION`, `RCM_REFERENCE_SCHEMA_VERSION`, and the other contract wire-version constants |
118
- | Schema documents | `Rcm*SchemaJson` values, JSON Schema package subpaths, `versions.json`, and `workflow-constants.json` |
111
+ | Category | Exports |
112
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
113
+ | Types | `RcmCodingInput`, `RcmCodingOutput`, `RcmSupportingReference`, `RcmModelPrompt`, `RcmRetrievalMetadata`, `RcmRuntimeEvent`, `RcmReviewerEvent`, `RcmWorkflowCatalog` |
114
+ | Case models | `CodingCase`, `CodingCaseContext`, `CodingCasePayer`, `CodingCaseClinical`, `CodingServiceLine`, `CodingExtension`, `CodingBatch` |
115
+ | Decision models | `CodingDecision`, `CodingDecisionLine`, `CodingEvidence`, `CodingRuleResult`, `CodingReviewerAction` |
116
+ | Zod schemas | `rcmCodingInputSchema`, `rcmCodingOutputSchema`, `codingCaseSchema`, `codingDecisionSchema`, and one schema for each additional contract type |
117
+ | Validation | `rcm*ValidationError` functions, `coding*ValidationError` functions, and `valid*` boolean helpers |
118
+ | Workflow policy | `RCM_WORKFLOW_ID`, `PIN_TIME_WORKFLOW_ID`, `RCM_MODEL_POLICY_ID`, `RCM_HUMAN_REVIEW_POLICY_ID`, `RCM_HUMAN_REVIEW_INSTRUCTION`, `RCM_OUTPUT_SCHEMA_NAME` |
119
+ | Schema versions | `RCM_INPUT_SCHEMA_VERSION`, `RCM_OUTPUT_SCHEMA_VERSION`, `RCM_REFERENCE_SCHEMA_VERSION`, `CODING_CASE_SCHEMA_VERSION`, `CODING_DECISION_SCHEMA_VERSION`, and the other contract wire-version constants |
120
+ | Schema documents | `Rcm*SchemaJson`, `Coding*SchemaJson` values, JSON Schema package subpaths, `versions.json`, and `workflow-constants.json` |
121
+
122
+ ## Canonical CodingCase and CodingDecision
123
+
124
+ `CodingCase` is the canonical case envelope for encounter review, claim review,
125
+ longitudinal review, monthly multi-activity time aggregation, and bounded batch
126
+ review. `CodingDecision` is the corresponding reconstructable decision.
127
+
128
+ - **CodingCase** carries case identity (`caseId` is client-supplied and may be
129
+ a direct reference; `analyticsId` is the separate analytics-safe identifier),
130
+ coding intent, the service period, setting/jurisdiction/provider context,
131
+ payer/plan/program/contract context, structured clinical facts (diagnoses,
132
+ procedures, medications, supplies, `timeUnits` with `durationMinutes` and
133
+ `activityCode`, notes, source references), existing claim lines, and
134
+ namespaced `extensions`.
135
+ - **CodingDecision** references the case by the analytics-safe `caseRef` only,
136
+ proposes claim-line actions (`add`, `retain`, `replace`, `remove`, `review`)
137
+ with code identity, modifiers, units, linked diagnoses, and sequencing, and
138
+ records typed evidence, documentation gaps, conflicts, extracted facts, rule
139
+ traces, confidence, and the qualified-human-review disposition.
140
+ - **Provenance** (`decisionSchemaVersion`, `caseSchemaVersion`, pack, model,
141
+ terminology editions with license status, rule versions, retrieval corpus,
142
+ and generation time) lets every recommendation be reconstructed.
143
+ - **ReviewerAction** is appended immutably: the original decision and the
144
+ attributable reviewer disposition are both preserved.
145
+ - **Extensions** are `{ namespace, schemaVersion, payload }` objects. Payloads
146
+ are bounded (at most 50 properties) but otherwise opaque; Nexalink reserves
147
+ `com.nexalink` and `org.nexalink` namespaces. Extensions keep pack-specific
148
+ data out of the shared envelope without making every field optional.
149
+ - **Identifiers**: direct identifiers (`caseId`, provider NPIs/names, `memberId`)
150
+ are documented as such in the schemas and must never be promoted to analytics
151
+ surfaces. Decisions and metrics reference the analytics-safe `analyticsId` /
152
+ `caseRef` only.
153
+ - **Batching**: `CodingBatch` wraps 1–100 cases for bounded batch review; one
154
+ execution stays within runtime limits.
155
+
156
+ The current RCM example (`DEMO-ENC-1042`) and a monthly multi-activity
157
+ time-aggregation workflow both have lossless, round-trip fixtures under
158
+ `fixtures/coding-case/` and `fixtures/coding-decision/`.
119
159
 
120
160
  ## Use the raw JSON Schemas
121
161