remapp.netdicom.qrscu.qrscu ValueError("invalid literal for int() with base 10: ''",)

Issue #734 resolved
Rob Ireland created an issue

I am using OpenREM 0.9.0, Python 2.7.15, Celery 3.1.25, Erlang 21.2, RabbitMQ 3.7.12 with PostgreSQL and ORTHANC. I am running the RabbitMQ admin page and Flower. On Windows 10.

Both local store and remote nodes are responding to DICOM echos.

When attempting to QR from PACS I get the following reproducible error log from celery

[2019-03-14 16:27:18,980: INFO/Worker-1] Association response received
[2019-03-14 16:28:00,773: ERROR/MainProcess] Task remapp.netdicom.qrscu.qrscu[41d0cb11-e38f-44ca-8ec4-5ad093560623] raised unexpected: ValueError("invalid literal for int() with base 10: ''",)
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\netdicom\qrscu.py", line 968, in qrscu
    assoc, query, all_mods, filters, get_toshiba_images)
  File "c:\python27\lib\site-packages\openrem\remapp\netdicom\qrscu.py", line 256, in _prune_series_responses
    sr_type = _check_sr_type_in_study(assoc, study, query.query_id)
  File "c:\python27\lib\site-packages\openrem\remapp\netdicom\qrscu.py", line 421, in _check_sr_type_in_study
    _query_images(assoc, sr, query_id)
  File "c:\python27\lib\site-packages\openrem\remapp\netdicom\qrscu.py", line 502, in _query_images
    imagesrsp.save()
  File "c:\python27\lib\site-packages\django\db\models\base.py", line 734, in save
    force_update=force_update, update_fields=update_fields)
  File "c:\python27\lib\site-packages\django\db\models\base.py", line 762, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "c:\python27\lib\site-packages\django\db\models\base.py", line 827, in _save_table
    forced_update)
  File "c:\python27\lib\site-packages\django\db\models\base.py", line 877, in _do_update
    return filtered._update(values) > 0
  File "c:\python27\lib\site-packages\django\db\models\query.py", line 580, in _update
    return query.get_compiler(self.db).execute_sql(CURSOR)
  File "c:\python27\lib\site-packages\django\db\models\sql\compiler.py", line 1062, in execute_sql
    cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
  File "c:\python27\lib\site-packages\django\db\models\sql\compiler.py", line 829, in execute_sql
    sql, params = self.as_sql()
  File "c:\python27\lib\site-packages\django\db\models\sql\compiler.py", line 1030, in as_sql
    val = field.get_db_prep_save(val, connection=self.connection)
  File "c:\python27\lib\site-packages\django\db\models\fields\__init__.py", line 710, in get_db_prep_save
    prepared=False)
  File "c:\python27\lib\site-packages\django\db\models\fields\__init__.py", line 702, in get_db_prep_value
    value = self.get_prep_value(value)
  File "c:\python27\lib\site-packages\django\db\models\fields\__init__.py", line 1869, in get_prep_value
    return int(value)
ValueError: invalid literal for int() with base 10: ''

And this from the QR log

[14/Mar/2019 16:27:18] DEBUG [remapp.netdicom.qrscu:420] Form mods are [u'CT'], inc_sr is False
[14/Mar/2019 16:27:18] DEBUG [remapp.netdicom.qrscu:421] All form modes are {'get_toshiba_images_field': False, 'stationname_include_field': u'', 'desc_exclude_field': u'', 'date_from_field': datetime.date(2019, 3, 14), 'store_scp_field': u'2', 'stationname_exclude_field': u'', 'duplicates_field': True, 'date_until_field': datetime.date(2019, 3, 14), 'desc_include_field': u'', 'modality_field': [u'CT'], 'inc_sr_field': False, 'remote_host_field': u'1'}
[14/Mar/2019 16:27:18] INFO [remapp.netdicom.qrscu:645] 5a212c0e-8579-4667-8ed3-8c82cbe7e231: Request association with {'Port': ***, 'AET': '****', 'Address': '**.***.**.***'} (10.175.73.127 105 from <AE(ORTHANC, stopped daemon 16308)>)
[14/Mar/2019 16:27:19] INFO [remapp.netdicom.qrscu:839] 5a212c0e-8579-4667-8ed3-8c82cbe7e231 DICOM Echo ... 
[14/Mar/2019 16:27:19] INFO [remapp.netdicom.qrscu:849] 5a212c0e-8579-4667-8ed3-8c82cbe7e231 DICOM FindSCU ... 
[14/Mar/2019 16:27:19] INFO [remapp.netdicom.qrscu:691] 5a212c0e-8579-4667-8ed3-8c82cbe7e231 Currently querying for CT studies...
[14/Mar/2019 16:27:21] INFO [remapp.netdicom.qrscu:885] 5a212c0e-8579-4667-8ed3-8c82cbe7e231 86 studies returned, will now process to remove studies that are not useful.
[14/Mar/2019 16:27:21] INFO [remapp.netdicom.qrscu:914] 5a212c0e-8579-4667-8ed3-8c82cbe7e231 Pruning study responses based on inc/exc options: 
[14/Mar/2019 16:27:22] INFO [remapp.netdicom.qrscu:921] 5a212c0e-8579-4667-8ed3-8c82cbe7e231 Pruning studies based on inc/exc has removed 0 studies, 86 studies remain.
[14/Mar/2019 16:27:22] INFO [remapp.netdicom.qrscu:925] 5a212c0e-8579-4667-8ed3-8c82cbe7e231 Querying at series level to get more details about studies
[14/Mar/2019 16:28:00] INFO [remapp.netdicom.qrscu:168] 5a212c0e-8579-4667-8ed3-8c82cbe7e231 Getting series and image level information and deleting series we can't use

Thanks for your help, Rob

Comments (8)

  1. Ed McDonagh

    Thanks Rob, that's perfect. I'll take a look this evening to see what might be triggering it.

    I'm surprised there isn't more information in the QR log in DEBUG mode - have you just copied pertinent lines?

    However, I think I probably have what I need to get started.

    Ed

  2. Ed McDonagh

    @Rob Ireland - As you suspected, it was the same error but in a different function.

    I have now implemented the same fix as for issue #708. Would you be able to check it? It might be easiest to replace lines 497 and 498 of qrscu.py as per commit be202a7b533c, then restart Celery and try the query again.

    Also, could you tell us which PACS you are querying against when you get this error?

    Thanks

    Ed

  3. Rob Ireland reporter

    Thanks Ed. That's done the trick. We are using Insignia Medical Systems, Insight PACS by the way. Thanks for such a quick response.

  4. Log in to comment