ebmdatalab / openprescribing

A Django app providing a REST API and dashboards for the HSCIC's GP prescribing data
https://openprescribing.net
MIT License
97 stars 26 forks source link

Add time trend graph showing all practices within a CCG for each measure #399

Open lmfrench opened 7 years ago

lmfrench commented 7 years ago

When clicking through to view all practices within a ccg (e.g. https://openprescribing.net/ccg/07M/silver/ or https://openprescribing.net/ccg/07M/ace/) user would like to see all practices on one graph.

Use Case: As Head of Medicines Optimisation, I would like to see a graph comparing all practices in my CCG so I can easily identify which practices to target

User was aware they can construct their own query in analyse to do this, but thinks it would be a useful addition to the practice comparison page. They agreed @alexwalkercebm's aster plots will help with this, but would still like to see the time trend. Might be something to test once we have decided how we will be presenting the new plots.

alexwalkerepi commented 7 years ago

The aster plots were mocked up (somewhat shoddily) using powerBI, but there's a d3 library http://bl.ocks.org/bbest/2de0e25d4840c68f2db1 that looks like it would do it better.

jamesscottbrown commented 7 years ago

I haven't seen the aster plots, but the first visualisation I would think of for this purpose is a heat map:

heatmap

The main difficulty in comparing the values of a particular measure for all practices in an CCG over time is the number of values. In this example (prescribing of high-cost ACE inhibitors in NHS Barnet), there are something like 5,694 values for each measure (73 practices, and 6.5 years = 78 monthly measurements for each), though some of these are missing.

If superimposed on a single line-graph, the result is a mess of overlapping lines.

superimposed-line-plots

If separated out into one plot per practice (with the same y-axis scale to enable direct comparison), the plots take up too much space to be simultaneously presented. If the y-axis heights are reduced until they all fit onto one screen, then changes become difficult to see.

One solution is to encode the values as color rather than vertical position, so that each practice is presented as a row in a heat-map. This enormously increases the number of values that can be simultaneously presented. The difficulty of reading off precise values can be partly addressed by interactivity (e.g. a tooltip that displays the value of the cell being moused over).

jamesscottbrown commented 7 years ago

Though if the use case is really just to "easily identify which practices to target", not simultaneously trying to show a time trend makes this much easier to do clearly - just plot the most recent values in a bar chart (or Cleaveland-style dotplot):

dotplot

Bengoldacre commented 7 years ago

That heat map is fab. I'd love to see how it lands with users tho we're short on coder time for new stuff.

BUT we're about to launch some "labs" pages: each CCG and practice will have one, and it's going to be a list of links to pages, each with a new more experimental analysis or data representation, and things that work well maybe get shifted up to main site (tho not for some of our new very technical features!).

James, if we made you a page, API access, list of resources etc, would you be up for owning a corner of OP, and implementing your heat maps on a labs page? We could promote, blog, link etc. Also, let us know if you'd like to come for a lunchtime on a Tuesday team day (fortnightly).

Cheers!

jamesscottbrown commented 7 years ago

That's an interesting suggestion. It's probably easiest to discuss in person - when is your next team day?