Case Study: Sleepmed

Aaron TaylorCase Studies Leave a Comment


Sleepmed is a biomedical company that focuses on improving the health and quality of life of those who suffer from sleep disorders. Sleepmed is the nation’s leader in sleep diagnosis and provides services to more than 80,000 patients annually in one of their 200 labs located in 32 states across the USA. To accomplish this task they created hardware that automatically collects a few gigabytes of important diagnostic data on patients when they sleep. These data are automatically reduced and processed to reveal important events which are later interpreted by sleep specialists.


SleepMed was in the process of developing new data collection hardware which, in principle, could share a significant fraction of the code base with the existing hardware. However, in order to accommodate the new hardware a significant fraction of the code needed to be refactored and modularized while maintaining perfect feature parity due to FDA compliance requirements. ArrayFire was hired to create a comprehensive test suite for each step of the data processing pipeline, perform the refactoring, and produce encyclopedic documentation for the software.


ArrayFire began this process by accessing the number of tests that were required to maintain FDA compliance. Given that this number was in the thousands, we built a small, dedicated computing cluster to test the code while we made revisions. After this, we maliciously parsed the code looking for distinct modules. We extracted each module, wrote unit tests, and verified their compatibility with the old code using “gold standard” data tests developed by SleepMed engineers.


ArrayFire modularized the code from 225k lines of code with no modularity to 100k lines of code with 33 distinct modules. Each module now has its own testing framework and set of “gold standard” input/output reference data. With the code modularized, SleepMed now has the ability to hire contractors to work on any single module. The contractors, in turn, need only run tests for their module and a handful of full-system tests to verify that their modifications did not break any existing functionality. These changes permitted SleepMed to integrate their new hardware into the existing pipeline with ease without the onerous and expensive task of seeking FDA approval for new data analysis software.

Leave a Reply

Your email address will not be published. Required fields are marked *