Back

PySpiro: A Python Library for Lung Function Reference Equations and Severity Classification

Pott, H.; Schmeck, B.; Heider, D.; Martin, R.

2026-10-07 health informatics
10.64898/2026.10.06.26364407 medRxiv
Show abstract

Background and Objective: Lung function reference equations are essential for interpreting spirometry and related modalities, yet existing tools are fragmented, modality- and language-specific (predominantly R), and lack integrated severity classifiers. We present PySpiro, an open-source Python library unifying 23 spirometry, 1 multiple breath washout, 2 diffusing capacity, 1 static lung volume, and 2 oscillometry reference equations under a single API, with 10 clinical severity classifiers. Methods: PySpiro was implemented in Python 3 using NumPy and pandas, with all equations coded directly from literature. The unified API exposes predicted medians, z-scores, limits of normal (LLN/ULN), and raw Lambda-Mu-Sigma (LMS) triplets per parameter, plus a vectorised compute() method for batch processing at the DataFrame level. Unit-tests covering every equation and classifier verify agreement with published values and confirm correct boundary, out-of-range, and missing-input handling. Results: PySpiro covers spirometry equations from 1971 to 2022 across Caucasian, Asian, Indian, and race-neutral global populations, plus non-spirometry modalities (multiple breath washout, diffusing capacity, static lung volumes, oscillometry). Classifiers span COPD, interstitial lung disease, pattern and severity grading, bronchodilator reversibility, and primary ciliary dyskinesia. Compared with rspiro (5 equations, 4 spirometry) and the only prior Python package (spiref, 2 equations, no z-scores or % predicted), PySpiro offers substantially broader coverage, multi-modality support, a richer output API, and 10 classifiers absent from both. Conclusions: PySpiro is freely available (PyPI: pyspiro; doi:10.5281/zenodo.15519193) and provides a comprehensive, validated, and extensible platform for lung function data analysis in research pipelines.

Matching journals

The top 8 journals account for 50% of the predicted probability mass.

50% of probability mass above

"Similar papers" are the closest papers from that journal in the model's embedding space. They show what the match is built on, but the ranking comes mostly from a classifier over the whole training set, not from these examples alone.