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

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
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Being Pydantic about Medical Research Software

Zenodo (CERN European Organization for Nuclear Research)
Cell Image Analysis Techniques
article

Being Pydantic about Medical Research Software

article en

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.

Zenodo (CERN European Organization for Nuclear Research)
IHI Corporation (United States) (US)
Partnerships for the goals
Openalex Percentile: Top 79%
Cell Image Analysis Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.