Skip to contents

Assembles the cohort, outcome and covariate tables from as_plp_arrow() into the plpData structure that PatientLevelPrediction::createStudyPopulation() and runPlp() accept (and so DeepPLP). Observation-period arithmetic (daysFromObsStart, daysToObsEnd) and age / gender come from observation_period / person on con; rows with no observation period around their index date are dropped with a warning. Covariate ids are the 1-based positions in covariate_ref (analysis id 1), not FeatureExtraction's concept * 1000 + analysis.

Usage

plp_arrow_to_plp_data(
  plp_arrow,
  con,
  target_id = 1L,
  outcome_id = 1L,
  days_to_event = 1,
  cohort_end_days = 0
)

Arguments

plp_arrow

Result of as_plp_arrow() built with an outcome_col.

con

DuckDB connection holding observation_period and person.

target_id, outcome_id

Ids recorded in the cohort and outcome tables.

days_to_event

Day (relative to index) at which a positive label is placed (scalar or per row).

cohort_end_days

Days from index to cohort end.

Value

A plpData object.