Day 2 – the flow of shortages

This post is a part of a series on drug shortages.

Today I focused on two things: a) starting fresh with a database export via the web API, and b) looking more closely at some basic displays that characterize shortages over time. To do all of this, threw away the code I had before because it was too cluttered dealing with the two databases we relied on for our paper. Now, I am only using the DSC database.

As before, I’ve been using R and some useful libraries that will make it easy for me to eventually make a live “dashboard” site. Here’s what today’s work looks like (I’ll go through these charts in more detail):

The first chart there shows the total number of drugs in shortage over time. That is, for every month on the x-axis I’ve tallied the number of drugs that were or are reported to be part of a shortage at that time.

If I squint, it looks like the total number of drugs in shortage steadily increased through 2017 and then roughly plateaued throughout 2018 and 2019.

Why the dramatic increase of drugs in shortage over 2017? This next chart gives some clues. Here is the number of new shortages each month coloured by the current status of the shortage (resolved, or active).

Except for the big blip in March of 2017 (when the database came online), the rate of new shortages has been roughly stable for the last three years, to my eyes. If the distribution of shortage duration stays roughly constant, then we’d expect to see the total number of drugs in shortage rise as the database comes online with (mandatory) reports of new shortages flowing in, and eventually stabilize as an equilibrium is reached between new shortages starting and old shortages ending. I think that’s what we’re seeing in the first chart.

Here’s another takeaway: voluntary reporting didn’t work. If it had, then when the DSC came online, and the voluntary shortage reports were ported over, we should have seen the number of drugs in shortage at the equilibrium level.

Of course, this assumes that the flow of new shortages is roughly constant (which I think I see in the chart above) and also that the spread of shortage duration also stays roughly constant over time. Does it? Let’s see:

Above are histograms of shortage duration over the last three years. Two things I can say from looking at them: (1) the distribution appears to follow a power law (i.e. longer shortages are proportionately less frequent), and (2) the spread in duration is getting narrower (i.e. there long shortages are happening less frequently in 2019 than in 2017).

The adventure continues…