OHDSI / OHDSI/FeatureExtraction

Wrong join key in GetAttrCovariates.sql

Open
#138 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
74
Forks
63
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by opening GetAttCovariates.sql and inspecting the join between cohort_table and cohort_attribute_table. Verify the repeated-row behavior through createPs, then confirm that multiple occurrences of a subject no longer produce duplicated covariate rows or the "Repeated row-column entry" error.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, sql
Domain
data, databases
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.