Closed keesvanbochove closed 3 years ago
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.
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.
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
See discussion under #86 and #87, for now have added in the fix from #86.
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.