Charts: no data shown when some DAP values blank

Issue #494 resolved
David Platten created an issue

For a particular room there is missing DAP data for some studies. Median DAP values are not shown in the chart where this is the case. Needs investigating. Maybe blank DAP fields prevents the median value from calculating?

Comments (9)

  1. David Platten reporter

    There is a value being displayed, but it is too small to show up... The studies with a blank DAP have the value 0E-12 stored in the database (0.000000000000). These zero DAP studies are included in the calculation of the mean or median DAP, making the mean or median very, very small.

    I could exclude the zero dose values from the calculation of mean or median in average_chart_inc_histogram_data in chart_functions.py by excluding zero dose items from the query:

    database_events.filter(**{db_display_name_relationship: system}).values(db_series_names).exclude(**{db_value_name: 0}).annotate(mean=Avg(db_value_name) * value_multiplier,num=Count(db_value_name)).order_by(db_series_names)
    

    The problem with this is that it also excludes the zero dose studies from the calculation of the number of studies, messing up the frequency plots.

    Perhaps I should just accept that the zero dose items are included in the calculation of mean and median (most of this zero-dose data is from radiographic rooms that weren't sending DAP, but are sending it now). I could even delete all of the zero-dose data from my database.

    Any thoughts on this @edmcdonagh?

  2. Ed McDonagh

    How is deleting all the zero dose data from the database different from having frequency plots that disregard them?

    I do think that it makes sense to disregard 0 values in means and medians for DAP - they are not 'real' values after-all.

  3. David Platten reporter

    At the moment the zero dose studies are making the displayed mean and median chart values incorrect, so I need to do something. I think I have three options:

    1. Ignore zero dose events when calculating mean and median but include them in frequency calculation. The chart calculation code would need to be rewritten.

    2. Ignore zero dose events when calculating any chart data. Requires a calculation code change to exclude all zero-dose events.

    3. Delete all of my zero dose studies from the database. No code change is required, but if zero-dose studies appear again and I don't notice then my mean and median values in the charts will be "wrong".

    The zeros are effectively errors and shouldn't have made it into the system in the first place: the rooms that were sending blank values were incorrectly set up. These rooms are being configured to send DAP values.

    My preference is for option 2.

  4. David Platten reporter

    Updated charts documentation to make it clear how zero or blank dose values are treated when calculating chart data. References issue #494

    → <<cset b8befcc3e47e>>

  5. David Platten reporter

    Updated changes files and documentation for new charts. Also clarified the text on issue #494 in the changes files. Still need to update the chart options screenshot. References issue #529 and issue #494

    → <<cset 1aebe64ef0f2>>

  6. Log in to comment