ruca_feature(): USDA RUCA of the residence ZIP at admission:ruca_code(primary code) andruca_group(1 metropolitan, 2 micropolitan, 3 small town / rural). Same concept ids as GEOGRAPHY_CONCEPT_IDS.sdi_feature(): Robert Graham Center SDI:sdi_scoreandsdi_quintile(1 least to 5 most deprived) with the training cohort's fixed cut points; errors without them unless computed withfit = TRUE.area_feature(): any ZIP-keyed numeric table (ACS median household income, % below poverty, ADI ...) as a patient feature, withnone/log1p/percentile/zscoretransforms fitted on the training sites only, an optional missing indicator (<name>_missing) and optional median imputation. Learned parameters live in the feature state.sql_feature(): one SQL query over the OMOP tables; it selectsstay_idand the numeric columns from a view_stays(person_id, stay_id, admit_date). Use only data dated before the admission (unless the protocol says otherwise).custom_feature(): your own R functionfn(con, stays)returningstay_idand the numeric columns.
Usage
ruca_feature(crosswalk, name = "ruca", code_99_missing = TRUE)
sdi_feature(table, cut_points = NULL, name = "sdi")
area_feature(
name,
table,
value_column = NULL,
key_column = NULL,
transform = "none",
impute = FALSE,
missing_indicator = TRUE,
description = "",
label = NULL,
state = list()
)
sql_feature(
name,
sql,
columns,
requires = character(),
description = "",
labels = character(),
params = list()
)
custom_feature(
name,
columns,
fn,
requires = character(),
description = "",
labels = character(),
params = list()
)Arguments
- crosswalk, table
Data frame or CSV path (RUCA crosswalk; SDI or area table).
- name
Feature name (also the output column of
area_feature()).- code_99_missing
Treat USDA RUCA 99 as unknown.
- cut_points
Four ascending SDI scores from the training cohort.
- value_column, key_column
Columns of the area table (defaults: the only value column; a ZIP-like column).
- transform
One of
none,log1p(right-skewed dollars),percentile(position in the training distribution, 0-1),zscore(training mean and sd).- impute
Fill unmapped ZIPs with the training median of the transformed value.
- missing_indicator
Add the
<name>_missingcolumn.- description, label
Free text for the manifest and the concept name.
- state
Optional named list of fitted state (from a training site).
- sql
SQL for
sql_feature().- columns
Output columns of
sql_feature()/custom_feature().- requires
OMOP tables the feature needs.
- labels
Named character vector of concept names.
- params
JSON-serialisable settings recorded in the manifest.
- fn
function(con, stays)forcustom_feature().
