1. OpenREM
  2. OpenREM
  3. OpenREM
  4. Issues

Issues

Issue #332 resolved

Compare doses between x-ray systems on the charts

David Platten
created an issue

I would find it useful to be able to compare doses from x-ray systems on the charts. For example, a chart showing CT head requests for CT scanner A vs. CT scanner B.

Comments (185)

  1. David Platten reporter

    I'm going to get the CT plot of DLP per requested procedure working as a test case.

    Users will sometimes want to view a global mean or median, rather than values split by system. Need to make this possible.

    Chart code is likely to need updating to cope with the more complex data being sent to it.

  2. David Platten reporter

    Need to ensure that there is one list of requested procedure names that is used for each scanner, even if some scanners have no requests under some of the names.

  3. David Platten reporter

    Order of data sorted out (no pun intended). At the moment the plot only works if all scanners have some data for every requested procedure type being displayed. Drilldown and sorting do not work at the moment. References issue #332

    → <<cset b340988ee33d>>

  4. David Platten reporter

    The histograms were in a different order to the median values, so there was a mis-match between the main series and the drilldown. It turns out that this is because the python sorting routines sort in a different way to that of the Django database queries. I've fixed it by ordering the requestSummary data to match the database-provided list of names. References issue #332

    → <<cset dfc8a740cc6a>>

  5. David Platten reporter

    Added user option to plot a series per system, or to group all systems into one series. Also fixed an error in the colour calculations that was causing a divide by zero when there was only one series. References issue #332 and issue #342.

    → <<cset ec745250d1f6>>

  6. Ed McDonagh

    On the currently installed demo of this, if I click on CT Head I get a histogram that I'm assuming has all the different scanners plotted.

    If I click on CT Abdomen or CT Chest, I only get one scanner plotted. Is this what you get? Maybe its something that has been fixed here, but I don't remember a commit message referencing this...

    Looks lovely by the way!

  7. David Platten reporter

    You're probably looking at a plot that is showing mean and median data for each system. There will be two series for each system on the initial plot, one for mean and the other for median. When you drilldown you only see half the number of series, because the histogram data for the mean and median points is the same. So, clicking on CT head (showing eight series) will take you to four histograms; clicking on either of the others (two series) will take you to a single histogram.

  8. David Platten reporter

    Plots per system

    Done:

    • Added universal option to plot per system or group all systems into one series

    • DLP per CT requested procedure name can now be per system or one series

    • DLP per CT study description can now be per system or one series

    • Added display of requested procedure on radiographic tabulated data

    • DAP per radiographic requested procedure name can now be per system or one series

    • Added requested procedure name as a form filter on radiographic page

    • Added new charts of DAP per radiographic study description and DAP per requested procedure name

    • Added new charts of radiographic study description frequency and requested procedure name frequency

    • DAP per radiographic study description can now be per system or one series

    • DAP per radiographic acquisition protocol can now be per system or one series

    • kVp per radiographic acquisition protocol can now be per system or one series

    • mAs per radiographic acquisition protocol can now be per system or one series

    • DLP per CT acquisition protocol can now be per system or one series

    • CTDI per CT acquisition protocol can now be per system or one series

    Notes:

    There is little agreement in acquisition protocol names and study descriptions between the systems that I look after. For me, these plots won't really allow a comparison between systems in an easy side-by-side way. The plots of requested procedure name should work well, as all systems are populated with the same range of names.

  9. David Platten reporter

    Modified logic for mean and median data calculation for requested radiographic data. Should help to speed things up when plotting per system. Need to implement this for the CT requests too. Investigate whether simplifying the field used for num_req or num_acq or num_stu speeds things up too. References issue #332

    → <<cset acede37050c3>>

  10. David Platten reporter

    Improved chart calculation code to avoid unnecessary blocks that won't be needed. Also simplified the field that is used to count how many requests, acquisition, studies have been carried out. References issue #332

    → <<cset 88cfd2d871d6>>

  11. David Platten reporter

    I've been looking at histograms of DAP for several rooms together, plotted on one chart. There is quite a discrepancy between the number of examinations for some of the rooms, making it difficult to compare the shape of the histograms. I thought it would be useful to be able to normalise each histogram, setting it's maximum value to 1.0. This then makes comparison of the shape easier. The code below does this, and can be attached to a button below each relevant chart. Does anyone think this is a useful feature?

    It's a bit rough-and-ready at the moment: if the user clicks on the button when viewing the histogram plots then nothing happens; once they return to the main plot and then drill down again the histogram plots will be updated with the normalised values.

    var histogramNormalised = false;
    
    function normaliseHistograms(chartContainer) {
        var chart, histogram_data, i, j, series_max;
        if (histogramNormalised == false) {
            chart = $(chartContainer).highcharts();
            histogram_data = [];
            for (i = 0; i < chart.options.drilldown.series.length; i++) {
                histogram_data.push({
                    id: chart.options.drilldown.series[i].id,
                    name: chart.options.drilldown.series[i].name,
                    useHTML: true,
                    data: []
                });
                series_max = Math.max.apply(Math, chart.options.drilldown.series[i]["data"].map(function(v) {return v[1];}));
                for (j = 0; j < chart.options.drilldown.series[i]["data"].length; j++) {
                    histogram_data[i]["data"].push([
                        chart.options.drilldown.series[i]["data"][j][0],
                        chart.options.drilldown.series[i]["data"][j][1] /= series_max
                    ]);
                }
            }
            chart.options.drilldown.series = histogram_data;
            histogramNormalised = true;
        }
    }
    

    A button can be created in dxfiltered.html that will run the code:

    <a onclick="normaliseHistograms('#plotDXRequestMeanDAPContainer')" class="btn btn-default btn-sm" role="button">Normalise histograms</a>
    
  12. David Platten reporter

    Ed McDonagh, I've put this latest code on the djp demo site. Have a look at the "DLP per requested procedure type" chart. It's now possible to normalise the histograms.

    It only works for the CT data on that site, as the radiograph data doesn't have any values in "Requested procedure".

  13. David Platten reporter

    Updated JavaScript histogram normalisation code so that the histogram plots are updated live, rather than the user having to return to the main series and then drilldown again. Much, much better now. References issue #332

    → <<cset 45c68227a619>>

  14. David Platten reporter

    Ed McDonagh, I think that this issue is sorted out now. I'm not going to close it yet so that I can spend a little more time to check. It would be useful if you'd take a look at the djp demo site at some point to see if you can see any problems with the charts. Thanks, David

  15. David Platten reporter

    The current chart code in views.py is very memory-inefficient, as there are lots of places where variables are assigned data, and then another variable is set to the value of the first one. Reorganising the code so that only one variable is assigned should reduce the memory footprint.

  16. Ed McDonagh

    I'd guess so, unless/until the second variable's value is changed, in which case you'd have a new copy in memory.

    Just going by the page you linked to though, I don't have any expertise in the area!

  17. David Platten reporter

    Updated series labels of average plots so that (mean) or (median) is added to the series labels when plotting both mean and median values. It's so good to be able to update the code in one place and know that all the charts of this type will be up-to-date with the change (thanks, issue #351). References issue #332 and issue #351.

    → <<cset 38b9ffa6aebf>>

  18. David Platten reporter

    Order of data sorted out (no pun intended). At the moment the plot only works if all scanners have some data for every requested procedure type being displayed. Drilldown and sorting do not work at the moment. References issue #332

    → <<cset b340988ee33d>>

  19. David Platten reporter

    The histograms were in a different order to the median values, so there was a mis-match between the main series and the drilldown. It turns out that this is because the python sorting routines sort in a different way to that of the Django database queries. I've fixed it by ordering the requestSummary data to match the database-provided list of names. References issue #332

    → <<cset dfc8a740cc6a>>

  20. David Platten reporter

    Added user option to plot a series per system, or to group all systems into one series. Also fixed an error in the colour calculations that was causing a divide by zero when there was only one series. References issue #332 and issue #342.

    → <<cset ec745250d1f6>>

  21. David Platten reporter

    Modified logic for mean and median data calculation for requested radiographic data. Should help to speed things up when plotting per system. Need to implement this for the CT requests too. Investigate whether simplifying the field used for num_req or num_acq or num_stu speeds things up too. References issue #332

    → <<cset acede37050c3>>

  22. David Platten reporter

    Improved chart calculation code to avoid unnecessary blocks that won't be needed. Also simplified the field that is used to count how many requests, acquisition, studies have been carried out. References issue #332

    → <<cset 88cfd2d871d6>>

  23. David Platten reporter

    Updated JavaScript histogram normalisation code so that the histogram plots are updated live, rather than the user having to return to the main series and then drilldown again. Much, much better now. References issue #332

    → <<cset 45c68227a619>>

  24. David Platten reporter

    Updated series labels of average plots so that (mean) or (median) is added to the series labels when plotting both mean and median values. It's so good to be able to update the code in one place and know that all the charts of this type will be up-to-date with the change (thanks, issue #351). References issue #332 and issue #351.

    → <<cset 38b9ffa6aebf>>

  25. Log in to comment