Being Pydantic about Medical Research Software
Year: 2024
Type: article
Abstract: Research software is full of unwritten rules, like the fact that an image s Z axis should come before Y, that a Point Spread Function is actually an array, or that tally of 67.5 cells is not a mistake. Unless these rules are formalized in code, it can be difficult to avoid logic errors at runtime and difficult for a new developer to extend the application. This presentation will look at two projects undertaken by WEHI Research Computing to improve research software quality by leveraging developments in Python s type system and powerful libraries such as Pydantic, typer, fastapi and magicgui. Together, these make it possible to encode domain logic in Python programs, check for valid parameters at runtime, and even generate user interfaces automatically. napari-lattice, the first of these projects, processes the output of a Lattice Lightsheet microscope to prepare it for downstream analysis. The second project, called Cyton2, implements a model of immune cell population dynamics to estimate biological parameters such as division rate. One challenge for both of these applications was the need to share logic between multiple interfaces such as graphical plugin, web API server, command-line application and Python library. With the completion of these two projects, both applications have become easy to modify. They now feature well documented classes, a library of reusable data types, guaranteed safety from type errors, excellent autocompletion support, and minimal redundancy. End users also benefit from clear errors, automatic documentation and a user-friendly Python interface.
Author: Milton, Michael
Institution: Walter and Eliza Hall Institute of Medical Research
Language: English
Subfield: Information Systems and Management
Field: Decision Sciences
Domain: Social Sciences
Open Access status: green
OpenAlex ID: W6893165160
FWCI:
Cites:
Cited by:
Related to:
