
Clinical velocity, LACE-proxy, hemodynamic and organ-dysfunction features
Source:R/velocity.R
engineer_clinical_features.RdFaithful port of engineer_features() (sections 1-5) in scripts/engineer_clinical_features.py, pinned to it by a
golden file produced by the script itself (shared with the Python tests). Same function as
omop_etl.velocity.engineer_clinical_features.
Arguments
- df
A data.frame with (some of) REQUIRED_VELOCITY_INPUTS;
med_*columns (not*_legacy) feedpolypharmacy_count, andelix_*/med_*columns feed thecombo_*interactions when present.- warn_missing
Warn about absent input columns.
Value
df with VELOCITY_FEATURES (and combo_*) added.
Details
Reference semantics worth knowing: missing days_since_prior_* become 365 then clip to >= 1; LACE length-of-stay points
use an exact integer match (1, 2, 3 -> 1, 2, 3; 4-6 -> 4; 7-13 -> 5; >= 14 -> 7), so a fractional or zero LOS scores 0;
missing vitals and labs are imputed with fixed normal values (HR 75, SBP 120, DBP 80, BUN 15, creatinine 1, hemoglobin
13, albumin 3.8, eGFR 85, sodium 140, potassium 4.2, anion gap 10), so missing is indistinguishable from normal
downstream. Absent input columns are created as all-missing and reported with a warning. The reference's target-encoded
site_baseline_risk leaks validation labels and is not included; see site_baseline_risk().