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")
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")