ohdsi-studies / PioneerWatchfulWaiting

This study is part of the joint PIONEER - EHDEN - OHDSI studyathon in March 2021, and aims to advance understanding of clinical management and outcomes of watchful waiting in prostate cancer.
Apache License 2.0
7 stars 18 forks source link

Negative time to event values for 3 target cohorts #84

Closed keesvanbochove closed 3 years ago

keesvanbochove commented 3 years ago

The current time to event generation feature (which fits a survival curve over several combinations of target/strata cohorts vs outcome cohorts) generates up to -180 days negative values in 3 cohorts (and their strata permutations):

It seems that the outcomes fed to the model occur before the index event in these target cohorts.

keesvanbochove commented 3 years ago
problem

As visible in this screenshot, these cohorts (T2 in this case) sometimes seem to generate entries where the end date is before the start date. Combined with the fact that TimeToEvent.sql takes the max of the target cohort end dates in cases where there is no matching outcome cohort, this leads to the negative time to event values. So we need to debug these cohort definitions.

MaximMoinat commented 3 years ago

Issue is in adding a fixed amount of days (180 or 548) to the cohort start_date. The cohort end_date could be within those days.

https://github.com/ohdsi-studies/PioneerWatchfulWaiting/blob/8e40ba3525109c01ea429df1d6e888b67388b864/inst/sql/sql_server/104.sql#L1196

MaximMoinat commented 3 years ago

The proposed fix in #86 will remove persons that might be eligible. In case a person has a censoring event (e.g. malignancy) before the offset index date, then this person will have a cohort_end before it. But only after this offset index date it should run.

The DATEADD should be here: https://github.com/ohdsi-studies/PioneerWatchfulWaiting/blob/081d70955c318074cb470615b2cc36cb7e93a7f7/inst/sql/sql_server/103.sql#L215-L216

keesvanbochove commented 3 years ago

See discussion under #86 and #87, for now have added in the fix from #86.