Skip to content

build(deps): move to @cosyte/hl7, fhir and x12 0.2 - #167

Merged
NSchatz merged 1 commit into
mainfrom
build/format-libraries-0-2
Nov 29, 2026
Merged

NSchatz merged 1 commit into
mainfrom
build/format-libraries-0-2

Conversation

@NSchatz

@NSchatz NSchatz commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

What

Moves Pathways onto @cosyte/hl7 0.2.0, @cosyte/fhir 0.2.0 and @cosyte/x12 0.2.0 (dependencies and lockfile). @cosyte/ccda stays on 0.1.

  • src/engine/worker-entry.ts: the structure finding codes are HL7_STRUCTURE_SEGMENT_CARDINALITY and HL7_STRUCTURE_SEGMENT_OUT_OF_ORDER, and the write refusal is HL7_ENCODE_UNENCODABLE_CHARACTER. writeHl7 returns Uint8Array, as toBytes is now typed. The FHIR decode returns parseResource's result itself, not its deprecated .resource (the same object).
  • src/connectors/batch.ts: the envelope check writes HL7_BATCH_COUNT_MISMATCH and HL7_BATCH_MISSING_TRAILER, the names the library gives the same warnings, so one batch never reports both spellings.
  • Doc comments, README.md, docs-content/ and the regenerated API page name the new codes. Every setField in the starter, the examples, the guides, the doc comments, the bench and the tests is now withField, its result returned.
  • examples/vet-lab-to-v2-xml: XML_GROUP_TABLES is empty in 0.2, so the transform carries its own ORU_R01 groups (REPORT, ORDER, RESULT), made up for the example as the library's own guide does, and fails a result that is not v2.5 as before. The expected outputs change in their group elements only; every field value is the same. The example's package ranges move to ^0.2.0.
  • test/equivalence/digests.json and pathways-test.json are written again for the outputs that moved (below).
  • A patch changeset with a What a caller must change: paragraph, and a README "In the next release" bullet.

Why

The 0.2 parsers prefix every code with their library's name, number a dot-path field repetition from 1, return new messages from edits, freeze their models, and ship no v2 XML group table. Pathways passes their codes through to logs, stored errors, ACK problems and pathways test, so those move with them.

Dot-paths: no field repetition index appears anywhere in src/, test/, examples/, templates/ or docs-content/. The only bracketed paths are segment occurrences (OBX[i].3.1, OBX[i].11), which still count from 0.

Proof

  • pnpm install (lockfile changes: hl7, fhir and x12 0.2.0, and their peers in mllp, synth and transform).
  • pnpm typecheck, pnpm lint, pnpm format:check, pnpm phi-scan, pnpm build, SKIP_INSTALL_SIMPLE_GIT_HOOKS=1 pnpm attw, pnpm check:no-emdash, pnpm check:no-internal-refs, pnpm check:claude-card, pnpm check:docs-reference, pnpm exec cosyte-release-pr: all pass.
  • pnpm test:coverage: 150 files pass, 4 skipped; 3077 tests pass; coverage 99.82 / 99.13 / 100 / 99.87.
  • With the bump and the src/ changes but the old tests, 32 tests in 11 files failed, each on an old code string, the XML_GROUP_TABLES lookup, or a moved digest. The updated test files run against main fail 82 tests in 19 files.
  • Output equivalence: we dumped every record the equivalence test digests, on main and on this branch, and compared them field by field. The only differences: codes gaining HL7_ or FHIR_, and the default ACK's ERR-3.2 for condition 207 reading "Application error" (hl7 0.2 took table 0357's text) where it read "Application internal error". The starter's edit through withField gives byte-identical outputs to setField.
  • pnpm bench (2000 messages, SQLite, a quiet machine): main 563 msg/s encryption off, 511 on; this branch 555 and 565 off, 525 and 523 on.

Left to CI: the database, Windows, macOS, SFTP, object store, compose and image jobs.

Choices

  • EnvelopeCheck now writes the library's prefixed names rather than keeping the unprefixed ones, so a batch's warnings use one spelling.
  • The v2 XML example's groups are made up and say so, as the library's guide does, rather than restating a published structure.
  • Tests, bench transforms and guides move to withField too, though setField still works in 0.2.
  • @cosyte/mllp (0.1.14 here, and 0.1.16, the latest) still declares @cosyte/hl7 ^0.1.5 as an optional peer; Pathways does not import its ack-from-hl7 entry, so pnpm only warns.

Bump the three parsers to 0.2, update every comparison to their prefixed
codes, move transforms, examples, guides and tests from setField to
withField, give the v2 XML example its own ORU_R01 groups now that the
library ships none, and record the moved outputs in the equivalence files.
C-CDA stays on 0.1.
@NSchatz
NSchatz merged commit 74f87c1 into main Nov 29, 2026
80 of 81 checks passed
@NSchatz
NSchatz deleted the build/format-libraries-0-2 branch November 29, 2026 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant