Repository navigation
feat: add the DICOMweb JSON and dataset event sources - #532
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5 <[email protected]>
|
🎉 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.
Second engine slice: the two event sources that don't involve bytes. A "source" here is a generator function that walks some representation of a DICOM dataset and pushes the event-stream contract — the callback vocabulary from #530 — into a listener. Landing two non-byte sources now is what proves the contract is genuinely source-agnostic before the Part 10 byte reader arrives.
Both live in
src/eventStream/:fromDicomWebJson.jswalks DICOMweb JSON — the DICOM JSON model a DICOMweb server returns, an object keyed by tag with{ vr, Value }entries — and emits events. Values pass through as-is: Person Names stay{ Alphabetic }objects, numbers stay numbers. Canonicalizing values across sources is the naturalized listener's job in a later slice, not this one. Both binary forms are covered: aBulkDataURIentry becomes abulkDataReferenceevent without fetching anything, and anInlineBinaryentry is base64-decoded into a binary fragment.fromDataSet.jsdoes the same walk over an in-memory{ meta, dict }tree — the shapeDicomMessage.readFilereturns.They arrive as a pair because
fromDataSetborrows the base64 helper (base64ToArrayBuffer) from the JSON source, and each one's tests exercise the other. The deep-compare helper the tests share comes along too, intest/helper/equivalence.js.Here's the JSON path end to end, feeding the reference collector from #530:
fromDataSet(dataset, listener)works the same way from the other side. Both generatorsawait listener.awaitDrain()at top-level element boundaries, so the backpressure checkpoints from the contract actually get exercised.A note on size: this runs a little over the 500-line budget — about 830 authored lines — because splitting the pair would have landed code without its tests.
🤖 Generated with Claude Code