Skip to content

inconsistent handling of repeated rows in cohort #287

@jreps

Description

@jreps

If a cohort has repeated rows (a person is in multiple times with the same id and dates) FE returns odd values.

The SQL counts code does a distinct so the repeated rows are removed when counting how often a concept occurs. However, the denominator, personCount does not do a distinct, see https://github.com/OHDSI/FeatureExtraction/blob/437570aa6a955486f9a4ab5917d64ac857971ed4/R/GetCovariates.R#L154C3-L155C3

This means if a cohort is a repeat of the same row 10 times, and the person has concept 54545 then the count for concept 54545 will be 1, but the person count will be 10. Then FE will return 10% when it should be 100%.

I think the easiest fix would be to edit https://github.com/OHDSI/FeatureExtraction/blob/437570aa6a955486f9a4ab5917d64ac857971ed4/R/GetCovariates.R#L154C3-L155C3 to count(*) after selecting distinct * to ensure multiple rows are only counted once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions