ccodwg / Covid19CanadaDashboard

Visualize Canadian COVID-19 Data
https://opencovid.ca/
Other
5 stars 1 forks source link

More vaccine plots #3

Closed jeanpaulrsoucy closed 2 years ago

jeanpaulrsoucy commented 3 years ago

Some additional plots are needed on the vaccine tab.

jeanpaulrsoucy commented 3 years ago

Gap tracker added by 1787d68719effd7065447f107412c7d1640a048c.

jeanpaulrsoucy commented 3 years ago

Draft of per-capita/percent fully vaccinated/time to x% vaccination added by @benkcwong in 64c6d52.

jeanpaulrsoucy commented 3 years ago

@benkcwong: Good start on the time to % vaccinated table. A few comments.

vax

jeanpaulrsoucy commented 3 years ago

@benkcwong: With respect to % fully vaccinated, we should actually be showing % of total population fully vaccinated, rather than % of those who have received at least one dose that are fully vaccinated. This is my fault for providing example code for the latter, as in that context I was making a different point about vaccination strategies (withholding second dose or not).

jeanpaulrsoucy commented 3 years ago

@benkcwong: For the per-capita plots, I'm almost wondering if we can roll up this plot with the other cumulative plot and have two options: over time (line graph) versus current (bar graph) and per-capita versus absolute. We could also use unified hover pointed out by @kbelisar to facilitate comparison on the line graphs. I'll give these a think over.

benkcwong commented 3 years ago

Updated the percent vaccination table in 03d16ad. Column/header alignment fixed, column numbers changed to a consistent format, and search bar removed.

Solution to misaligned columns and headers described in: https://stackoverflow.com/questions/46287971/column-headers-of-shiny-data-table-gets-shifted Misalignment is due to ScrollX = TRUE when the table fits within the page width without it.

jeanpaulrsoucy commented 3 years ago

Nice job fixing the table bug, @benkcwong. Some additional comments on the table:

Can we also add a footnote to the table describing how the expected date is calculated based on the 7-day average of vaccine doses administered per day, assuming everyone receives 2 doses (but not accounting for the delay between doses).

Of course, we might have to tweak this whole table/formula once a 1-dose vaccine gets thrown into the mix, but we'll deal with that issue when it arrives.

benkcwong commented 3 years ago

Thanks, updated the column title and footnote in 1fb8af8.

jeanpaulrsoucy commented 3 years ago

Looks great, @benkcwong. An issue with the table on mobile is that in (at least in landscape mode), the table is too wide, thus needs to be scrollable horizontally. Could you also freeze the first column, as is the case for the overview table?

Can you try implementing the alternative to scrollX described here: https://stackoverflow.com/a/64612713

benkcwong commented 3 years ago

Sorry I missed this comment, JP! Thanks for these commits. I reviewed them and they look good to me!

jeanpaulrsoucy commented 3 years ago

We should also add "daily doses administered" (7-day rolling average) to the overview tab.

jeanpaulrsoucy commented 3 years ago

Another calculation that might be useful on vaccines: what percentage of vaccines will be left in the freezer by the time the next delivery comes around, based on the 7-day average pace of administration?

The vaccine dose delivery numbers from PHAC (which we use for most provinces) typically get updated on Thursdays, so this makes sense as the window to use [in fact, could explicitly freeze the distribution number at Thursday's value for purposes of calculating this value?].

This could give more context to people talking about the number of vaccines in freezers shortly after more doses are delivered, which is misleading absent context.

jeanpaulrsoucy commented 3 years ago

Minor updates to vaccine table (ae9f7ca).

andibakti commented 3 years ago

Hey all,

I'm looking at the 'Expected date to reach X%' and it feels more appropriate to model it as a logistic curve rather than a linear one as in here date_to_vaxx = max(date_vaccine_administered) + round((total_remaining) / roll_avg, 0),

(it's also more optimistic and could greatly exceed vaccine supply)

This involves some fitting functions though so this might be out of scope of this issue

benkcwong commented 3 years ago

Thanks for the feedback, Andi! Our initial idea was to include a simple calculation to give a quick snapshot of vaccine rollout progress - a logistic curve is definitely a sensible alternative for the reasons you outlined. Will bring this up at our next team meeting and discuss whether it's something to pursue in future updates.

benkcwong commented 3 years ago

Added "daily doses administered" (7-day rolling average) to the overview tab as part of the vaxview-update branch (7789819). In hindsight, probably should have called this the overview-tab-update.

jeanpaulrsoucy commented 3 years ago

Hi @andibakti. The purpose of this calculation is more to get a sense of how fast we are vaccinating --- i.e., how long it would take to get x% of the population vaccinated at the speed we've been going the past week, with the implicit assumption that supply is not an issue. Happy to consider any alternate formulas if you want to whip up a little chart/calculation as demonstration, though.

andibakti commented 3 years ago

I made this as a quick example, these values are for QC only. Green line would be the set x% of population reached image

Essence of the calculation was this

x = np.array(df_total.index) + 1
y = np.array(df_total['vac_cum_tot_n'])

def my_logistic(t, a, growth_rate, saturation_lvl):
  return saturation_lvl /(1 + a * np.exp(-growth_rate*t))

import scipy.optimize as optim
(a, r, K), __ = optim.curve_fit(my_logistic, x, y, bounds=bounds, p0=p0)

Though I admit a simple week over week growth of rolling average would illustrate this point

benkcwong commented 3 years ago

Added plot for "percent of the population with at least one dose (at the province level)" in the vaccine tab (6fd5efc).