-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cohort subset to allow custom windowing #197
Conversation
|
||
# Start and end windows must always have subset anchor values set to support backwards compatibility | ||
if (!is.null(startWindow)){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THis section forces the old logic upon the user, which I dislike, but it also preseves the exact logic of the previous implementation. To me there is no perfect solution here...
cohortWindowLogic <- lapply(private$operator$windows, function(window) { | ||
lsql <- " AND (S.@s_cohort_anchor >= DATEADD(d, @window_start_day, T.@window_anchor) AND S.@s_cohort_anchor <= DATEADD(d, @window_end_day, T.@window_anchor))" | ||
SqlRender::render(lsql, | ||
window_anchor = ifelse(window$targetAnchor == "cohortStart", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're inclined, in the CI package the choice of start/end is simply 'start' or 'end' seen here:https://github.com/OHDSI/CohortIncidence/blob/09cf6aa3a6f4cfdbe99d04e38b61a85441fa3925/R/Classes.R#L547. If we want to adopt that moniker for choosing a start or end date to those choices instead of 'cohortStart' or 'cohortEnd'. I origionally had CI using same thing (with cohort in the label) but switched it out to be not cohort-specific but just simply a choice of start/end. Just pointing out where we might be consistent across packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, aside for a minor label tweak which can either stay or go. Thank you for this work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @azimov - I made a small change in 46d5903 to guide users towards using the newly implemented windows
parameter and that we'd deprecate the startWindow
and endWindow
parameters. Let me know if you have any objections.
I'm also going to open a new issue that will focus on the documentation of cohort subsetting, inclusive of these changes, to provide more working examples and details on how to use the various subset operators in the package.
This is designed to resolve Issue #175