Since this instance is missing ContentSequence, the remaining functions in this file assume it's present and basically it all falls apart from here.
I'd recommend updating...
const toArray = function (x) {
...to provide both a type and null check on the x so that we don't add a null or undefined value to array
I'd also add some validation and typing FP work in _mapLegacyDataSet(dataset) so that it returns a new dataset with all expected properties and not a mutated one.
codeMeaningEquals is a powerhouse comparator and again could benefit from a null and type check on the contentItem; and splash in some nullish coalescing on contentItem.ConceptNameCodeSequence.CodeMeaning === codeMeaningName; for good measure!
Steps to Reproduce
the instance is missing the property ContentSequence
The current behavior
it crashes the Viewer with this error:
Cannot read properties of undefined (reading 'ConceptNameCodeSequence')
Describe the Bug
This is very low priority issue and it may be related to old data that is missing certain critical properties.
tdlr; if you encounter this issue, try changing your test dataset
My issue happens in the hydrateStructuredReport.ts when it attempt to set the
instance
I can log and see that
instance
has this shapeSince this instance is missing
ContentSequence
, the remaining functions in this file assume it's present and basically it all falls apart from here.I'd recommend updating...
const toArray = function (x) {
...to provide both a type and null check on the x so that we don't add a null or undefined value to array
I'd also add some validation and typing FP work in
_mapLegacyDataSet(dataset)
so that it returns a new dataset with all expected properties and not a mutated one.codeMeaningEquals
is a powerhouse comparator and again could benefit from a null and type check on thecontentItem
; and splash in some nullish coalescing oncontentItem.ConceptNameCodeSequence.CodeMeaning === codeMeaningName;
for good measure!Steps to Reproduce
the instance is missing the property ContentSequence
The current behavior
it crashes the Viewer with this error:
Cannot read properties of undefined (reading 'ConceptNameCodeSequence')
The expected behavior
The Viewer should appear
OS
macOS 14.6
Node version
20.12.2
Browser
Chrome 126