Skip to contents

FeatureExtraction, PatientLevelPrediction and ATLAS know only OMOP tables. A feature that is not in the CDM (an area deprivation index, a risk score, an alternative definition of a standard feature) becomes visible to them when it is written as measurement rows with a site-defined concept id (at least 2,000,000,000, the OMOP convention). Studies then extract it with the standard tool, and an alternative definition of an existing feature sits beside the standard one under its own concept id, so the two can be compared (see compare_feature_tables()) before one is chosen.

Usage

write_custom_covariates(
  con,
  values,
  concepts,
  source = "omop_etl.custom_covariates",
  visit_ids = FALSE,
  register_concepts = TRUE,
  type_concept_id = 45754907
)

Arguments

con

A DBI connection to an OMOP DuckDB.

values

A long data frame: person_id, date (the date the value applies to), feature (a name in concepts), value (numeric), and optionally visit_occurrence_id. Missing values write no row.

concepts

Named list; each element is c(concept_id, concept_name) (concept id as number, at least 2e9).

source

Written to measurement_source_value.

visit_ids

Link rows to visit_occurrence_id when that column is present in values.

register_concepts

Add the concepts to concept (Measurement domain) when that table exists.

type_concept_id

Measurement type concept; default 45754907 ("Derived value").

Value

The number of rows written (invisibly).

Details

Re-running replaces the rows of the same concepts for the same persons. unit_concept_id is 0 because FeatureExtraction joins measurement covariates on the unit and skips rows where it is NULL.