RDSR extractor doesn't populate summary total_dlp

Issue #778 resolved
Ed McDonagh created an issue

No .save() after the total_dlp is populated, so it doesn’t get saved.

Need to add tests for this and all the other fields, including for values that are built up over several image extracts.

Refs #759

Comments (21)

  1. David Platten

    I’ve just tried running these tests using python manage.py test. They failed. Did I run the correct command, and should they all have passed?

  2. David Platten

    I suspect that it’s an issue with my local install. The errors are:

    Testing started at 11:33 ...
    C:\pythonVirtualEnvs\openrem-dev\Scripts\python.exe C:\Apps\JetBrains\Toolbox\apps\PyCharm-P\ch-0\192.6817.19\helpers\pycharm\django_test_manage.py test remapp.tests C:\pythonVirtualEnvs\openrem-dev\Lib\site-packages\openrem
    Creating test database for alias 'default'...

    Failure
    Traceback (most recent call last):
    File "C:\pythonVirtualEnvs\openrem-dev\Lib\site-packages\openrem\remapp\tests\test_import_ct_rdsr_multiple.py", line 175, in test_import_ct_rdsr_continued
    u"Will not import.".format(study_uid, uid_2)))
    File "C:\pythonVirtualEnvs\openrem-dev\lib\site-packages\testfixtures\logcapture.py", line 223, in check_present
    recursive=self.recursive_check)
    File "C:\pythonVirtualEnvs\openrem-dev\lib\site-packages\testfixtures\comparison.py", line 574, in compare
    raise AssertionError(message)
    AssertionError: sequence not as expected:

    same:
    ()

    expected:
    (('remapp.extractors.rdsr',
    'DEBUG',
    u'Import match on Study Instance UID 1.3.6.1.4.1.5962.99.1.64928122.996247427.1524778350970.5.0 and object SOP Instance UID 1.3.6.1.4.1.5962.99.1.64928122.996247427.1524778350970.13.0. Will not import.'),)

    actual:
    ()

    Failure
    Traceback (most recent call last):
    File "C:\pythonVirtualEnvs\openrem-dev\Lib\site-packages\openrem\remapp\tests\test_import_ct_rdsr_multiple.py", line 110, in test_import_ct_rdsr_mulitple
    u"Will not import.".format(study_uid, new_sop_instance_uid)))
    File "C:\pythonVirtualEnvs\openrem-dev\lib\site-packages\testfixtures\logcapture.py", line 223, in check_present
    recursive=self.recursive_check)
    File "C:\pythonVirtualEnvs\openrem-dev\lib\site-packages\testfixtures\comparison.py", line 574, in compare
    raise AssertionError(message)
    AssertionError: sequence not as expected:

    same:
    ()

    expected:
    (('remapp.extractors.rdsr',
    'DEBUG',
    u'Import match on Study Instance UID 1.3.6.1.4.1.5962.99.1.792239193.1702185591.1516915727449.3.0 and object SOP Instance UID 1.3.6.1.4.1.5962.99.1.792239193.1702185591.1516915727449.11.0. Will not import.'),)

    actual:
    ()

    Failure
    Traceback (most recent call last):
    File "C:\pythonVirtualEnvs\openrem-dev\Lib\site-packages\openrem\remapp\tests\test_import_dx.py", line 125, in test_dr7500_and_xr220
    u'DX instance UID 1.3.6.1.4.1.5962.99.1.2282339064.1266597797.1479751121656.26.0 of '
    File "C:\pythonVirtualEnvs\openrem-dev\lib\site-packages\testfixtures\logcapture.py", line 223, in check_present
    recursive=self.recursive_check)
    File "C:\pythonVirtualEnvs\openrem-dev\lib\site-packages\testfixtures\comparison.py", line 574, in compare
    raise AssertionError(message)
    AssertionError: sequence not as expected:

    same:
    ()

    expected:
    ((u'remapp.extractors.dx',
    u'DEBUG',
    u'DX instance UID 1.3.6.1.4.1.5962.99.1.2282339064.1266597797.1479751121656.26.0 of study UID 1.3.6.1.4.1.5962.99.1.2282339064.1266597797.1479751121656.24.0 previously processed, stopping.'),)

    actual:
    ()

    Failure
    Traceback (most recent call last):
    File "C:\pythonVirtualEnvs\openrem-dev\Lib\site-packages\openrem\remapp\tests\test_import_dx.py", line 460, in test_duplicate_study_dx
    u'into.'.format(study_1_pk))
    File "C:\pythonVirtualEnvs\openrem-dev\lib\site-packages\testfixtures\logcapture.py", line 223, in check_present
    recursive=self.recursive_check)
    File "C:\pythonVirtualEnvs\openrem-dev\lib\site-packages\testfixtures\comparison.py", line 574, in compare
    raise AssertionError(message)
    AssertionError: sequence not as expected:

    same:
    ((u'remapp.extractors.dx',
    u'WARNING',
    u'Duplicate DX study UID 1.3.6.1.4.1.5962.99.1.2282339064.1266597797.1479751121656.24.0 in database - could be a problem! There are 2 copies.'),)

    expected:
    ((u'remapp.extractors.dx',
    u'DEBUG',
    u'Duplicate DX study UID 1.3.6.1.4.1.5962.99.1.2282339064.1266597797.1479751121656.24.0 - first instance (pk=151) with modality type assigned (DX) selected to import new event into.'),)

    actual:
    ()

    Failure
    Traceback (most recent call last):
    File "C:\pythonVirtualEnvs\openrem-dev\Lib\site-packages\openrem\remapp\tests\test_import_dx.py", line 499, in test_duplicate_study_dx_second_mod
    u'into.'.format(study_2_pk))
    File "C:\pythonVirtualEnvs\openrem-dev\lib\site-packages\testfixtures\logcapture.py", line 223, in check_present
    recursive=self.recursive_check)
    File "C:\pythonVirtualEnvs\openrem-dev\lib\site-packages\testfixtures\comparison.py", line 574, in compare
    raise AssertionError(message)
    AssertionError: sequence not as expected:

    same:
    ((u'remapp.extractors.dx',
    u'WARNING',
    u'Duplicate DX study UID 1.3.6.1.4.1.5962.99.1.2282339064.1266597797.1479751121656.24.0 in database - could be a problem! There are 2 copies.'),)

    expected:
    ((u'remapp.extractors.dx',
    u'DEBUG',
    u'Duplicate DX study UID 1.3.6.1.4.1.5962.99.1.2282339064.1266597797.1479751121656.24.0 - first instance (pk=156) with modality type assigned (DX) selected to import new event into.'),)

    actual:
    ()

    Failure
    Traceback (most recent call last):
    File "C:\pythonVirtualEnvs\openrem-dev\Lib\site-packages\openrem\remapp\tests\test_import_mam.py", line 233, in test_duplicate_event
    u'A previous MG object with this study UID (1.3.6.1.4.1.5962.99.1.1270844358.1571783457'
    File "C:\pythonVirtualEnvs\openrem-dev\lib\site-packages\testfixtures\logcapture.py", line 223, in check_present
    recursive=self.recursive_check)
    File "C:\pythonVirtualEnvs\openrem-dev\lib\site-packages\testfixtures\comparison.py", line 574, in compare
    raise AssertionError(message)
    AssertionError: sequence not as expected:

    same:
    ()

    expected:
    (('remapp.extractors.mam',
    'DEBUG',
    u'A previous MG object with this study UID (1.3.6.1.4.1.5962.99.1.1270844358.1571783457.1525984267206.3.0) and time (2013-04-12T13:22:23) has been imported. Stopping'),)

    actual:
    ()

    Error
    Traceback (most recent call last):
    File "C:\pythonVirtualEnvs\openrem-dev\Lib\site-packages\openrem\remapp\tests\test_rf_detail.py", line 51, in test_summary_total_dose_table
    self.assertEqual(response.context['study_totals'], summary_table_text)
    File "C:\pythonVirtualEnvs\openrem-dev\lib\site-packages\django\test\utils.py", line 68, in getitem
    raise KeyError(key)
    KeyError: 'study_totals'

    Failure
    Traceback (most recent call last):
    File "C:\pythonVirtualEnvs\openrem-dev\Lib\site-packages\openrem\remapp\tests\test_export_rf_xlsx.py", line 106, in test_filters
    self.assertEqual(siemens_sheet.cell_value(1, filter_thickness_col), '0.6')
    AssertionError: u'0.9' != '0.6'

    Destroying test database for alias 'default'...

    Process finished with exit code 1

  3. Ed McDonagh reporter

    Not sure about the last one, but the logging errors I have hit myself with my Python 3 branch, and I’ve not investigated why it suddenly didn’t work.

    However, if you change your local_settings.py so that LOGGING['loggers']['remapp']['level'] = 'DEBUG' then I think it will start working. In theory, the 'global' setting shouldn’t matter, because the logging level is overridden for those tests, but it obviously doesn’t work.

  4. David Platten

    Thanks. I now only get one error:

    Error
    Traceback (most recent call last):
    File "C:\pythonVirtualEnvs\openrem-dev\Lib\site-packages\openrem\remapp\tests\test_rf_detail.py", line 51, in test_summary_total_dose_table
    self.assertEqual(response.context['study_totals'], summary_table_text)
    File "C:\pythonVirtualEnvs\openrem-dev\lib\site-packages\django\test\utils.py", line 68, in getitem
    raise KeyError(key)
    KeyError: 'study_totals'

  5. David Platten

    The error occurs because the private keys of the database entries are hard-written into the test code. On my system the private keys for the failing test are not 1 and 2, so nothing is found.

    This same thing caused me problems in issue #697; see commit 56a5db0.

  6. Ed McDonagh reporter

    Thanks for working that out David. Are you free to make the same change to this branch, or will I do it later?

  7. Log in to comment