PACS Maintenance Tasker
A deletion job for a medical image archive, built around the three things it has to be right about before removing anything it cannot get back.
- Area
- Healthcare · Medical imaging
- Main stack
- TypeScript · Node.js · SQLite · SQL
Key features
- • Deciding and acting are two functions, so a dry run and a real run cannot disagree
- • The record system answers in three shapes, not two: rows, an empty answer, or no answer at all
- • A verdict with one of ten written reasons, computed as a pure function over data
- • The mistaken version of the rule is kept beside the correct one and measured against it
- • Real folders on a real disk, with a switch that makes a removal fail halfway
- • Three claims that each return true or false, and a build that fails when one stops holding
About the project
Deleting a study is not one operation but two, across two databases owned by different products and joined on nothing but an accession number both sides happen to write down. There is no transaction and no undo, and once the files and the row that pointed at them are both gone there is nothing left to notice with. This is about what has to be true before such a job runs.
Three claims carry it, and each is written so it can fail. A dry run and a real run choose the same studies, because deciding and acting are two functions rather than a flag checked inside a loop: written the usual way, the dry run failed to mention nine of the 255 studies it was about to delete.
Nothing is removed because the record system said nothing: an empty result is an ordinary return value, so it falls through to whatever the last line happens to be, and that cost twenty-three patients’ studies on a run where nothing errored. And when the second of two deletions fails, the next run can finish it.
Technologies used
TypeScript
Node.js
SQLite
SQL
REST API
Playwright
GitHub Actions