Course dataset — Mpumalanga district commodity tracker (simulated)
Every module uses a simulated monthly stock dataset covering 24 facilities across a fictional Mpumalanga district, over 6 reporting periods. The data is modelled on the kind of exports produced by South Africa's Stock Visibility System (SVS) and DHIS2. You will work with stockout flags, accounting discrepancies, consumption spikes, and cross-facility comparisons — exactly what you encounter in practice.
Why Data Visibility Matters
Before learning any formula, you understand what is at stake. Stockouts, expiries, and wastage are not random — they are decisions made on incomplete data. This module establishes why visibility is the foundation of every high-performing supply chain.
A district supply chain officer in Limpopo receives a call: a clinic has run out of TDF/3TC/DTG. The clinic serves 340 ART patients. The last spreadsheet update was four weeks ago. No one knew consumption spiked after a patient transfer from a closed rural clinic. The stockout lasts six days. What data would have made this visible in time to act?
- 01What supply chain data visibility actually meansThe four conditions: right data, right quality, right time, right hands. Why data that exists but cannot be accessed is not visible.
- 02The consequences: stockouts, expiries, wastage — quantifiedUsing the NDoH Stock Visibility System (SVS) context: persistent stockout rates at primary healthcare facilities. How fragmented data prevented redistribution of expiring stock.
- 03The digitisation maturity curve — where does your programme sit?Five stages: Greenfield → Early digitisation → Emerging digitisation → Digitisation with analytics → Future state. Mapping South African examples (SVS, CCMDD, SYSPRO depot systems) to each stage.
Map the data flow in your own programme. At each level, mark: (a) what supply chain data is collected, (b) how it is collected (paper / digital / both), and (c) how quickly it reaches the next level. Identify ONE decision currently being made with incomplete or delayed data.
- 01Action 1: Secure stakeholder commitment — quantifying the costHow the NDoH Ideal Clinic Realisation and Maintenance (ICRM) programme created accountability for supply chain performance — and what programme managers can learn from it.
- 02Actions 2–4: Roadmap, capabilities, interoperabilityZambia's five-year integration plan as a blueprint. GS1 barcodes in South African pharmaceutical distribution. Why SVS, DHIS2, and depot ERP systems must speak to each other.
The Essential Data You Actually Need
Most supply chain systems collect too much data and use too little of it. This module identifies the minimum — three data items — needed to manage any health commodity supply chain, and explains the records that capture them.
Closing Balance = Opening Balance + Receipts − Consumption − Losses + Positive Adjustments − Negative Adjustments. If your closing balance does not match your physical count, one of these items has an error. This equation is the foundation of every stock reconciliation in this course.
- 01Stock on hand — what counts, what doesn'tUnusable stock (expired, damaged, VVM-failed vaccines) is not stock on hand — it is a loss. The NDoH SVS is built around facility-level SOH reporting. Why accuracy here is the top priority.
- 02Consumption vs. issues — a critical distinctionConsumption is what left the supply chain to reach a patient. Issues is what was sent from a store. Using CCMDD dispensing data as the gold standard for ARV consumption in South Africa.
- 03Losses and adjustments — closing the accounting loopExpiry, damage, theft, redistribution between facilities. Why recording losses honestly is a management responsibility, not a confession of failure.
For your current programme or facility, audit your data collection: Is stock on hand collected? Is it consumption or issues data? Are losses recorded? For each item: Yes / No / Partially. Identify the single biggest gap. What would it take to close it?
- 01HMIS collects patient data. LMIS collects commodity data.DHIS2 headcount data vs. SVS stock data — two different systems, two different purposes. Why they must also talk to each other (immunisation coverage vs. vaccine consumption).
- 02Three types of logistics records — and their rolesStock-keeping records (bin cards, store ledgers), transaction records (delivery notes, GRVs), and consumption records (dispensing registers). In a well-functioning LMIS, all three must be internally consistent.
Reading Supply Chain Data in Excel
Excel is the entry point for supply chain data analysis in most South African health programmes. This module builds the skills to go from a raw SVS export to a structured, analysable dataset — and introduces the eight formulas that cover 80% of supply chain work.
The Mpumalanga district commodity tracker contains monthly stock data for 8 tracer medicines across 24 facilities over 6 months. Columns: Facility | District | Product | Month | Opening Balance | Receipts | Consumption | Losses | Closing Balance | Days Out of Stock. Download it from the course resources page before beginning the exercises.
- 01Wide vs. long format — and why long format winsProgramme officers often receive data in wide format: one column per month. This is very difficult to analyse with PivotTables. How to identify which format you have — and when to restructure.
- 02Date formats, consistent naming, and no merged cellsWhy YYYY-MM-DD is the only safe date format. Why "TDF/3TC/DTG" and "TDF 3TC DTG" are different objects to Excel. How merged cells silently break every formula.
- 01Months of Stock and the stock accounting check
=SOH/AMCfor months of stock.=Opening+Receipts-Consumption-Lossesas the accounting check. Wrapping both inIFERRORto handle zero AMC. - 02AMC, AVERAGEIF, stockout rate, and VLOOKUPUsing
AVERAGEIFto exclude stockout months from AMC.COUNTIF(days_OOS_range,">0")/COUNTA(range)for stockout rate.VLOOKUPwith exact match for facility reference data. - 03SUMIF, IFERROR, and date functions for reporting periods
SUMIFfor conditional totals by product or facility.TEXT(date,"YYYY-MM")for grouping.EOMONTHfor last-day-of-month calculations. Building a clean period column from text dates.
- 01Building the facility × product MOS PivotTableRows: Facility, Columns: Product, Values: Average MOS. Adding a Month slicer. This is the heat map foundation — all cells, coloured automatically by performance.
- 02Conditional formatting: red (MOS <2), amber (2–3), green (3–6), blue (>6)Setting up the four-colour MOS scale. Adding a separate dark-red rule for actual stockout days >0. Why blue (overstock/expiry risk) matters as much as red.
Using the Mpumalanga dataset: (1) Add a Months of Stock column. (2) Apply the four-colour conditional format. (3) How many facility-product combinations are at stockout risk this month? (4) Which product has the most red flags? (5) Add a stock accounting check column. How many records have a discrepancy?
Supply Chain KPIs for Programme Managers
A KPI without a target is just a number. This module defines the six core supply chain KPIs used in South African health programmes, explains what each one measures, and links each to PEPFAR and Global Fund reporting requirements.
Stockout Rate: facility-months with OOS >0 / total facility-months × 100. Target <2%. | MOS: SOH / AMC. Target 2–6 months. | Order Fill Rate: qty supplied / qty ordered × 100. Target >95%. | Waste Rate: total losses / total receipts × 100. Target <1%. | Reporting Rate: reports on time & complete / expected × 100. Target >95%.
- 01Stockout rate and months of stock — the two most importantStockout rate identifies whether the problem happened. MOS predicts whether it will happen. Both must be monitored — one looks back, one looks forward.
- 02Order fill rate, inventory turnover, waste rate, reporting completenessOFR measures depot/warehouse performance. Inventory turnover flags slow-moving stock. Waste rate is a PEPFAR and Global Fund fiduciary indicator. Reporting completeness is the prerequisite for all other KPIs.
- 01The right KPI for the right management questionIs any facility about to run out? → MOS. How well is the depot filling orders? → OFR. Are we wasting donor medicines? → Waste Rate. Matching indicator to decision, not the other way around.
- 02KPI trend analysis — are we improving?Calculating each KPI for all 6 reporting periods. Plotting trend lines. Identifying whether stockout rate is converging toward or diverging from the 2% target.
Calculate all six KPIs for the most recent month in the Mpumalanga dataset. For each: (1) write the Excel formula, (2) state the result, (3) compare to the target. Then calculate all six for each of the 6 months and plot the trend. Which KPI improved most? Which deteriorated?
Descriptive Analytics — Building the District Dashboard
Descriptive analytics answers the question: what happened? A well-built Excel dashboard puts that answer in the hands of a programme manager within minutes of receiving updated data. This module builds the complete four-component dashboard.
- 01Four components of a supply chain monitoring dashboardKPI scorecard (traffic lights), stockout heat map (facility × product), trend charts (6-month KPI trends), and top issues list (ranked problems with owners and due dates).
- 02Chart types for supply chain communicationLine charts for trends. Horizontal bars for district rankings. Colour tables (heat maps) for facility × product status. When to use each — and what to avoid (3D charts, pie charts for more than 3 categories).
- 01KPI scorecard: values, targets, and traffic light statusSummary table: KPI Name | Value | Target | Status.
=IF(value>=target,"✓ On track","✗ Off track"). Conditional formatting on Status column. Pulling KPI values from the data sheet with formulas — not manual entry. - 02Heat map: PivotTable with colour scale and month slicerFacility × Product MOS PivotTable. Three-colour scale: red (0) → yellow (3) → green (6+). Adding a month slicer so reviewers can compare current vs. previous period.
- 03Trend charts and the top issues tableMonthly KPI trend line with red dashed target reference. Top 5 table: facility, product, MOS, projected stockout date, responsible person, action due. This combination — chart + table — is the core of every district review meeting.
Build the complete four-component dashboard using the Mpumalanga dataset. Then produce the one-page district performance snapshot (Module 9 template). Peer review: can a colleague identify the top 3 problems in under 60 seconds?
Predictive Analytics — Forecasting Stockouts
Predictive analytics answers the question: when will we run out of stock? This module introduces seasonal adjustment, the stockout projection formula, and Excel's Forecast Sheet — the practical toolkit for supply chain forecasting.
A provincial TB manager reviews six months of isoniazid consumption. Average: 2,400 units/month. SOH: 3,800 units. MOS = 1.58. She knows October–November see a 35% surge in new TB cases post-winter. Adjusted AMC = 3,240 units/month. Adjusted MOS = 3,800 / 3,240 = 1.17. Stockout in under 5 weeks. She places the emergency order today.
- 01Seasonal patterns by programme — TB, malaria, ORS, vaccinesTB post-winter surge in EC and KZN. Malaria season in Limpopo, Mpumalanga, northern KZN. ORS demand peaks in summer. Measles catch-up campaigns in February–May. How to calculate seasonal adjustment factors from 12+ months of historical data.
- 01Projected stockout date:
=TODAY()+(SOH/(AMC/30))Building the projection column for every facility-product combination. Conditional formatting: red = stockout within 30 days, amber = within 60 days, green = more than 60 days. Combining with seasonal adjustment factor. - 02Excel Forecast Sheet for trend-based forecastingTwo-column table: Date | Consumption. Data → Forecast Sheet → set end date 3–6 months ahead. Excel generates forecast with confidence interval. How to export the forecast values to your dashboard.
Using the Mpumalanga dataset: (1) Calculate projected stockout date for every facility-product combination. (2) Apply conditional formatting. (3) Which 5 combinations will stock out soonest? (4) For the product with the most red flags, use the Forecast Sheet to project consumption for the next 3 months. (5) Write a 3-sentence management recommendation.
Scale with R — tidyverse for Supply Chain Analysis
Everything you did in Excel, reproduced in R with the tidyverse — for 200 facilities at once instead of 24. This module introduces R for supply chain analysis from scratch. No prior R knowledge required.
library(tidyverse)
library(readxl)
# Import the dataset
data <- read_excel("mpumalanga_stock_data.xlsx")
# Inspect immediately after import
glimpse(data) # column names, types, first values
nrow(data) # expected: 24 facilities × 6 months × 8 products
colSums(is.na(data)) # check for missing values by column
# Add MOS and risk flag to every row
data <- data |>
mutate(
MOS = ifelse(AMC > 0, SOH / AMC, NA),
risk_flag = case_when(
MOS < 2 ~ "HIGH RISK",
MOS < 3 ~ "WATCH",
MOS > 6 ~ "OVERSTOCK",
TRUE ~ "OK"
)
)
# Stockout rate by product — most recent month only
stockout_rate <- data |>
filter(month == max(month)) |>
group_by(product) |>
summarise(
n_facilities = n(),
n_high_risk = sum(risk_flag == "HIGH RISK", na.rm = TRUE),
pct_high_risk = round(n_high_risk / n_facilities * 100, 1),
avg_MOS = round(mean(MOS, na.rm = TRUE), 2)
) |>
arrange(desc(pct_high_risk))
library(ggplot2)
# Monthly average MOS for TDF/3TC/DTG across all facilities
arv_trend <- data |>
filter(product == "TDF/3TC/DTG") |>
group_by(month) |>
summarise(avg_MOS = mean(MOS, na.rm = TRUE))
ggplot(arv_trend, aes(x = month, y = avg_MOS)) +
geom_line(colour = "#0f766e", linewidth = 1.2) +
geom_point(colour = "#0f766e", size = 3) +
geom_hline(yintercept = 2,
colour = "#dc2626", linetype = "dashed") +
annotate("text", x = min(arv_trend$month), y = 2.15,
label = "2-month minimum", colour = "#dc2626",
size = 3.2, hjust = 0) +
labs(
title = "TDF/3TC/DTG — Average Months of Stock",
subtitle = "All 24 facilities, Mpumalanga district",
x = NULL, y = "Months of stock"
) +
theme_minimal(base_size = 12)
library(writexl)
# Export multiple outputs to one workbook
write_xlsx(
list(
"KPI Summary" = stockout_rate,
"MOS by Facility" = data,
"Risk Flags" = filter(data, risk_flag == "HIGH RISK")
),
path = "mpumalanga_analysis_output.xlsx"
)
# R Markdown: render report for one facility/district
# In your .Rmd YAML header:
# params:
# facility: "Nhlazatshe CHC"
# Then filter data with: filter(data, facility == params$facility)
# Knit once per facility in a loop:
purrr::walk(unique(data$facility), ~
rmarkdown::render("facility_report.Rmd",
params = list(facility = .x),
output_file = paste0(.x, "_report.docx")
)
)
Build a parameterised R Markdown report for the Mpumalanga district. The report must: (1) import the full dataset, (2) calculate all six KPIs, (3) include the MOS trend chart and stockout risk table, (4) render to Word with one click, (5) update automatically when a new data file is added.
Data Quality — Garbage In, Garbage Out
A perfectly designed dashboard built on inaccurate data produces confident-looking wrong answers — which are more dangerous than no analysis at all. This module teaches the five-step quality check routine that should precede every analysis.
A provincial quantification team uses facility-level consumption data to forecast ARV needs for the year. Three high-volume facilities have been reporting issues data rather than dispensing data — 15–20% higher than actual patient consumption. The resulting quantification overestimates demand by 12%. The province over-orders by approximately R18 million. Six months later, a warehouse manager reports that ARV buffer stocks are near expiry. The error was in the data, not the analysis.
- 01The five-step data quality check routine(1) Completeness: % of expected reports received. (2) Range: negative values, values above plausible maxima. (3) Consistency: stock accounting equation balance. (4) Timeliness: reports submitted within deadline. (5) Cross-validation: consumption vs. DHIS2 service data.
- 02Cross-validation: ARV consumption vs. patient numbersIf DHIS2 reports 340 ART patients, expected consumption = 340 × 30 = 10,200 tablets. A LMIS ratio above 1.2 (12,240+) suggests issues data is being reported, or there is stock diversion. Building the cross-validation ratio column in Excel and R.
# 1. Completeness — % of facility-months reporting
completeness <- data |>
group_by(facility, month) |>
summarise(n_products = n(), .groups = "drop") |>
mutate(complete = n_products >= 8)
cat("Reporting completeness:", round(mean(completeness$complete)*100,1), "%\n")
# 2. Range check — negative values
negatives <- data |> filter(SOH < 0 | consumption < 0)
cat("Records with negative values:", nrow(negatives), "\n")
# 3. Consistency — stock accounting equation
data <- data |>
mutate(
calc_cb = opening_balance + receipts - consumption - losses,
discrepancy = abs(calc_cb - closing_balance),
dq_flag = ifelse(discrepancy > 0, "Flag", "OK")
)
cat("Records with accounting discrepancy:",
sum(data$dq_flag == "Flag", na.rm=TRUE), "\n")
The Mpumalanga practice dataset contains deliberate data quality issues. Run all five checks. Produce a data quality summary table. Identify the three most serious problems and write one sentence each on their likely operational cause. Then write a 100-word data quality disclaimer for a report using this data.
Communicating Insights to Decision Makers
Analysis that doesn't inform a decision is wasted effort. This module builds the communication skills to convert supply chain findings into action — the one-page brief, the finding sentence, and the 10-minute district review presentation.
Weak: "The stockout rate for the period was 8.3%."
Strong: "Eight facilities experienced stockouts of first-line ARVs during the quarter, affecting an estimated 420 patients who missed at least one scheduled dispensing visit. This exceeds the 2% target and represents deterioration from 4.1% last quarter. Three facilities — Nhlazatshe, Daggakraal, and KwaMhlanga CHC — account for 70% of stockout days. Root cause analysis at these sites is scheduled for next week."
- 01The communication principle: problem → impact → actionEvery supply chain report must answer three questions: (1) What is the problem? (2) Why does it matter? (3) What should we do? If it doesn't answer all three, it is incomplete.
- 02Matching format and length to audienceFacility manager: 1-page stock status. District officer: 1–2 page snapshot + 5-minute brief. Provincial team: 2–4 page report. Donor: per framework template. Senior official: 3 bullet points maximum. Same data, six different formats.
- 01Six components of the one-page briefHeader (district, period, date). KPI scorecard (6 KPIs, values, targets, traffic lights). Top 3 concerns (quantified, facility-specific). Top 3 achievements. Corrective actions (owner + due date). Data quality note (reporting rate, caveats).
- 02The 10-minute district review presentation30 sec: where we are. 2 min: what the data shows. 3 min: root cause. 2 min: corrective actions. 2 min: decisions needed from the audience. Three slides maximum. Presenting supply chain data at a DHMT meeting with confidence.
Using your analysis from Modules 3–8: (1) Write the one-page district brief. (2) Prepare a 5-minute presentation — 3 slides maximum. (3) Present to your learning group. Peers evaluate: Does it answer all three questions? Is the top finding communicated in 60 seconds? Is there a clear ask of the audience?
Building a Culture of Data Use
Analysis skills without accountability structures produce reports that nobody reads. This module addresses the organisational side of supply chain analytics — removing barriers to data use, establishing VAN teams, and building a 90-day action plan.
- 01Data overload, time constraints, lack of confidenceData overload → select 6 core KPIs. Time constraints → automate with R. Lack of confidence → progressive skill building (exactly what this course provides). All three are addressable with the skills in this course.
- 02No feedback loop, accountability vacuum, poor data qualityLinking data use to performance reviews. Celebrating data-driven wins publicly. Building data quality fixes visibly so staff trust the numbers. The accountability structures that sustain a culture of data use.
5 min: Data quality review — reporting completeness, flag missing data. 10 min: KPI scorecard — six KPIs vs. targets, trend since last month. 15 min: Top 3 problems — root cause discussion, facility-specific. 5 min: Previous actions review — completed? If not, why? 10 min: New corrective actions — name, deadline, resource needed.
- 01Establishing a VAN team within existing district structuresMost South African districts already have a monthly DHMT meeting and a pharmaceutical subcommittee. The opportunity is to formalise supply chain data review using the dashboard from Module 5. One equipped officer can transform meeting quality within 2–3 months.
- 01Month 1 — Data foundationMap the data flow in your programme. Build the stock accounting check for last month's data. Calculate the six KPIs for the last available period. These three actions are achievable in the first 30 days regardless of system access.
- 02Month 2 — Dashboard and month 3 — Scale and sustainBuild the one-page dashboard. Present at the next district review. Install R and replicate the Excel analysis. Train one colleague. Document your analysis workflow so it can be reproduced by someone else when you move on.
Using the full Mpumalanga dataset (all 6 months, all facilities, all 8 products): Deliverable 1: Data quality report (3 findings, likely causes). Deliverable 2: Supply chain KPI dashboard in Excel (6 KPIs, heat map, trend chart). Deliverable 3: Stockout projection table in R (projected days of stock remaining for all facility-product combinations). Deliverable 4: One-page district supply chain brief. Deliverable 5: 10-minute presentation to the learning group — evaluated against the Module 9 communication checklist.
By the end of this course, you will be able to: