pft_interpret() combines the core reference-value and routine
interpretive stages of this package into a one-call research
workflow following the Stanojevic et al. ERJ 2022 standard. It
auto-detects which computations are possible from the input columns
and skips modalities it cannot compute:
If sex / age / height (and race, for
year = 2012) are present, it computes spirometry reference values viapft_spirometry().If sex / age / height are present, it computes lung-volume reference values via
pft_volumes().If sex / age / height are present, it computes diffusion reference values via
pft_diffusion().For each measure whose
_measuredcolumn is present, z-score and percent-predicted are appended (see the individual reference functions for details).For each measure with a z-score, a
<measure>_severitycolumn is appended viapft_severity()(orpft_severity_2005()whenstandard = "2005").If
fev1_measured,fvc_measured,fev1fvc_measured, andtlc_measuredcolumns are present, the ATS pattern classifier (pft_classify()) labels each row.If
tlc_measured,rv_tlc_measured, andfev1fvc_measuredare present (with their LLNs / ULNs computable), the lung- volume sub-pattern classifier (pft_volume_subpattern()) adds avolume_subpatterncolumn. Whenfrc_tlc_measured/frc_tlc_ulnare also present, both volume ratios are consulted per Stanojevic 2022 Figure 10.If the diffusion z-score columns (
dlco_zscore/va_zscore/kco_tr_zscore, or their_sivariants) are present, the Hughes & Pride 2012 diffusion clinical-category classifier (pft_diffusion_interpret()) is applied.If
fev1_measured,fev1fvc_measured, and their LLNs are resolvable,pft_prism()adds aprismflag (independent of TLC).If
<measure>_preand<measure>_postcolumns are present for any spirometry measure,pft_bdr()adds<measure>_bdr_pctand<measure>_bdr_significantcolumns (orpft_bdr_2005()whenstandard = "2005").
The following helpers are exported for stand-alone use and are
not invoked automatically by pft_interpret(); call them
directly when needed:
pft_gold()– GOLD 2026 spirometric airflow-limitation grade (GOLD 1-4).pft_fev1q()– FEV1Q survival index (adult-only).pft_quality()– Graham 2019 A-F spirometry session grade computed from maneuvers already judged acceptable by technical review (it does not assess acceptability itself).pft_change()– Stanojevic 2022 Box 2 conditional-change z-score for paired serial FEV1 z-scores.pft_dlco_hb_correct()– Cotes 1972 haemoglobin correction for DLCO / TLCO.
This is the recommended entry point for one-call research use; the individual reference-value, interpretive, and extension functions are exported for callers who need finer-grained control. The wrapper is intended for research and education, not for regulated clinical decision-making.
Usage
pft_interpret(
data,
year = 2022,
SI.units = FALSE,
standard = c("2022", "2005"),
sex = sex,
age = age,
height = height,
race = race
)Arguments
- data
A data frame containing whatever inputs are available. See Details for the column-name conventions.
- year
GLI spirometry equation year. Defaults to
2022(GLI Global, race-neutral). Seepft_spirometry().- SI.units
Whether to report diffusion in SI units. See
pft_diffusion().- standard
Interpretive standard whose downstream rules to apply:
"2022"(default) uses Stanojevic et al. ERJ 2022 for pattern classification, severity grading, and BDR;"2005"uses the Pellegrino et al. ERJ 2005 predecessor. The selected standard does not affect the GLI reference equations (those are controlled byyear) – only the downstream interpretive logic. Useful for reclassification analyses comparing the two standards on the same cohort.- sex, age, height, race
Column references for sex (
"M"/"F"), age (years), height (centimetres), and (foryear = 2012) race. By defaultpft_interpret()reads fromsex,age,height, andrace. Override via a bare name (sex = Sex), a string (sex = "Sex"), or an rlang injection (sex = !!my_var). See "Demographic input columns" for accepted values. The_measured,_pre, and_postcolumns are still auto-detected by name and not overridable.
Value
The original data frame with every applicable reference value, z-score, percent predicted, severity grade, pattern label, PRISm flag, and BDR result appended.
Details
To trigger z-scores and percent-predicted on a measure, include the
corresponding <measure>_measured column in data (e.g.
fev1_measured, frc_measured, dlco_measured).
To trigger BDR, include both columns of one or more of the pairs
fev1_pre / fev1_post, fvc_pre / fvc_post, and
fev1fvc_pre / fev1fvc_post. A _pre column holds the baseline
value obtained before bronchodilator administration, and the
matching _post column holds the value obtained after
bronchodilator administration under the laboratory's protocol, in
the same units. These labels are interpreted literally: pft does
not infer pre/post status from timestamps, values, medication
records, or curve shape, and the _measured columns are not used
for BDR. Under standard = "2022" the BDR denominator is the
<measure>_pred_<year> column, so the spirometry reference values
must be computable for that row.
If any of the sex / age / height columns cannot be found, the
reference-value stage is skipped and a message names the missing
columns. The remaining stages still run on whatever columns are
present (e.g. precomputed z-scores). Column names are not guessed:
map them with the sex, age, and height arguments. To silence
the message for a deliberate partial run, use
suppressMessages(pft_interpret(...), classes = "pft_message_reference_skipped").
Diffusion units follow SI.units; measured diffusion columns must
already be in that unit system (see pft_diffusion()).
No fixed number of decimal places is required for any numeric
input. pft does not screen measured values for physiologic
plausibility or technical quality; see vignette("input-format").
All outputs trace to a specific equation, table, or figure in
Stanojevic et al. ERJ 2022 or the underlying GLI reference papers; see
the @references blocks on the individual functions.
Demographic input columns
Read from the columns named by the sex, age, height, and race
arguments (by default the columns with those names). Values must
already be in the units below. pft does not detect or convert
units.
sex(character):"M"or"F". Case and whitespace variants, and"male"/"man"/"boy"/"female"/"woman"/"girl", are normalised to"M"/"F"with a warning. Unrecognised values becomeNA, with a warning.age(numeric): years; decimals allowed. Reference values are computed for ages 3-95 for spirometry (3-90 for FEF25-75 and FEF75), 5-80 for lung volumes, and 5-90 for diffusion; rows outside a range getNAfor that modality.height(numeric): centimetres.race(character): Required whenyear = 2012; ignored whenyear = 2022. One of"Caucasian","AfrAm","NEAsia","SEAsia","Other/mixed". Case variants and common synonyms (e.g."white","black","asian","other","mixed") are normalised with a warning. Unrecognised values becomeNA, with a warning.
Rows with NA in a demographic column get NA reference values.
A height entered in metres or inches is not caught: it produces
near-zero or otherwise meaningless reference values with no error.
pft does not screen inputs for physiologic plausibility.
See vignette("input-format") for the full input specification,
including units for the <measure>_measured columns.
References
Stanojevic S, Kaminsky DA, Miller MR, et al. ERS/ATS technical standard on interpretive strategies for routine lung function tests. Eur Respir J. 2022;60(1):2101499. doi:10.1183/13993003.01499-2021 .
Examples
patient <- data.frame(
sex = "M", age = 45, height = 178, race = "Caucasian",
fev1_measured = 2.5, fvc_measured = 3.8, fev1fvc_measured = 2.5/3.8,
tlc_measured = 6.0
)
pft_interpret(patient)
#> <pft_result>
#> Patient: 45 yo, M, 178 cm, Caucasian
#>
#> Measure Pred Measured Z Severity
#> FEV1 (2022) 3.87 2.5 -2.39 mild
#> FVC (2022) 4.81 3.8 -1.47 normal
#> FEV1/FVC (2022) 0.803 0.658 -2.14 mild
#> FRC 3.39 - - -
#> TLC 7.21 6 -1.45 normal
#> RV 1.72 - - -
#> RV/TLC 23.6 - - -
#> ERV 1.53 - - -
#> IC 3.87 - - -
#> VC 5.5 - - -
#> DLCO 30.3 - - -
#> KCO (tr) 4.58 - - -
#> VA 6.67 - - -
#>
#> Pattern: Obstructed (ANAN)
#> PRISm: FALSE
#>
#> Use `as_tibble(x)` or `as.data.frame(x)` for the full output (62 columns).
