@smile-digital-health/crl 5.1.1 → 5.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.
Files changed (53) hide show
  1. package/README.md +26 -12
  2. package/dist/ast/types.d.ts +4 -4
  3. package/dist/authoring-kit/audit.json +4 -4
  4. package/dist/authoring-kit/index.js +256 -14
  5. package/dist/authoring-kit/index.js.map +1 -1
  6. package/dist/authoring-kit/navigation.js +4 -0
  7. package/dist/authoring-kit/navigation.js.map +1 -1
  8. package/dist/authoring-kit/types.d.ts +1 -1
  9. package/dist/cql-emitter/emitCQL.js +18 -18
  10. package/dist/cql-emitter/emitCQL.js.map +1 -1
  11. package/dist/cql-emitter/layeredEmit.js +20 -20
  12. package/dist/cql-emitter/layeredEmit.js.map +1 -1
  13. package/dist/cql-emitter/lowerLocalCodes.js +10 -10
  14. package/dist/cql-emitter/lowerLocalCodes.js.map +1 -1
  15. package/dist/cre/run.d.ts +8 -0
  16. package/dist/cre/run.js +13 -0
  17. package/dist/cre/run.js.map +1 -1
  18. package/dist/cre/viewModel.d.ts +8 -0
  19. package/dist/cre/viewModel.js +1 -0
  20. package/dist/cre/viewModel.js.map +1 -1
  21. package/dist/emit/closeIndex.js.map +1 -1
  22. package/dist/emit/declaredResultIndex.js.map +1 -1
  23. package/dist/emit/presentation.d.ts +6 -1
  24. package/dist/emit/presentation.js +5 -1
  25. package/dist/emit/presentation.js.map +1 -1
  26. package/dist/fhir-emitter/caseFeatureCollection.js.map +1 -1
  27. package/dist/fhir-emitter/caseFeatureRecord.d.ts +1 -1
  28. package/dist/fhir-emitter/caseFeatureRecord.js +1 -1
  29. package/dist/fhir-emitter/caseFeatureRecord.js.map +1 -1
  30. package/dist/fhir-emitter/closureOrchestrator.js +4 -4
  31. package/dist/fhir-emitter/closureOrchestrator.js.map +1 -1
  32. package/dist/fhir-emitter/slug.js.map +1 -1
  33. package/dist/index.d.ts +2 -1
  34. package/dist/index.js +7 -4
  35. package/dist/index.js.map +1 -1
  36. package/dist/provenance/cockpitModel.d.ts +1 -0
  37. package/dist/provenance/cockpitModel.js +10 -7
  38. package/dist/provenance/cockpitModel.js.map +1 -1
  39. package/dist/provenance/crlConceptLayer.d.ts +2 -0
  40. package/dist/provenance/crlConceptLayer.js +1 -1
  41. package/dist/provenance/crlConceptLayer.js.map +1 -1
  42. package/dist/provenance/crlStructure.d.ts +3 -0
  43. package/dist/provenance/crlStructure.js +4 -0
  44. package/dist/provenance/crlStructure.js.map +1 -1
  45. package/dist/provenance/index.d.ts +1 -1
  46. package/dist/provenance/index.js +3 -2
  47. package/dist/provenance/index.js.map +1 -1
  48. package/dist/provenance/policyLayout.js +2 -2
  49. package/dist/provenance/policyLayout.js.map +1 -1
  50. package/dist/provenance/revealMaps.d.ts +1 -1
  51. package/dist/provenance/revealMaps.js +1 -1
  52. package/dist/provenance/revealMaps.js.map +1 -1
  53. package/package.json +1 -1
package/README.md CHANGED
@@ -4,38 +4,52 @@ Clinical Reasoning Language (CRL) parser and validator
4
4
 
5
5
  Clinical Reasoning Language (CRL) provides a structured way to model clinical decision logic, concept derivations, clinical activities, measurements, and summaries — while remaining simple, readable, and guideline-compatible.
6
6
 
