Charts aren't working in migrated to Docker installs

Issue #831 closed
Ed McDonagh created an issue

Need to check if this is also true for new installs.

Comments (14)

  1. David Platten

    Replacing Python 2.x basestring with Python 3.x str. Charts working now, with the exception of the CT chart of study DLP over time: does it work for anyone else? The radiographic chart of kVp over time works, so this seems to be CT-specific. References issue #831

    → <<cset 88b3bc8009f8>>

  2. David Platten

    @Ed McDonagh would you try this out please? I’m particularly interested to know if your CT chart of Study description DLP over time works. Thanks.

  3. Ed McDonagh reporter

    @David Platten in my Docker install I still get no charts - if I click to see the data table there is nothing there.

    In a non-Docker install, the charts work with this branch but not CT Study DLP over time as you have found. The data table shows all the dates but no values.

    However, I did see this in the runserver logs when I went to the DX page:

    [22/May/2020 23:05:21] "GET /static/js/charts/dxChartAjax.js HTTP/1.1" 200 8468
    Internal Server Error: /openrem/dx/chart/
    Traceback (most recent call last):
      File "/home/mcdonaghe/research/vep3d22/lib/python3.6/site-packages/django/core/handlers/", line 34, in inner
        response = get_response(request)
      File "/home/mcdonaghe/research/vep3d22/lib/python3.6/site-packages/django/core/handlers/", line 115, in _get_response
        response = self.process_exception_by_middleware(e, request)
      File "/home/mcdonaghe/research/vep3d22/lib/python3.6/site-packages/django/core/handlers/", line 113, in _get_response
        response = wrapped_callback(request, *callback_args, **callback_kwargs)
      File "/home/mcdonaghe/research/vep3d22/lib/python3.6/site-packages/django/contrib/auth/", line 21, in _wrapped_view
        return view_func(request, *args, **kwargs)
      File "/home/mcdonaghe/research/bbOpenREM/openrem/remapp/", line 265, in dx_summary_chart_data
      File "/home/mcdonaghe/research/bbOpenREM/openrem/remapp/", line 369, in dx_plot_calculations
        result = average_chart_inc_histogram_data(study_events,
    UnboundLocalError: local variable 'study_events' referenced before assignment

    I get the same DX error in the docker logs.

  4. David Platten

    “over time” charts fail if any of the values are “None”. This happens for some of my radiographic systems where kVp is missing.

    I’ve tried to exclude values that are “None” in line 289 of

    # Exclude all zero value events from the calculations
    database_events = database_events.exclude(**{db_value_name: 0, db_value_name: None})

    However, this does not work. Not sure why.

  5. David Platten

    That syntax lets you use a variable as the field name. It’s used elsewhere in the charts code too.

  6. David Platten

    Fixed the problem where radiographic charts of kVp etc over time failed if some data values were None. CT study DLP over time still has no data, and haven't addressed Ed's referenced-before-assignment problem yet. References issue #831

    → <<cset 43b3fdfa7c24>>

  7. David Platten

    @Ed McDonagh does this fix the problem that you had with your DX chart? I am unable to replicate the error that you have seen. References issue #831

    → <<cset 50d4ed83f39c>>

  8. Ed McDonagh reporter

    Thanks @David Platten I’ve checked the non-Docker install again an no longer get the UnboundLocalError in the error logs.

  9. Ed McDonagh reporter

    @David Platten I’m planning to close this issue, not sure if there was anything outstanding but it has become irrelevant I think with all the work you have been doing?

    Do you agree?

  10. Log in to comment