Skip to content

Commit

Permalink
Update cohort definition set defs
Browse files Browse the repository at this point in the history
  • Loading branch information
azimov committed Oct 22, 2023
1 parent 469fbf3 commit 8e40887
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 28 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

S3method(rbind,cohortDefinitionSet)
export(CohortSubsetDefinition)
export(CohortSubsetOperator)
export(DemographicSubsetOperator)
Expand Down
5 changes: 3 additions & 2 deletions R/CohortConstruction.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,17 @@
#' }
#'
#' @export
generateCohortSet <- function(connectionDetails = NULL,
generateCohortSet <- function(cohortDefinitionSet,
connectionDetails = NULL,
connection = NULL,
cdmDatabaseSchema,
tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"),
cohortDatabaseSchema = cdmDatabaseSchema,
cohortTableNames = getCohortTableNames(),
cohortDefinitionSet = NULL,
stopOnError = TRUE,
incremental = FALSE,
incrementalFolder = NULL) {
cohortDefinitionSet <- as.cohortDefinitionSet(cohortDefinitionSet)
checkmate::assertDataFrame(cohortDefinitionSet, min.rows = 1, col.names = "named")
checkmate::assertNames(colnames(cohortDefinitionSet),
must.include = c(
Expand Down
18 changes: 5 additions & 13 deletions R/CohortDefinitionSet.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,14 @@ as.cohortDefinitionSet <- function(df) {
invisible(df)
}

# Define the cohortDefinitionSet class
setClass("cohortDefinitionSet", contains = "data.frame")
#' @export
rbind.cohortDefinitionSet <- function(...) {
print('foo')
base::rbind.default(...)

# Create a constructor for cohortDefinitionSet
cohortDefinitionSet <- function(...) {
obj <- new("cohortDefinitionSet", ...)
obj
return(NULL)
}

# Override the rbind method for cohortDefinitionSet
setMethod("rbind", signature(x = "cohortDefinitionSet", y = "cohortDefinitionSet"), function(x, y, ...) {
# Custom logic to combine two cohortDefinitionSet objects
combined_set <- data.frame(rbind(as.data.frame(x), as.data.frame(y)))
return(combined_set)
})

#' Create an empty cohort definition set
#'
#' @description
Expand Down
8 changes: 4 additions & 4 deletions man/createCohortSubsetDefinition.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions man/generateCohortSet.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8e40887

Please sign in to comment.