Being Pydantic about Medical Research Software
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.
Institutions
- IHI Corporation (United States) (US)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2024-10-30
- DOI
- https://doi.org/10.5281/zenodo.15293448
- Primary Topic
- Cell Image Analysis Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00