List index out of range error (possibly caused by DR exposures with no DAP?)
Hi,
We’ve been seeing the following error appearing occasionally in our OpenREM log files at University Hospital Southampton NHS Foundation Trust:
[2022-10-13 10:37:00,904: ERROR/MainProcess] Task remapp.extractors.rdsr.rdsr[a6d0f1f9-1ae0-48e1-83f9-937a2e9f87e2] raised unexpected: IndexError('list index out of range',)
Traceback (most recent call last):
File ""c:\python27\lib\site-packages\celery\app\trace.py"", line 240, in trace_task
R = retval = fun(*args, **kwargs)
File ""c:\python27\lib\site-packages\celery\app\trace.py"", line 438, in __protected_call__
return self.run(*args, **kwargs)
File ""c:\python27\lib\site-packages\openrem\remapp\extractors\rdsr.py"", line 1658, in rdsr
_rdsr2db(dataset)
File ""c:\python27\lib\site-packages\openrem\remapp\extractors\rdsr.py"", line 1513, in _rdsr2db
_generalstudymoduleattributes(dataset, g, ch)
File ""c:\python27\lib\site-packages\openrem\remapp\extractors\rdsr.py"", line 1349, in _generalstudymoduleattributes
_projectionxrayradiationdose(dataset, g, 'projection', ch)
File ""c:\python27\lib\site-packages\openrem\remapp\extractors\rdsr.py"", line 1111, in _projectionxrayradiationdose
_irradiationeventxraydata(cont, proj, ch, dataset)
File ""c:\python27\lib\site-packages\openrem\remapp\extractors\rdsr.py"", line 612, in _irradiationeventxraydata
event.dose_area_product = _check_dap_units(cont.MeasuredValueSequence[0])
IndexError: list index out of range
When checking a few of the offending RSDRs that are causing the errors, we see that they are for DR exams where at least one exposure has no Dose Area Product recorded (opening the RSDRs in microDicom displays ‘empty’ for that field). They also all seem to be paeds exams and/or extremity exams, usually with very low DAPs recorded for the other exposures in the exam.
Is this likely to be an issue with the RSDRs sent by these units (i.e. they should have a DAP value for all exposures even if it is zero?) or OpenREM's handling of these exposures?
best wishes,
Xanthe Hoad
Comments (14)
-
-
- changed milestone to 1.0.0
-
reporter Hi Ed,
This is indeed for a Projection X-ray event. Thanks, that's really helpful so we can start to explore if there's an issue with the RSDRs/X-ray units themselves (some of our units recently had software updates).
I'll look into us simulating the issue or anonymising an existing RSDR to send to you.
best wishes, Xanthe
-
reporter Hi Ed,
Looks from the standard that Dose Area Product is a Mandatory for Projection X-rays as you say (https://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_TID_10003.html and https://dicom.nema.org/medical/dicom/current/output/html/part16.html#sect_6.1.7). It is allowed to have an empty Measured Value Sequence if there has been a numerical failure of some kind (https://dicom.nema.org/medical/dicom/current/output/html/part16.html#sect_6.1.7.1).
I’ve attached some anonymised RSDRs which triggered the error.
best wishes, Xanthe
-
reporter - attached OpenREM_debug_anon.zip
<div class="preview-container wiki-content"><!-- loaded via ajax --></div> <div class="mask"></div> </div>
</div> </form>
-
Adding test file and basic test for issue ref
#955. Test should fail.→ <<cset 735f87b200eb>>
-
Fix for issue ref
#955. Test should pass.→ <<cset 156861fd20db>>
-
Forgot to run black. Now done. Refs
#955→ <<cset b1c634419e89>>
-
Updating sonarcloud versions. Doesn't really ref
#955→ <<cset 8a36997c7a73>>
-
- changed status to resolved
-
Hi @Xanthe.Hoad I’ve merged the fix for this into the development version - thank you so much for the bug report and the example RDSRs.
To make the same changes on your installed version whilst you wait for the 1.0 release, you can make the changes seen here in commit 156861fd20db to the equivalent line in the 0.10 file rdsr.py line 612. If you do, you’ll need to restart Celery (or restart the server) for the changes to take effect.
Thanks again.
Ed
-
reporter Thanks so much Ed - we'll make the change
best wishes, Xanthe
-
reporter Hi Ed,
Just to let you know we’ve implemented the change and OpenREM has been running happily ever since.
best wishes,
Xanthe
-
Thanks for the feedback Xanthe!
- Log in to comment
Hi Xanthe.
If the event is for a “Projection X-Ray” RDSR (as opposed to a mammography one), then it is mandatory to have the Dose Area Product numeric sequence. I am not sure if it is allowed to be there, but without a MeasuredValueSequence element, so I don’t know if the RDSRs are ‘legal’.
What I do know is that the code in 0.10 and in the current develop doesn’t handle the situation where the MeasuredValueSequence isn’t there, and we can fix that.
Is there any possibility you can simulate the issue with test exposures so you can send me an example RDSR without any patient information? That would be really useful to be able to test the fix.