Automatic consumption calculation algorithm
Short Answer
Consumption is calculated as a variable window rolling average that discounts periods of stockouts. For example, a 3 month rolling average, with a minimum of 20 transactions, ignoring periods where the stock level dipped to zero.
Long Answer
This page is to let you know the basics of how CommCare Supply automatically calculates the monthly consumption for end users based on information about stock on hand at different time points that admin users fill in. This automatic monthly consumption calculation is specifically designed for periods where stock decreased – either between a receipt and a stock report, or between two stock reports.
Let's start with calculations for reports submitted at two time-points. If an HSA reported SOH of 200 units of coartem one day and 100 units of coartem ten days later, CommCare Supply would calculate the total consumption in ten days as 100 LA. His average daily consumption per day for that period would be 100/10 = 10 units.
For scenarios where admin users submit stock on hand at multiple discrete time points over a relatively long time period (90 days for example), CommCare Supply ignore periods which end with a stockout and periods when stock increases. For instance, if an HSA reports SOH of 100 units of coartem and reports 200 units three days later, CommCare Supply would ignore the three-day period.
So if there are 9 SOH reports from in last three months by an HSA, CommCare Supply system will clean the house and keep time periods where the amount of stock on hand is decreasing (e.g.: only 6 reports are kept for calculation since the SOH in the 3 reports are increasing), conduct simple subtractions for units of coartem in the 6 valid time periods, and then divided the subtracted outcome with number of days in the time period (e.g. all reports are submitted on a biweekly basis)– that's how we get daily consumption for the 6 different time periods. Then we average the 6 daily consumption amount, then multiple the outcome by 30 to determine the average monthly consumption in the last three months.Â