7
+ ## CRL 5.3.0
8
+
9
+ This release adds the Medical Validation Question–Result view, route question cards,
10
+ a separate Result Questionnaire, and MV-scoped wording proposals for the owning KE.
11
+ CRL/CEL syntax and CQL/FHIR emission semantics are unchanged from 5.2.0. Core APIs
12
+ add selected answer values, presentation field ownership, and execution-model access
13
+ without source correspondence. Policy storage can be discovered from `src/crl` plus
14
+ `src/cel` without provenance; source highlighting still requires correspondence.
15
+ Authoring kit 2.2 documents MV case intent and the wording-patch handoff. Folder-based
16
+ MV/regression emission filtering is not implemented. See the [release notes](https://github.com/alphora/clinical-reasoning-language/releases/tag/v5.3.0)
17
+ and [MV guide](https://github.com/alphora/clinical-reasoning-language/blob/v5.3.0/docs/mv-component-view.md).
18
+
7
19
  ## Overview
8
20
 
9
- See the [User Guide](https://github.com/alphora/clinical-reasoning-language/blob/v5.1.1/packages/crl/USER_GUIDE.md) for a comprehensive introduction to the CRL language, syntax, and authoring best practices. For the **CLI and MCP tool reference** (emit, validate, the MCP tools — for both CRL and CEL), see [TOOLING.md](https://github.com/alphora/clinical-reasoning-language/blob/v5.1.1/packages/crl/TOOLING.md).
21
+ See the [User Guide](https://github.com/alphora/clinical-reasoning-language/blob/v5.3.0/packages/crl/USER_GUIDE.md) for a comprehensive introduction to the CRL language, syntax, and authoring best practices. For the **CLI and MCP tool reference** (emit, validate, the MCP tools — for both CRL and CEL), see [TOOLING.md](https://github.com/alphora/clinical-reasoning-language/blob/v5.3.0/packages/crl/TOOLING.md).
10
22
 
11
23
  CRL is a domain-specific language designed for expressing clinical practice guidelines in a structured and machine-readable format. The language is implemented in TypeScript and provides a comprehensive set of tools for processing CRL documents.
12
24
 
13
25
  For the authoring reference over MCP, call `authoring_kit({})` to discover guidance,
14
26
  or `authoring_kit({view:"full",format:"markdown"})` for the complete audited Markdown.
15
27
  The response is the same document as the release's `authoring-kit.md`; the agent can
16
- read or save it. JSON remains the default. See the [kit guide](https://github.com/alphora/clinical-reasoning-language/blob/v5.1.1/docs/authoring-kit.md).
28
+ read or save it. JSON remains the default. See the [kit guide](https://github.com/alphora/clinical-reasoning-language/blob/v5.3.0/docs/authoring-kit.md).
17
29
 
18
30
  ## Metadata annotations
19
31
 
20
- CRL concepts can carry typed metadata via an `@tag` convention on `meta` lines (e.g. `@description`, `@ke-feedback`, `@kg-concept`) — for descriptions, knowledge-engineer feedback, plain-language logic, external-store hints, and extraction provenance. See the [metadata model](https://github.com/alphora/clinical-reasoning-language/blob/v5.1.1/packages/crl/spec/metadata-model.md) and the canonical [tag registry](https://github.com/alphora/clinical-reasoning-language/blob/v5.1.1/packages/crl/spec/metadata-registry.json). *(Draft: the convention parses today; Validator enforcement is forthcoming.)*
32
+ CRL concepts can carry typed metadata via an `@tag` convention on `meta` lines (e.g. `@description`, `@ke-feedback`, `@kg-concept`) — for descriptions, knowledge-engineer feedback, plain-language logic, external-store hints, and extraction provenance. See the [metadata model](https://github.com/alphora/clinical-reasoning-language/blob/v5.3.0/packages/crl/spec/metadata-model.md) and the canonical [tag registry](https://github.com/alphora/clinical-reasoning-language/blob/v5.3.0/packages/crl/spec/metadata-registry.json). *(Draft: the convention parses today; Validator enforcement is forthcoming.)*
21
33
 
22
34
  ## Installation
23
35
 
24
36
  The package is publicly available from npm; installation does not require an npm account or token.
25
37
 
26
38
  ```bash
27
- npm install @smile-digital-health/crl@5.1.1
39
+ npm install @smile-digital-health/crl@5.3.0
28
40
  ```
29
41
 
30
- For a dependency that accepts compatible CRL5 updates:
42
+ Pin the version so generated-artifact migrations are adopted deliberately:
31
43
 
32
44
  ```json
33
45
  "dependencies": {
34
- "@smile-digital-health/crl": "^5.1.0"
46
+ "@smile-digital-health/crl": "5.3.0"
35
47
  }
36
48
  ```
37
49
 
38
- CRL5.1 changes the public authoring-kit npm and MCP APIs. When upgrading from 5.0.0, update kit calls as described in the [5.1.0 release notes](https://github.com/alphora/clinical-reasoning-language/releases/tag/v5.1.0); the CRL/CEL language and emitted CQL/FHIR are unchanged from 5.0.0. A `^5` dependency permits 5.1.0. Content from before the CRL5 language transition may also need language migration using the current authoring kit.
50
+ CRL 5.2 renames generated retrieval libraries from `LocalPrimitives`/`ExternalPrimitives` to `LocalElements`/`ExternalElements`, including CQL includes and FHIR Library identities. Regenerate CQL and FHIR together and replace the previous generated-file inventory, preserving independently authored files. Re-emission does not automatically delete obsolete artifacts. See the [5.2.0 migration notes](https://github.com/alphora/clinical-reasoning-language/releases/tag/v5.2.0). A `^5` or `^5.1.0` dependency can acquire this update automatically; use an exact version pin when upgrades require coordinated artifact replacement.
51
+
52
+ CRL/CEL syntax is unchanged by 5.2. When upgrading from 5.0.0, also update the authoring-kit npm/MCP calls described in the [5.1.0 release notes](https://github.com/alphora/clinical-reasoning-language/releases/tag/v5.1.0). Content from before the CRL5 language transition may need language migration using the current authoring kit.
39
53
 
40
54
  ### For Package Maintainers
41
55
 
@@ -165,7 +179,7 @@ The FSH-to-CRL transformer converts FHIR Shorthand (FSH) files into Clinical Rea
165
179
  - **Deduplication and Suffixing**: Terminology blocks are unique by identifier and body. If a duplicate identifier is encountered with a different body, a numeric suffix (e.g., `_2`) is added to the identifier. If both identifier and body are the same, the block is not duplicated.
166
180
  - **Extraction Logic**: For `medicationCodeableConcept`, the transformer uses `system`, `code`, and `identifier` from the FSH object. For `dynamicValue.expression.expression` (where `path = "code.coding"`), the transformer uses `system` and `code` from the CQL code expression string and `identifier` from the corresponding description.
167
181
 
168
- For more details, see the [User Guide](https://github.com/alphora/clinical-reasoning-language/blob/v5.1.1/packages/crl/USER_GUIDE.md) and the technical mapping documentation.
182
+ For more details, see the [User Guide](https://github.com/alphora/clinical-reasoning-language/blob/v5.3.0/packages/crl/USER_GUIDE.md) and the technical mapping documentation.
169
183
 
170
184
  ## CLI Tool Usage
171
185
 
@@ -193,7 +207,7 @@ crl-emit --path <root.crl> --out-dir <project-root> --target fhir-def
193
207
 
194
208
  Output lands at `<project-root>/src/fhir/<ResourceType>/<id>.json`. CQL emit (the existing `--target cql` / default behavior) lands at `<project-root>/src/cql/<library-name>.cql`. Library content references the CQL file via the relative path `../../cql/<library-name>.cql`.
195
209
 
196
- For semantic rules, layout details, deliberate spec deviations, and the MCP `emit_crl` tool, see [`USER_GUIDE.md` §"Emitting FHIR Definition resources"](https://github.com/alphora/clinical-reasoning-language/blob/v5.1.1/packages/crl/USER_GUIDE.md#emitting-fhir-definition-resources).
210
+ For semantic rules, layout details, deliberate spec deviations, and the MCP `emit_crl` tool, see [`USER_GUIDE.md` §"Emitting FHIR Definition resources"](https://github.com/alphora/clinical-reasoning-language/blob/v5.3.0/packages/crl/USER_GUIDE.md#emitting-fhir-definition-resources).
197
211
 
198
212
  ## API Usage & Reference
199
213
 
@@ -495,7 +509,7 @@ Note: This project uses a custom AST implementation that uses ANTLR's visitor pa
495
509
  >
496
510
  > The authoritative release checklist and instructions are maintained in a single location:
497
511
  >
498
- > **[.github/PULL_REQUEST_TEMPLATE/release.md](https://github.com/alphora/clinical-reasoning-language/blob/v5.1.1/.github/PULL_REQUEST_TEMPLATE/release.md)**
512
+ > **[.github/PULL_REQUEST_TEMPLATE/release.md](https://github.com/alphora/clinical-reasoning-language/blob/v5.3.0/.github/PULL_REQUEST_TEMPLATE/release.md)**
499
513
  >
500
514
  > Always follow the steps in this file when preparing a new release. This ensures consistency and reduces maintenance overhead. If you need to update the release process, update the PR template only.
501
515
 
@@ -509,7 +523,7 @@ Note: This project uses a custom AST implementation that uses ANTLR's visitor pa
509
523
  - **Generated Files:** Auto-generated files (e.g., ANTLR outputs, grammar-driven types) are ignored by git and should never be edited manually. Always use the provided scripts to regenerate them.
510
524
  - **Documentation:** Keep all documentation referencing the release checklist up-to-date by linking to the PR template.
511
525
 
512
- For more details, see the [release PR template](https://github.com/alphora/clinical-reasoning-language/blob/v5.1.1/.github/PULL_REQUEST_TEMPLATE/release.md) and the automation scripts in `.github/scripts/`.
526
+ For more details, see the [release PR template](https://github.com/alphora/clinical-reasoning-language/blob/v5.3.0/.github/PULL_REQUEST_TEMPLATE/release.md) and the automation scripts in `.github/scripts/`.
513
527
 
514
528
  ### Error Handling Strategy
515
529
 
@@ -552,7 +566,7 @@ We provide a Visual Studio Code extension for CRL files:
552
566
  - Comment support
553
567
  - Language basics for a better editing experience
554
568
 
555
- For installation instructions and full details, see [crl-vscode/README.md](https://github.com/alphora/clinical-reasoning-language/blob/v5.1.1/packages/crl-vscode/README.md)
569
+ For installation instructions and full details, see [crl-vscode/README.md](https://github.com/alphora/clinical-reasoning-language/blob/v5.3.0/packages/crl-vscode/README.md)
556
570
 
557
571
  ## License
558
572
 
@@ -218,16 +218,16 @@ export interface ActivityBecause extends ASTNode {
218
218
  rationale: string;
219
219
  location: Location;
220
220
  }
221
- export type InterfaceSourceLayer = "LocalPrimitives" | "ExternalPrimitives" | "Inferences";
221
+ export type InterfaceSourceLayer = "LocalElements" | "ExternalElements" | "Inferences";
222
222
  export interface ValueElement {
223
223
  path: string;
224
224
  location: Location;
225
225
  }
226
226
  export type RecordUnionTerm = {
227
- kind: "local-primitives";
227
+ kind: "local-elements";
228
228
  define: string;
229
229
  } | {
230
- kind: "external-primitives";
230
+ kind: "external-elements";
231
231
  define: string;
232
232
  } | {
233
233
  kind: "constructed";
@@ -284,7 +284,7 @@ export interface Concept extends ASTNode {
284
284
  __pureQuestion?: true;
285
285
  __pureQuestionRead?: true;
286
286
  __reductionLocalUnion?: string;
287
- __bothRepFoldInLocalPrimitives?: string;
287
+ __bothRepFoldInLocalElements?: string;
288
288
  __recordUnionTerms?: readonly RecordUnionTerm[];
289
289
  __bothRepMerge?: "union" | "recency-value" | "record-union";
290
290
  __effectiveDescriptor?: unknown;
@@ -1,7 +1,7 @@
1
1
  {
2
- "auditedRevision": "18799337ec6b91e91a4b1577c0e31a7f1b575714",
3
- "auditedSchemaVersion": "2.0",
4
- "auditedContentHash": "e9870c0042e7cb2e76a66d10b0edc72056786e0a53ccb73dc417544c8753c8b2",
5
- "scope": "Unified kit schema 2.0: canonical content unchanged; Markdown MCP retrieval and JSON compatibility reviewed from 451be38f1fc33723cfe44eec12c1add689c5c52b. Prior 301-file survey and explicit clinical/native evidence limitations retained. Transport owning tests and both real MCP entry points verified; see evidence ledger.",
2
+ "auditedRevision": "cc1b675ed9431d047bd5fb34305abef1b9af18a8",
3
+ "auditedSchemaVersion": "2.2",
4
+ "auditedContentHash": "f31aadf37e8e371f55d83f9632933baa383259bfa8023b5d31bba29d08392e36",
5
+ "scope": "Kit schema 2.2 maintenance from 34d591eeab7fae22485546add54efe41106d756d through cc1b675ed9431d047bd5fb34305abef1b9af18a8. MV case authoring and wording-patch handoff; corrected provenance-independent flag storage. Complete changed-test/source delta reviewed in 737-739. Core 4,864 pass/32 skipped, actual MCP pass; extension 1,261 pass/3 expected failures. Scoped presentation emit parity and 19-case CRE comparison with installed 5.2.0 passed. Native final review converged; external final review exhausted its budget after prior findings were dispositioned. This stamp does not claim suite-aware MV/regression emission or new clinical/native verification. See evidence ledger.",
6
6
  "evidence": "packages/crl/src/authoring-kit/tests/coverage.md"
7
7
  }