cda-schematron-validator 2.0.0-preview.1 → 2.0.0-preview.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/README.md +2 -2
- package/docs/architecture.md +1 -1
- package/docs/coverage.md +12 -0
- package/docs/terminology.md +75 -0
- package/package.json +1 -1
- package/validator.d.ts +2 -0
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
> [!NOTE]
|
|
20
|
-
> **Version 2
|
|
20
|
+
> **Version 2 preview.** The container includes the validation API and browser UI. The npm package includes the preserved legacy APIs, a typed HTTP client, and the CLI. Node 22.12+ is required. This is a preview while C-CDA 5.0 coverage gaps are addressed; npm’s stable default remains 1.1.12. See the [release notes](https://github.com/priyaranjan-tokachichu/cda-schematron-validator/releases) for artifacts and compatibility details.
|
|
21
21
|
|
|
22
22
|
<table>
|
|
23
23
|
<tr>
|
|
@@ -90,7 +90,7 @@ The legacy API remains a partial Schematron interpreter. Use the service for CDA
|
|
|
90
90
|
| **C-CDA 2.1** · `ccda-2.1` | `2025SEP`, with bundled vocabulary | CDA R2 + SDTC `20260205_SDTC` |
|
|
91
91
|
| **C-CDA 5.0** · `ccda-5.0` · default | `2026JUL` | CDA R2 + SDTC `20260205_SDTC` |
|
|
92
92
|
|
|
93
|
-
Sources are pinned by immutable release URL and SHA-256. The build verifies downloads; startup verifies extracted files. `GET /v1/profiles` exposes provenance, active limits, and known coverage gaps. [Inspect the source lock](profiles/sources.lock.json).
|
|
93
|
+
Sources are pinned by immutable release URL and SHA-256. The build verifies downloads; startup verifies extracted files. `GET /v1/profiles` exposes provenance, active limits, and known coverage gaps. [Inspect the source lock](profiles/sources.lock.json). [Coverage remediation and local terminology work](docs/coverage.md).
|
|
94
94
|
|
|
95
95
|
> [!IMPORTANT]
|
|
96
96
|
> **C-CDA 5.0 has known upstream conversion gaps:** 4 generation errors, 6 unhandled invariants across 4 categories, and 28 non-loaded value-set entries across 9 categories. Its embedded value-set expansions cover sets with fewer than 1,000 concepts. The service reports incomplete coverage even when execution succeeds. A supported document-level template is required for complete document validation; nested templates alone are insufficient.
|
package/docs/architecture.md
CHANGED
|
@@ -15,7 +15,7 @@ flowchart LR
|
|
|
15
15
|
G --> H[Findings and coverage report]
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
Java 21+ hosts the HTTP adapter and validation engine. Saxon-HE 12.9 executes XSLT compiled from the pinned Schematron using SchXslt 1.10.1. The JDK XML Schema validator checks the pinned CDA schema; Gson serializes JSON reports. No database or application framework is required.
|
|
18
|
+
Java 21+ hosts the HTTP adapter and validation engine. Saxon-HE 12.9 executes XSLT compiled from the pinned Schematron using SchXslt 1.10.1. The JDK XML Schema validator checks the pinned CDA schema; Gson serializes JSON reports. No database or application framework is required. Reviewed local supplements run inside the compiled Schematron. An optional offline membership index answers exact code-system/code lookups from a checksum-pinned local pack; it does not perform terminology network calls or load whole patient documents into a shared cache. See [local terminology snapshots](terminology.md).
|
|
19
19
|
|
|
20
20
|
The browser uses HTML, CSS, and JavaScript. The original JavaScript library remains independent of Java; the new Node client communicates with the service over HTTP/JSON. Python scripts prepare assets, check upstream releases, benchmark, verify, and generate the HTML report.
|
|
21
21
|
|
package/docs/coverage.md
CHANGED
|
@@ -8,6 +8,18 @@ This inventory is derived from the checksum-pinned `2026JUL/CCDA-5.0-Results.jso
|
|
|
8
8
|
|
|
9
9
|
The earlier summary of 4 invariants and 9 value sets counted categories and understated the omissions. This preview corrects the accounting; it does not turn missing checks into passes.
|
|
10
10
|
|
|
11
|
+
## Local person-name check (follow-up to preview.1)
|
|
12
|
+
|
|
13
|
+
The local `81-9371` supplement reuses all 11 assertions in the pinned patient-name Schematron profile at the person-name locations, with the permitted plain-text alternative. List-valued use and qualifier attributes are checked token by token against complete vocabulary codes. This adds the missing given/family cardinality, suffix, use, qualifier, and mixed-content checks at those locations. The existing `81-9372` prohibition on mixing text and name parts still runs.
|
|
14
|
+
|
|
15
|
+
The check is layered onto the in-memory compilation input. Original downloaded files and the upstream generation report remain unchanged. Profile metadata lists the added rule in `supplementalChecks`; the application still reports incomplete C-CDA 5.0 coverage. This is reuse of the pinned Schematron constraints, not a general FHIR `conformsTo()` implementation.
|
|
16
|
+
|
|
17
|
+
Tests exercise valid fielded names, plain strings, null flavors, missing/duplicate name parts, multiple suffixes, invalid use/qualifier values, mixed content, and rejection of an unexpected upstream profile layout. This change is separate from the published preview.1 artifact and requires review before inclusion in a later release.
|
|
18
|
+
|
|
19
|
+
## Local procedure checks and recovered data
|
|
20
|
+
|
|
21
|
+
The optional [offline terminology adapter](terminology.md) restores `1198-8487` and `1198-8511` when a reviewed Procedure snapshot is installed. It checks exact SNOMED CT code/system membership and preserves the original alternative code systems. Other recovered expansions are not counted as implemented binding checks simply because their data are now available.
|
|
22
|
+
|
|
11
23
|
## Rule-conversion work
|
|
12
24
|
|
|
13
25
|
| Invariant | Template | Why omitted | Required fix and verification |
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Local terminology snapshots
|
|
2
|
+
|
|
3
|
+
[← Coverage inventory](coverage.md) · [Deployment](deployment.md)
|
|
4
|
+
|
|
5
|
+
This is development work following `2.0.0-preview.1`; the published preview.1 image does not contain this adapter. The public distribution does not include the operator's licensed terminology exports.
|
|
6
|
+
|
|
7
|
+
## What this adapter checks
|
|
8
|
+
|
|
9
|
+
When a reviewed Procedure expansion is installed, the service restores the omitted `1198-8487` and `1198-8511` checks at the operative-note and procedure-note service-event code locations. It preserves the invariant's ICD-9-CM procedure, ICD-10-PCS, and CPT alternatives, and the additional HCPCS alternative for procedure notes. SNOMED CT membership uses an exact code-system/code pair, with no substring matching.
|
|
10
|
+
|
|
11
|
+
The supplied expansion is a frozen local snapshot. Its code-system versions, definition revision, source status, retrieval time, original export checksum, normalized checksum, and concept count appear in `terminologySnapshots`. Only the Procedure index currently has `activeForValidation: true`; other imported snapshots are verified and disclosed without being represented as implemented binding coverage. Their indexes are not retained in memory.
|
|
12
|
+
|
|
13
|
+
The person-name supplement separately reapplies the pinned patient-name constraints at person-name locations, preserving the allowed plain-text alternative. `supplementalChecks` identifies the added checks. The original upstream report and counts are retained. **C-CDA 5.0 completeness remains false:** remaining date, location, generation, and terminology gaps have not been cleared.
|
|
14
|
+
|
|
15
|
+
## Prepare a local pack
|
|
16
|
+
|
|
17
|
+
1. Export the required expansions as XML from an authorized [VSAC session](https://vsac.nlm.nih.gov/). Include retired sets only when the pinned guide references them, and retain their status for review.
|
|
18
|
+
2. Record each displayed full code count in a local JSON checklist. For example:
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
[
|
|
22
|
+
{ "oid": "2.16.840.1.113883.3.88.12.80.28", "expectedCount": 62110 }
|
|
23
|
+
]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This is the count observed for the downloaded snapshot, not a permanent count to assume for future exports. Record and review the actual count for your selected version.
|
|
27
|
+
|
|
28
|
+
3. Import the checked exports after preparing the standard assets:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npm run assets
|
|
32
|
+
python3 scripts/import-svs.py \
|
|
33
|
+
--input-glob '/private/path/RetrieveMultipleValueSets*.xml' \
|
|
34
|
+
--expected /private/path/expected-counts.json \
|
|
35
|
+
--output service/assets/terminology
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The importer rejects empty, duplicate, conflicting, entity-bearing, incomplete, and count-mismatched exports. All reviewed OIDs must be present. It validates all inputs before changing the manifest and uses content-addressed data filenames. Original XML files are not copied into the public package.
|
|
39
|
+
|
|
40
|
+
`service/assets/` and `.cache/` are ignored by Git and excluded from the Docker build context. The normal multi-stage image prepares only the pinned public validation assets; it does not copy this local pack. Keep exports outside Git and apply the terms of each terminology source to any redistribution.
|
|
41
|
+
|
|
42
|
+
## Run the development image with the local pack
|
|
43
|
+
|
|
44
|
+
Build the reviewed development checkout, then use a read-only asset mount. The following uses a separate local port so an installed release can remain running:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
docker build -t cda-validator:coverage-review .
|
|
48
|
+
docker run -d --name cda-validator-coverage \
|
|
49
|
+
--memory=1536m --cpus=2 --pids-limit=128 \
|
|
50
|
+
--read-only --tmpfs /tmp:size=64m,noexec,nosuid \
|
|
51
|
+
--cap-drop=ALL --security-opt=no-new-privileges \
|
|
52
|
+
-e JAVA_TOOL_OPTIONS=-Xmx1g \
|
|
53
|
+
-p 127.0.0.1:17644:17643 \
|
|
54
|
+
--mount "type=bind,source=$PWD/service/assets,target=/app/assets,readonly" \
|
|
55
|
+
cda-validator:coverage-review
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Open `http://localhost:17644`. The service verifies the normalized file hashes and exact counts before accepting the pack. The parser is strict, paths must remain inside the trusted asset directory, total normalized files are bounded to 64 MiB, and the pack is bounded to 1,000,000 concept entries. Loading additional data alone does not turn completeness into a pass. There are no terminology network calls during validation and submitted clinical documents never enter a download request.
|
|
59
|
+
|
|
60
|
+
More heap/container memory can support larger deployments; use the existing [capacity guidance](deployment.md#increase-concurrent-large-upload-capacity). The constrained-heap regression can also exercise a local pack:
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
python3 scripts/check-upload-memory.py \
|
|
64
|
+
--image cda-validator:coverage-review \
|
|
65
|
+
--assets-dir service/assets \
|
|
66
|
+
--output .cache/upload-memory-with-terminology.json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Data recovered during this work
|
|
70
|
+
|
|
71
|
+
The authorized local VSAC exports contain 20 expansions and 383,629 total membership entries. Nineteen match VSAC canonicals in the upstream omission report; the additional occupational candidate is kept distinct from the PHINVADS canonical. These data are local and are not committed or published. Two exported sets are marked retired, and remain inactive in the adapter.
|
|
72
|
+
|
|
73
|
+
The published C-CDA 5.0 FHIR package declares dependencies on `us.cdc.phinvads#0.12.0`, `hl7.fhir.us.core#9.0.0`, and `hl7.terminology.r5#7.1.0`. The CDC package includes the explicit occupational lists of 19,254 and 59,583 concepts that the generator excluded. Those definitions were recovered separately; their PHINVADS identities are not silently replaced with similarly numbered VSAC data. A downloaded UMLS archive is a resource for further source-specific work, not an executable complete value-set validator by itself.
|
|
74
|
+
|
|
75
|
+
Further binding integration, grammar-based language/UCUM checks, source-system mappings, and independent validation comparisons remain necessary. This adapter currently enables only the two procedure invariants described above.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cda-schematron-validator",
|
|
3
|
-
"version": "2.0.0-preview.
|
|
3
|
+
"version": "2.0.0-preview.2",
|
|
4
4
|
"description": "Self-hosted CDA validation API and UI with pinned HL7 profiles, detailed findings, and a compatible legacy Schematron API.",
|
|
5
5
|
"main": "validator.js",
|
|
6
6
|
"scripts": {
|
package/validator.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ export interface Profile {
|
|
|
47
47
|
artifactChecksums: Record<string, string>;
|
|
48
48
|
generationCoverage?: Record<string, number>;
|
|
49
49
|
generationReport?: Record<string, unknown>;
|
|
50
|
+
terminologySnapshots?: Array<Record<string, unknown>>;
|
|
51
|
+
supplementalChecks?: Array<{ ruleId: string; method: string; scope: string }>;
|
|
50
52
|
}
|
|
51
53
|
export interface Finding {
|
|
52
54
|
messageTruncated?: boolean;
|