Phlogiston/Forecasting Model

For all calculations, "now" or "today" is the most recent day in the data.

Velocity over a time period is the number of resolved tasks at the end minus resolved tasks at the beginning. In some cases, it could be negative.

Backlog growth over a time period is the total number of tasks (open and resolved) at the end minus at the beginning. In some cases, it could be negative.
 * 1) Calculate velocity per category
 * 2) Calculate velocity for the week ending today
 * 3) Make three forecasts of future velocity
 * 4) Optimistic is the average velocity of the highest 3 weeks within the last 3 months, with a minimum of 2
 * 5) Nominal is the average velocity per week over the last 3 weeks, with a minimum of 1
 * 6) Pessimistic is the average velocity of the worst 3 weeks in last 3 months, with a minimum of zero.
 * 7) Note: For teams that resolve tasks every 2 weeks, and thus have a bunch of 0 weeks, this will produce a falsely low forecast
 * 8) Count all negative weeks as zero before averaging or summing.
 * 9) Make three forecasts of backlog growth (As of 17 Mar 2016, work in progress not yet implemented in production).
 * 10) Optimistic is flat: 0 growth.
 * 11) Nominal is the average of the last three weeks.
 * 12) Pessimistic is the greater of
 * 13) the average backlog growth of the last three weeks
 * 14) the average weekly growth over the last three months.
 * 15) Count all negative weeks as zero before averaging or summing.
 * 16) Combine Velocity and backlog growth forecasts
 * 17) Optimistic is not changed
 * 18) Updated nominal velocity is nominal velocity - nominal backlog growth (not less than 0).
 * 19) Updated pessimistic velocity = pessimistic velocity - pessimistic backlog growth (not less than 0).
 * 20) Divide the total remaining task count (per category) by each of the three velocities to determine # of weeks remaining