OHDSI / FeatureExtraction

An R package for generating features (covariates) for a cohort using data in the Common Data Model.
http://ohdsi.github.io/FeatureExtraction/
61 stars 60 forks source link

Can Feature Extraction support computation with respect to target cohort_end_date #181

Open gowthamrao opened 1 year ago

gowthamrao commented 1 year ago

Feature Extraction calculates the occurrence of Covariates in relation to target cohort_start_date. Is it possible to add a parameter that allows it to switch from cohort_start_date to cohort_end_date

Specifically: in the various SQL's in Feature Extraction, the SQL is something like this

  ON @domain_start_date <= DATEADD(DAY, time_period.end_day, cohort.cohort_start_date)
  AND @domain_end_date >= DATEADD(DAY, time_period.start_day, cohort.cohort_start_date)

or

  ON covariate_cohort.cohort_start_date <= DATEADD(DAY, time_period.end_day, cohort.cohort_start_date)
  WHERE covariate_cohort.cohort_end_date >= DATEADD(DAY, time_period.start_day, cohort.cohort_start_date)

Can we introduce a switch that now changes cohort.cohort_start_date to cohort.cohort_end_date

  ON covariate_cohort.cohort_start_date <= DATEADD(DAY, time_period.end_day, cohort.**cohort_end_date**)
  covariate_cohort.cohort_end_date >= DATEADD(DAY, time_period.start_day, cohort.**cohort_end_date**)

Use Case: An easy use case is to understand the characteristics of a person at some time-window of discontinuation from continuous drug treatment era, such as what happened at the time periods in relation to stopping a statin therapy. One way we can calculate this is today is to build a cohort using custom SQL where cohort_start_date is drug_era_end_date, as standard tools like Atlas cannot index a cohort based on end of a drug_era. But, if FE can calculate covariates based on cohort_end_date, then we can start thinking of cohort_end_date diagnostics.

cohort_end_date characterization/diagnostics may help answer questions like

1) what was the visit context at around the time of exit 2) What were the events at around the time of exit (new diagnosis, new treatments) 3) We can also compare the characteristics of cohort on cohort_start_date to characteristics on cohort_end_date.

Related to https://github.com/OHDSI/CohortDiagnostics/issues/298

anthonysena commented 1 year ago

Thanks @gowthamrao - this should be possible and I'll need to stage this in for development.