Add tests for chart data

Issue #686 new
David Platten created an issue

It would be extremely useful to have tests to check that chart output for each modality is as expected for each type of chart, including filtering in a variety of ways.

Comments (49)

  1. David Platten reporter

    Added skeleton dx chart test file. Also amended an except in to ensure that data is still created on KeyError. References issue #686

    → <<cset fa3eb598e73b>>

  2. David Platten reporter

    The tests work OK for me locally

    python test remapp.tests.test_charts_dx

    I'll try setting an SQLite database later to see if it works with that.

  3. David Platten reporter

    Added some specific tests for acquisition DAP mean, count, names and histogram data. These tests work on my local system. References issue #686

    → <<cset a5e173b382ce>>

  4. Ed McDonagh

    Not sure what is going on, and I don't know if this is the best way of doing it or not, but it works now @dplatten!

    I think testing a view is good if you want to inspect the resulting html - that is what we do with for example test_filters_ct

    Then we have non-Django specific web testing tools that allow testing automated pointing and clicking, which I had been thinking might be good for all the charts?

    And then we have the approach you have taken to get the data that is fed into the charts.

    I don't know that any one is the best way -- I think in time we need some of all of them!

  5. David Platten reporter

    Many thanks for getting this to work. I can now concentrate on putting together tests that will cover all the chart types for each modality using a range of filters.

  6. David Platten reporter

    For DX I still need to add:

    • case-insensitive test
    • workload chart
    • DAP over time chart
    • kVp over time chart
    • mAs over time chart
    • frequency chart test (done)
    • study-level bar chart test (done)
    • request-level bar chart test (done)
    • kVp acquisition chart (done)
    • mAs acquisition chart (done)
  7. David Platten reporter

    Farmed some common code into their own methods to reduce duplication and make it a little clearer what each test is actually trying to test. References issue #686

    → <<cset 588c79dc24ed>>

  8. David Platten reporter

    Hmm. SQLite and PostgreSQL sort the study names in the opposite order to one another. Swapped them so that it works OK with SQLite; need to change how I do the test so that it is database-agnostic. References issue #686

    → <<cset 2c806e965fdb>>

  9. David Platten reporter

    The chart options include the ability to state how you want the chart data ordered, so I'd like to keep the ordering in. However, this may be creating a rod for my own back. New commit coming up.

  10. David Platten reporter

    Added check for SQLite database to help with data order; assumes all other databases will sort strings in the same way that my PostgreSQL does; may be more sensible to bin the idea of worrying about this and just use Counter, as suggested by Ed. References issue #686

    → <<cset 1dc53e0f3333>>

  11. David Platten reporter

    These tests now work on my PostgreSQL install and on the SQLite system used by the automatic on-line tests.

  12. David Platten reporter

    Plumbing dict option into the view. Correcting an error with the CT num events charts that was preventing some from being displayed or calculated. Refs issue #477 and #686

    → <<cset 8d1ca21edaa6>>

  13. David Platten reporter

    Added requested procedure tests. These are not really very good as the included DICOM data has blank requested procedure names... Refs issue #686

    → <<cset 319491ab8fa7>>

  14. Daniel Wyatt

    Refs issue #686 - Included study frequency tests. Also included mean,median, boxplot and histogram tests for number of events. Yet to add plotseriespersystem repeats Also ran black for formatting

    → <<cset 04c728df1a14>>

  15. Log in to comment