
Extract Harmonized Inpatient Lab Panels with Outlier Sanitization
Source:R/features.R
extract_standard_labs.RdExtract Harmonized Inpatient Lab Panels with Outlier Sanitization
Usage
extract_standard_labs(
con,
cohort_table = "cohort",
cohort_id = NULL,
panel = "core_14",
aggregation = "last_before_discharge",
window = "stay",
winsorize = TRUE,
format = "df"
)Arguments
- con
Active DuckDB connection (DBI::dbConnect).
- cohort_table
Name of cohort table (default
"cohort").- cohort_id
Optional cohort definition ID filter.
- panel
Standard lab panel to extract (default
"core_14").- aggregation
Aggregation strategy (
"last_before_discharge","first_on_admission","mean","median","min","max").- window
Windowing scope (
"stay","lookback","all").- winsorize
Logical
TRUEto clamp to physiologic bounds, numeric vectorc(low_q, high_q)for percentile winsorization, orFALSEfor raw values.- format
Output format (
"df","arrow").
Value
A data.frame or arrow::Table of harmonized laboratory values.