Middelhoek.com

LabServer

  • LabServer Patients window
  • LabServer Samples window
  • LabServer Thyroid SetPoint window

LabServer is a Web Application for the storage and analysis of medical data. It was birthed from the Thyroid SPOT project as its central database.

The first implementation was in PHP using the Laravel web framework. Its only function was to provide a RESTful API to the database with medical data, i.e. the patient profiles and their thyroid lab samples. Determining the homeostatic set point of the thyroid (setpoint) from these lab samples was left to companion Apps on the different platforms.

ThyroidAnalyzer is a demonstration client App for the iPhone and iPad platform. It is basically the client version of ThyroidLab. Currently, its functionality is limited to calculating the setpoint for the patients in the database. For this it uses an integrated implementation of ParX. Because at that time the server was written in PHP, and ParX is written in Swift, the two could not be integrated on the server. Therefore, the calculation of the setpoint had to be performed on the client side.

ThyroidAnalyzer patients screen
ThyroidAnalyzer setpoint screen

Vapor is a web framework for Swift, allowing you to write backends, Web Apps, APIs and HTTP servers in Swift. I had been interested in server-side Swift for a few years already, but with many competing frameworks, and a rapid succession of incompatible versions, I deemed it too early to commit. In 2020, when version 4 of Vapor was released, the dust cleared, and we had a winner. As a demonstrator I decided to re-implement the LabServer project in Vapor, and make it a complete web application by moving ParX to the server side.

To enable the transition of ParX to the server side, i.e. Linux, the Mac App had to be cleanly split in its UI and numerical engine. This resulted in the ModesLib library that completely encapsulates the Mode-Selection algorithm that is at the heart of ParX as a portable SPM package. On Linux it transparently uses the Clapack library, instead of the Apple Accelerate framework, for the numerical heavy lifting.

On Laravel, all web pages were build in PHP, which is also a templating language. On Vapor all pages are compiled and static. We must therefore lean more heavily on JavaScript to provide the dynamics. The backbone of the pages is provided by Bootstrap, which is supplemented with footable.js for the dynamic tables, and plotly.js for the graphing. On Laravel the dynamic pages could access the backend directly, now all access goes through a RESTful API using Ajax calls.

LabServer is a production-ready web application that has been deployed on Azure and as a Docker image. The current "Thyroid" implementation should be seen as a demonstration of its abilities, and not as its limitation. It would be easy to target any other data-acquisition and analysis application. Inquiries are invited, and can be directed at About