Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:OHDSI/Capr into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ablack3 committed Sep 6, 2023
2 parents ec9f312 + bc63c2f commit d75253d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
20 changes: 10 additions & 10 deletions R/cohort.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down
16 changes: 11 additions & 5 deletions vignettes/Examples.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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))))
)
)
Expand Down

0 comments on commit d75253d

Please sign in to comment.