Case study
OpsKwan
SaaS logistics for medical device distributors, deployed with Zimmer in 2011, managing the loaner sets they ship to hospitals, replenishment, recalls and lots.
- Client
- OpsKwan Technologies
- Dates
- 2009 to 2024
- of Canadian hospitals, for Zimmer Biomet's logistics
- 40%+
- commits on the shared platform, all mine, 2011 to 2023
- 1,641
- PHP
- CakePHP
- MySQL
- JavaScript
- IndexedDB
- AWS
The problem
OpsKwan came before Casechek and worked on the same problem from the other side: the medical device distributor’s, not the hospital’s.
An orthopaedic distributor owns loaner sets: the instruments and implants for a procedure, such as a hip replacement, packed as a set and shipped out to a hospital for a surgery, then shipped back. Managing those sets is the centre of it: where each one is, which hospital has it and for which case, when it’s due back, and what’s inside. Every item has a catalogue number, a lot and an expiry date, and when a manufacturer recalls a lot, the distributor has to know which sets and which hospitals are holding it.
The implants a surgery uses are bought, so a set comes back short and has to be replenished before it can go out again. And one company runs several distributors: when one has every set for a procedure out on loan, another may have one free.
Stock is counted with a barcode scanner, often with no connection, and the labels don’t agree with each other: each manufacturer encodes the same facts its own way.
My role
Director of Development at OpsKwan from 2009 to 2024. It started with one distributor: one of Zimmer’s distributors in British Columbia had a simple prototype, and hired me to turn the idea into a system it could sell to others. I built the new system from scratch, then extended it from one distributor to a company with many, and added a tracking system for each hospital.
I wrote the platform’s shared code, every commit in it from 2011 to 2023: the models, the barcode handling, the manufacturer imports and the offline audits.
What I built
- Surgery bookings. A booking app reps use on a phone or tablet, on the move: the procedure, the hospital, the surgeon and the sets it needs, on a shared calendar of scheduled surgeries. A past procedure can be copied to set up a new one, and templates hold the usual sets for each kind of procedure.
- Loaner sets. Sets and their contents down to lot and expiry, shipped to hospitals against bookings and back again, or passed straight on to the next surgery, with sterilisation and, later, biologics tracked back to their donors.
- Replenishment. What a surgery used is recorded against its booking, so the implants can be restocked and the set is complete before it goes out again. The hospital’s purchase orders are kept with the procedure.
- A network of distributors. Distributors in the same company work together: one with every set for a procedure out on loan can request one from another.
- Tracking at each hospital. The consignment stock each hospital holds, transfers between hospitals and between sales reps, and each rep’s own inventory.
- The manufacturer and its distributors on one system. Separate apps for the company and its distributors over the same code, with access set per company, distribution centre and hospital, so stock can be looked up instead of phoned about.
- A library of every set and implant. Set images, documents and contents in one place, a quick reference for reps and the logistics team.
- Sales budgets. Yearly budgets and actuals imported per distribution centre and compared by team, territory and month.
- Manufacturer imports. Each manufacturer’s ERP export arrives in its own format. Importers for Zimmer, DePuy and Wright load them into the client’s database; Zimmer’s is turned into bulk SQL each day, with the results mailed out.
- One database per client. Each client gets its own MySQL database beside a shared master database, and the platform builds a new client’s tables itself.
- Recalls and expiry. A recall list is imported, by product and lot, and a recalled lot is caught at the moment of scanning, online or offline. Stock is tracked to its expiry date, so it can be used before it has to be written off.
Architecture
A CakePHP application over MySQL, with its models, behaviors and drivers shared between the apps the company and its distributors used. The front end ran in the browser on tablets and phones, with scanners that type into the page; there was no native app.
The hard part
Reading implant labels in a storeroom with no signal
A hand-held scanner acts as a keyboard: it types the barcode into whatever field has focus. That’s simple to deploy and hard to get right, because the barcode is the data.
The labels come in several forms. HIBC, the health industry’s barcode, puts a labeller code, catalogue number and unit of use in a primary symbol, and the lot and expiry in a secondary one, either joined to the primary or printed as a second barcode. The expiry is a Julian date, year and day of the year. GS1 labels carry the product number first, then the lot and expiry under numbered identifiers, in either order. Some older labels followed neither standard, and OpsKwan printed its own.
The server’s parser handles all of them, and I wrote a second one in the browser, for HIBC, GS1 and the simplest layouts, so audits work without a connection.
- Characters lost in transit. HIBC uses
+,/and$, and a+in a form post arrives as a space. Each scan was sent as character codes and rebuilt on the server. - Two-symbol labels. A batch of scans is split by line and the symbols are paired, in either order. The secondary carries a link character that has to match the primary’s check character, and a scan that doesn’t match is rejected rather than guessed.
- Finding the product. By catalogue number, then without leading zeros, then through a cross-reference table for numbers that differ between a manufacturer and a distributor.
- Offline. In 2013 audits moved into the browser: each scan is parsed there, checked against a preloaded product list, and stored in IndexedDB until it syncs.
- Recalls at the scanner. The recall list goes to the device too, and a recalled lot plays a warning sound instead of the usual one, online or not.
Two copies of a parser can drift. In 2019 I fixed a bug in the browser’s GS1 parser, where a lot read after the expiry kept the identifier’s digits; the server’s copy got the same fix eleven months later. It’s the clearest lesson in the code base: one parser, shared, beats two that agree most of the time.
Outcome
- Deployed with Zimmer, now Zimmer Biomet, in 2011, it ran their logistics for over 40% of Canadian hospitals.
- Thirteen years of the shared platform, from 2011 to 2023, every commit mine.
- Offline audits with recall checks at the scanner, built in 2013.