Skip to content

Commit

Permalink
Merge pull request #16 from hadley/dbplyr-2.5.0
Browse files Browse the repository at this point in the history
dbplyr 2.5.0 forward compatibility
  • Loading branch information
ablack3 authored Feb 27, 2024
2 parents 6498ef6 + 1f6395b commit 8c5ff15
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/cohortTransformations.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ cohort_collapse <- function(x) {
dbplyr::window_order(.data$cohort_start_date, .data$cohort_end_date) %>%
dplyr::mutate(
prev_start = dplyr::coalesce(
dbplyr::win_over(
!!dbplyr::win_over(
min_start_sql,
partition = c("cohort_definition_id", "subject_id"),
frame = c(-Inf, -1),
order = "cohort_start_date",
con = con),
.data$cohort_start_date),
prev_end = dplyr::coalesce(
dbplyr::win_over(
!!dbplyr::win_over(
max_end_sql,
partition = c("cohort_definition_id", "subject_id"),
frame = c(-Inf, -1),
Expand Down Expand Up @@ -208,7 +208,7 @@ cohort_pad_end <- function(x, days = NULL, from = "end") {

x %>%
dplyr::ungroup() %>%
dplyr::mutate(cohort_end_date = CDMConnector::dateadd(date = date_col, number = days, interval = "day")) %>%
dplyr::mutate(cohort_end_date = !!CDMConnector::dateadd(date = date_col, number = days, interval = "day")) %>%
cohort_collapse() %>% # TODO what if end < start, remove row?
dplyr::filter(.data$cohort_start_date <= .data$cohort_end_date)
}
Expand Down Expand Up @@ -237,7 +237,7 @@ cohort_pad_start <- function(x, days = NULL, from = "start") {
date_col <- paste0("cohort_", from, "_date")

x %>%
dplyr::mutate(cohort_start_date = CDMConnector::dateadd(date = date_col, number = days, interval = "day")) %>%
dplyr::mutate(cohort_start_date = !!CDMConnector::dateadd(date = date_col, number = days, interval = "day")) %>%
dplyr::ungroup() %>%
cohort_collapse() %>%
dplyr::filter(.data$cohort_start_date <= .data$cohort_end_date)
Expand Down

0 comments on commit 8c5ff15

Please sign in to comment.