Patient size import fails if broken study found

Issue #676 resolved
Ed McDonagh created an issue

Import fails with PatientStudyModuleAttr without any useful message if the study it is targeting is malformed.

Comments (8)

  1. Ed McDonagh reporter
    [2018-10-11 09:50:03,938: ERROR/ForkPoolWorker-3] Task remapp.extractors.ptsizecsv2db.websizeimport[86b5514c-f212-4e42-a758-c29fdd7af487] raised u
    nexpected: DoesNotExist('PatientStudyModuleAttr matching query does not exist.',)
    Traceback (most recent call last):
      File "/var/dose/veopenrem/local/lib/python2.7/site-packages/celery/app/trace.py", line 382, in trace_task
        R = retval = fun(*args, **kwargs)
      File "/var/dose/veopenrem/local/lib/python2.7/site-packages/celery/app/trace.py", line 641, in __protected_call__
        return self.run(*args, **kwargs)
      File "remapp/extractors/ptsizecsv2db.py", line 171, in websizeimport
        imp_log = l)
      File "remapp/extractors/ptsizecsv2db.py", line 102, in _ptsizeinsert
        _patientstudymoduleattributes(exam, height, weight, verbose, csvrecord, imp_log = imp_log)
      File "remapp/extractors/ptsizecsv2db.py", line 40, in _patientstudymoduleattributes
        patientatt = exam.patientstudymoduleattr_set.get()
      File "/var/dose/veopenrem/local/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method
        return getattr(self.get_queryset(), name)(*args, **kwargs)
      File "/var/dose/veopenrem/local/lib/python2.7/site-packages/django/db/models/query.py", line 334, in get
        self.model._meta.object_name
    Exception: PatientStudyModuleAttr matching query does not exist.
    
  2. Ed McDonagh reporter

    Added try:except for failed import studies refs #676, removed unused argument, lots of PEP8 style changes. Could really do with some love...

    → <<cset ae9da6d97bc2>>

  3. Ed McDonagh reporter

    Added logging of error to import log file and terminal sa necessary. Converted all print statements to Python3. Removed white space. Refs #676

    → <<cset 3a1380611942>>

  4. Log in to comment