Export fail: no attribute 'display_name'

Issue #675 resolved
Ed McDonagh created an issue

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)

  1. David Platten

    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?

  2. Ed McDonagh 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...

  3. Ed McDonagh 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.

  4. Ed McDonagh 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 #479 which we need to go back to :-)

  5. Log in to comment