How it works
In clinical supply the same question comes up every week: how many kits should go to each site, and when? Send too few and a patient shows up with no kit. Send too many and they sit on a shelf until they expire.
I built this to compare a few reorder rules (the logic that decides when a site gets a shipment and how big it is). None of it is real trial data. I made the trials up so every rule could be tested on exactly the same ones.
How a run works
- Make up a trial. 78 sites, 10 countries, 500 patients, two arms. A patient gets a kit at enrollment and then one every 4 weeks. I put the messy parts in too: sites open late, start slow, some stall, visits slip a week either way, and now and then one gets missed.
- Play it week by week under each rule. Same patients, same visits. Only the shipping changes.
- Do it again, 200 times, with a different made-up trial each time. That's the Monte Carlo part. One trial can be lucky. 200 can't all be.
- Count what happened: kits short, kits expired, kits sitting on shelves, shipments sent.
The rules
Six of them, from the simplest to the one with machine learning:
About the machine learning
The last rule uses LightGBM, a tree-based model that's common in demand forecasting. I trained it on 40 separate made-up trials to predict what each site will need over the next 1 to 8 weeks.
I expected it to win. It didn't. It lands about where Expected visits does, a little worse (roughly 1 more kit short per trial). Looking back, that makes sense: most kits go to patients already on treatment, and their visits are already on the calendar. There isn't much left for a model to guess.
The dial and switches
Each position was run ahead of time (200 trials each), which is why the page doesn't need a server. I didn't re-tune the rules for each setting, on purpose. I wanted to see how they hold up when things don't go to plan.
- Safety cushion: how many extra kits a rule keeps around. Less means leaner shelves and more stockouts.
- Shipping time +1 week: every shipment takes a week longer.
- Shelf life: kits last 12, 24 (normal) or 36 months.
- Enrollment speed: sites enroll 30% slower or faster than planned.
- Enrollment shock: a surge (30% of sites suddenly enroll 3 times faster for 12 weeks) or a stall (30% of sites stop enrolling for 16 weeks).
What it doesn't do
- It's all made up, so use it to compare rules, not to forecast a real study.
- One kit type per arm. One depot, and it never runs out. Shipping times are fixed by region.
- No costs. Whether fewer kits beats fewer shipments depends on the drug and the couriers.