Data
Medicine supply digital twin (13/14): which data prevent a plan from being manipulated
An alert rule only works if the data it needs exists. Detection probability with several rules, the cost of false alarms and why, by Bayes' theorem, more alerts doesn't always mean more control.
Before buying, the fictional system builds an annual needs plan: each unit proposes how much of each item it needs, a regional office reviews and a central office approves. It’s a process with many hands, and at each one someone could move the figures: a unit that inflates its order, a review that rubber-stamps everything without looking, a change after sign-off.
The twin doesn’t ask who’s honest. It asks something more useful for whoever designs the platform: what data must it keep so these behaviours get noticed?
Behaviours, rules and data
The twin seeds the simulated plan with actors showing known behaviours and tests alert rules against them. Each rule needs certain data; if the platform doesn’t keep it, the rule can’t run.
| Rule | What it detects | Data it needs | Sensitivity |
|---|---|---|---|
| R1 | Orders over 1.5× what it used | actual consumption per unit | 0.95 |
| R2 | Orders with over 6 months of stock | stock and expiry | 0.90 |
| R3 | Orders for a unit that isn’t operating | status of each unit | 0.95 |
| R4 | Orders items outside its care level | catalogue by care level | 0.95 |
| R5 | Approved hundreds of requests in minutes | review time per request | 0.70 |
| R6 | Changed the plan after sign-off | sealed audit log | 0.95 |
| R7 | Raised what the unit had requested | sealed audit log | 0.90 |
Sensitivity is how often the rule catches the behaviour when it exists and the data is there. It isn’t 1, because actors protect themselves too: they approve slowly, attach justifications, spread the increase around.
Several rules on the same behaviour
One behaviour can trigger more than one rule. Inflating the order, for example, can be caught by R1 (comparing against consumption) or R2 (if the unit also had stock to spare). If the rules fail independently, the behaviour goes unseen only if all of them fail:
The design question, then, isn’t which rule is cleverest, but which data is missing. In the aid, tick and untick the data sets and watch detection of each behaviour switch on or off. With only two of six data sets, average detection is 27 %; with all six, 91 %.
The cost of false alarms
Every rule also errs the other way: it flags honest requests. A unit that really did open a new service orders more than the year before, and R1 flags it. If each rule wrongly flags a share of honest requests, with active rules the share of honest requests flagged by at least one is
With and 7 rules, of honest requests fall under suspicion.
Bayes: of the flagged ones, how many are real?
What matters to whoever reviews an alert is the probability that the flagged request really was manipulated. If prevalence (the share of manipulated requests) is , Bayes’ theorem gives the positive predictive value:
That’s why the twin measures both at once: what’s stopped in time and what’s wrongly accused. More data helps in both directions, because a rule with good data can be stricter: a unit that ordered more, but whose patient list grew and whose new service is registered, has no reason to be flagged.
The twin in Planning › Plan integrity (“Planeación › Integridad del plan”): switch the platform’s data on or off and see which behaviors get detected. (Interface in Spanish.) · Open full screen
What the twin delivers
This module’s output isn’t a list of culprits: the data is synthetic. It’s a list of data and fields the platform must create from the start (actual consumption, stock, unit status, review times, a log that can’t be edited) and the quantitative case for why each one is worth what it costs to keep.
What comes next
The last post brings everything together. A control tower that looks at the whole chain with a traffic light per link and answers the hard question: when the patient doesn’t get their medicine, whose failure is it?