PySpiro: A Python Library for Lung Function Reference Equations and Severity Classification
- 1Institute of Medical Informatics, University of Muenster, Muenster, Germany
Abstract
Background and ObjectiveLung 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.
MethodsPySpiro 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.
ResultsPySpiro 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.
ConclusionsPySpiro 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.
Related
- Adopting Global Lung Function Initiative Reference Equations Alters Pulmonary Function Testing Interpretation in a Safety-Net Cohort.
- Multimodal fusion of SpO₂ time series and clinical data for explainable classification of obstructive sleep apnea severity
- Modeling Factors Associated with Smoking Dependence Severity Using Binary Classification-Based Machine Learning: Prediction with Hematological and Demographic Patient Data
- Quantitative CT features for COPD classification and GOLD spirometric severity assessment: a single-center model-development study
- Perceived severity and benefits show a preliminary conditional association with kidney-protective behaviors in type 2 diabetes with early kidney function decline: an exploratory health belief model analysis
BibTeX
@misc{pott2026pyspiro,
title = {{PySpiro: A Python Library for Lung Function Reference Equations and Severity Classification}},
author = {H. Pott and B. Schmeck and D. Heider and R. Martin},
howpublished = {medRxiv},
year = {2026},
month = oct,
doi = {10.64898/2026.10.06.26364407},
url = {https://www.medrxiv.org/content/10.64898/2026.10.06.26364407v1},
note = {CC BY},
}
RIS
TY - UNPB
TI - PySpiro: A Python Library for Lung Function Reference Equations and Severity Classification
AU - H. Pott
AU - B. Schmeck
AU - D. Heider
AU - R. Martin
PY - 2026
DA - 2026/10/06
PB - medRxiv
DO - 10.64898/2026.10.06.26364407
UR - https://www.medrxiv.org/content/10.64898/2026.10.06.26364407v1
AB - Background and ObjectiveLung 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. MethodsPySpiro 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. ResultsPySpiro 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. ConclusionsPySpiro 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.
ER -