Skip to content

Commit

Permalink
Started class
Browse files Browse the repository at this point in the history
  • Loading branch information
azimov committed Oct 22, 2023
1 parent 78757f1 commit bda8e4a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions R/CohortDefinitionSet.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#' @template
as.cohortDefinitionSet <- function(df) {
df <- dplyr::as_tibble(df)
class(df) <- c(class(df), "cohortDefinitionSet")
invisible(df)
}

#' Create an empty cohort definition set
#'
#' @description
Expand All @@ -35,7 +42,9 @@ createEmptyCohortDefinitionSet <- function(verbose = FALSE) {
}
# Build the data.frame dynamically from the cohort definition set spec
df <- .createEmptyDataFrameFromSpecification(cohortDefinitionSetSpec)
invisible(df)


invisible(as.cohortDefinitionSet(df))
}

#' Is the data.frame a cohort definition set?
Expand Down Expand Up @@ -333,6 +342,7 @@ getCohortDefinitionSet <- function(settingsFileName = "Cohorts.csv",
}
}

cohortDefinitionSet <- as.cohortDefinitionSet(cohortDefinitionSet)
invisible(cohortDefinitionSet)
}

Expand Down Expand Up @@ -509,7 +519,7 @@ checkSettingsColumns <- function(columnNames, settingsFileName = NULL) {

.createEmptyDataFrameFromSpecification <- function(specifications) {
# Build the data.frame dynamically from the cohort definition set spec
df <- data.frame()
df <- dplyr::tibble()
for (i in 1:nrow(specifications)) {
colName <- specifications$columnName[i]
dataType <- specifications$dataType[i]
Expand Down

0 comments on commit bda8e4a

Please sign in to comment.