diff --git a/R/cohort.R b/R/cohort.R index 93d15576..56412ee7 100644 --- a/R/cohort.R +++ b/R/cohort.R @@ -425,15 +425,15 @@ writeCohort <- function(x, path) { # } -capr_to_circe <- function(cd) { - - circeJson <- toCirce(cd) %>% - jsonlite::toJSON(auto_unbox = TRUE, pretty = TRUE) %>% - as.character() - - return(circeJson) - -} +# capr_to_circe <- function(cd) { +# +# circeJson <- toCirce(cd) %>% +# jsonlite::toJSON(auto_unbox = TRUE, pretty = TRUE) %>% +# as.character() +# +# return(circeJson) +# +# } #' Make a cohort dataframe for cohort generator #' @param ... multiple capr cohorts to bind into a dataframe @@ -456,7 +456,7 @@ makeCohortSet <- function(...) { cohortName <- names(cohortList) # get cohort json - cohortJson <- purrr::map_chr(cohortList, ~capr_to_circe(.x)) + cohortJson <- purrr::map_chr(cohortList, ~compile(.x)) # get ohdsi sql ohdsiSql <- purrr::map_chr( diff --git a/vignettes/Examples.Rmd b/vignettes/Examples.Rmd index 52860276..42355521 100644 --- a/vignettes/Examples.Rmd +++ b/vignettes/Examples.Rmd @@ -53,10 +53,12 @@ cs1 <- cs(descendants(443238, 201820, 442793), ch <- cohort( entry = conditionOccurrence(cs1), attrition = attrition( - atLeast(1, - observationPeriod(), + withAll( + atLeast(1, + observationPeriod(), #function not currently in Capr duringInterval(eventStarts(-Inf, -365, "startDate")) ) + ) ), exit = exit( endStrategy = observationExit() @@ -112,8 +114,12 @@ ch <- cohort( observationWindow = continuousObservation(priorDays = 365) ), attrition = attrition( - exactly(0, conditionOccurrence(cs1), duringInterval(eventStarts(-Inf, 0))), + 't1d' = withAll( + exactly(0, conditionOccurrence(cs1), duringInterval(eventStarts(-Inf, 0))) + ), + 'secondaryDiabetes' = withAll( exactly(0, conditionOccurrence(cs2), duringInterval(eventStarts(-Inf, 0))) + ) ), exit = exit( endStrategy = observationExit() @@ -224,8 +230,8 @@ ch <- cohort( observationWindow = continuousObservation(priorDays = 365) ), attrition = attrition( - "no prior T2DM" = exactly(0, conditionOccurrence(cs0), duringInterval(eventStarts(-Inf, 0))), - "no prior secondary T1DM" = exactly(0, conditionOccurrence(cs2), duringInterval(eventStarts(-Inf, 0))) + "no prior T2DM" = withAll(exactly(0, conditionOccurrence(cs0), duringInterval(eventStarts(-Inf, 0)))), + "no prior secondary T1DM" = withAll(exactly(0, conditionOccurrence(cs2), duringInterval(eventStarts(-Inf, 0)))) ) )