Repository navigation
feat(eventStream): collector-backed writer sinks — Part10Writer and DicomWebJsonWriter - #553
Merged
Merged
Conversation
…icomWebJsonWriter Ports the two collector-backed sinks from the v2 rewrite: Part10Writer (events -> Part 10 bytes via CollectorListener + DicomDict.write) and DicomWebJsonWriter (events -> DICOMweb JSON model). Both source files are verbatim v2 ports; the index exports are added by hand. Tests travel with the port, reworked for this branch's fixture layout, with the deflate fixtures skip-listed on the write round-trip until deflate-on-write lands. Co-Authored-By: Claude Fable 5 <[email protected]>
This was referenced Sep 30, 2026
|
🎉 This PR is included in version 1.0.0-beta.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This lands the first two writer sinks, making the event-stream contract a two-way street. Until now the contract only read: bytes, dicts, or DICOMweb JSON in — events out. These two listeners are the other direction: events in, serialized output out.
Part10Writerproduces Part 10 bytes, andDicomWebJsonWriterproduces the DICOMweb JSON metadata model. With them merged, any source can be re-serialized to either format, and DICOMweb JSON round-trips through the contract as an identity.Both are deliberately thin.
Part10Writeris a 36-line layer over the canonical encoder, not a second encoder: it extendsCollectorListenerto gather the events into a tag-keyed{ meta, dict }tree, then delegates every byte of serialization — VRs, undefined-length sequences, padding, group-length recompute — to the provenDicomDict.write().DicomWebJsonWriterwalks the events with a small container stack and emits{ vr, Value }/{ BulkDataURI }/{ InlineBinary }attributes, preserving the binary source form (a bulk reference stays a reference; assembled fragments become base64) and using the PS3.18 escape hatch of string-encoding DS/IS values whose numeric form would silently lose integer precision.To be plain about provenance, since this is a port from the v2 rewrite branch: both source files are verbatim v2 code. The hand-written parts are the
index.jsexports (core's index is ahead of v2's, so those are added by hand rather than copied) and three adaptations in the ported tests. The fixture paths moved to this branch's layout (packages/fixtures/...). One v2 test drove the writer through theDicomEventStream.toPart10()facade, which is a later slice here, so the same minimal write is exercised through the listener directly. And the corpus round-trip gate — every vendored fixture read to events, written back to Part 10, re-read, and compared naturalized-object to naturalized-object — skip-lists the three deflate fixtures on the write side only, with a comment explaining why: this branch'sDicomDict.writedoes not yet implement deflate-on-write (that is the W4 slice of the writers wave), so it would emit an uncompressed body under the deflated transfer syntax. The skip entries name the files explicitly and come out when W4 lands.Using the pair looks like this:
33 new tests, 659 passing overall on this branch.
🤖 Generated with Claude Code