BUG: fix infer_contrast for missing ContrastBolusAgent tag#85
BUG: fix infer_contrast for missing ContrastBolusAgent tag#85Ivan-E-Johnson wants to merge 3 commits into
Conversation
This function worked (and validated by a test) when ContrastBolusAgent tag existed and had the value of "NONE". However, if the tag never existed in the source it's value would be set to -12345 during sanitation. This would cause all series without the tag present to be infered as having contrast. Add a check for the default value and a test to validate functionality. The test file is a copy of the existing test file with the ContrastBolusAgent tag removed and UIDs changed. The integration test reference file was changed to reflect the correct result.
…sanitization layer The previous fix checked for the sentinel value "-12345" in infer_contrast(), but this left the raw sentinel flowing through the rest of the system. Instead, add "-12345" to the no_contrast_list in get_coded_dictionary_elements() so missing tags are normalized to "None" before reaching any downstream code. Regenerated the integration test baseline to match the corrected output.
a26a83d to
5e7f5d1
Compare
|
I'm not actually sure why this is passing Actions now. Nothing should have changed to affect the failed test in my PR, and it is still failing locally for me. Would be interested to see if anyone can replicate it if they have a Ubuntu 24 machine/VM handy.
|
Thanks @ChanceSauley we will investigate and run the testing on Ubuntu this Friday. |
|
@Ivan-E-Johnson, on which OS was this generated? Based on @ChanceSauley most recent PR (#86) which is failing in a similar I area I believe, we may need to update this test to work across platforms. |

Summary
ContrastBolusAgenttag were incorrectly classified as having contrast"-12345"(the sentinel for missing optional fields) to theno_contrast_listinget_coded_dictionary_elements()(utility_functions.py) so the value is normalized to"None"at the sanitization layer rather than patched downstream ininfer_contrast()infer_contrast()since it is no longer neededoutput.jsonto match the corrected outputTest plan
test_dcm_series_no_contrast— verifies series with no contrast tag returnsFalsetest_dcm_series_has_contrast— verifies series with a real contrast agent still returnsTruetest_classify_study_json— integration test comparing full JSON output against regenerated baselinepython3 -Werror::FutureWarning -m pytest tests— 81 passed, 3 skippedNotes
Builds on the original work from PR #84 by @ChanceSauley, including the new
no_contrastbolusagent_tag.dcmtest file and improved assertion message intest_dcm_series_no_contrast.🤖 Generated with Claude Code