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

Wrong join key in GetAttrCovariates.sql #138

Open ggamit opened 3 years ago

ggamit commented 3 years ago

In GetAttCovariates.sql cohort_table and cohort_attribute_table are joined using:

ON cohort_attribute.subject_id = cohort.subject_id AND cohort_attribute.cohort_definition_id = cohort.cohort_definition_id AND cohort_attribute.subject_id = cohort.subject_id

It seems that the last line should be: AND cohort_attribute.cohort_start_date = cohort.cohort_start_date

Otherwise, multiple occurrences of a subject in a cohort results in duplicated covariate rows, which triggers an error from createPs ("Repeated row-column entry")

monamak commented 3 years ago

True! the third join condition is just a repetition of the first one. Modification commited!