
Write your own features so the OHDSI tools read them
Source:R/custom_covariates.R
write_custom_features.RdWrites a wide data frame (person_id, a date column and one numeric column per feature) as covariates that
FeatureExtraction, PatientLevelPrediction and DeepPatientLevelPrediction read like any other. This is how a study adds its
own version of a feature OMOP already defines (a Charlson index, an Elixhauser score, a frailty index) next to the standard
one: give it its own name (charlson_site) and extract both with the same covariate settings.
Usage
write_custom_features(
con,
features,
labels = NULL,
date_col = "date",
registry = NULL,
...
)Arguments
- con
A DBI connection to an OMOP DuckDB.
- features
Wide data frame with
person_id, the date column, optionallyvisit_occurrence_id, and one column per feature.- labels
Optional named character vector of concept names,
c(feature = "label").- date_col
Name of the date column (default
"date").- registry
Optional shared registry that pins the concept ids (see
register_custom_concepts()).- ...
Passed to
write_custom_covariates().
Value
The concepts list used (see register_custom_concepts()); pass its ids to custom_covariate_settings().