Export fail: no attribute 'display_name'
Export failed with AttributeError in remapp/exports/export_common.py
in get_common_data
.
File "remapp/exports/mg_export.py", line 285, in exportMG2excel common_exam_data = get_common_data(u"MG", exam, pid=pid, name=name, patid=patid) File "remapp/exports/export_common.py", line 229, in get_common_data display_name = equipment_module.unique_equipment_name.display_name AttributeError: 'NoneType' object has no attribute 'display_name'
Somehow, one of the mammo studies being exported doesn't have a unique_equipment_name
entry, hence AttributeError
if you try to get the display_name
.
Comments (11)
-
reporter -
Do you think that the new "except" statement should also create an entry in the UniqueEquipmentNames table for the system that's missing an entry?
-
reporter Also failed with
File "remapp/exports/mg_export.py", line 293, in exportMG2excel series_data = _mg_get_series_data(series) File "remapp/exports/mg_export.py", line 153, in _mg_get_series_data filter_thicknesses, UnboundLocalError: local variable 'filter_thicknesses' referenced before assignment
Annoyingly, finding that line in the code using PyCharm, it is highlighted with the message:
Local variable 'filter_thicknesses' might be referenced before assignment more...
-
reporter @dplatten - just seen your comment. I was hoping that fixing the error would allow the export so I could see which study this was from and go from there.
I'm not sure how it doesn't already have an entry you see...!
I should probably have created a better log message too.
-
reporter Setting default values for filter_thicknesses. Refs
#675→ <<cset 70be45c4521b>>
-
reporter PEP8 tidying. Refs
#675→ <<cset 1d0ca85e7d55>>
-
reporter Adding accession number and study date to log message. Refs
#675→ <<cset 8daea3aa8131>>
-
reporter Updated changes for ref
#675[skip ci] docs only→ <<cset f7aa4fc7b452>>
-
reporter @dplatten. I can now see that the studies that were tripping the export up probably only have the generalstudymoduleattr table completed - so rather than creating the entry in the UniqueEquipmentNames table, we should instead be providing a facility to find these studies and present them to the administrator to delete and hopefully re-import (each in this example had the accession number).
It's not clear at this stage if it is the original RDSR is malformed in some way, or if the import was interrupted, or somehow got tripped up.
This ties in with issue ref
#479which we need to go back to :-) -
reporter - changed status to resolved
Merged in issue675exportfail (pull request #230)
Fixes
#675Approved-by: David Platten
→ <<cset 75c9c2956bad>>
-
reporter - changed milestone to 0.9.0
- Log in to comment
try-except for display name. Refs
#675→ <<cset be4a11a95d8a>>