-
Notifications
You must be signed in to change notification settings - Fork 70
/
pruneCDM.r
28 lines (24 loc) · 1.16 KB
/
pruneCDM.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#' @title Prune a CDM.
#'
#' @description This function is simply a convenience wrapper for the other calls. (Eunomia support)
#'
#' @param connectionDetails An R object of type\cr\code{connectionDetails} created using the
#' function \code{createConnectionDetails} in the
#' \code{DatabaseConnector} package.
#' @param cdmSchema The name of the database schema that contains the CDM.
#' Requires read and write permissions to this database. On SQL
#' Server, this should specify both the database and the schema,
#' so for example 'cdm_instance.dbo'.
#' @param cdmVersion The version of your CDM. Currently "5.3.1" and "5.4.0".
#'
#'@export
pruneCDM <- function(connectionDetails, cdmSchema, cdmVersion) {
writeLines("Getting event data...")
eventData <-
getEventConceptId(connectionDetails, cdmSchema, cdmVersion)
eventConceptId <- eventData$CONCEPT_ID
writeLines("Backing up cdm...")
backupCDM(connectionDetails, cdmSchema, cdmVersion)
writeLines("Pruning cdm...")
createPrunedTables(connectionDetails, cdmSchema, eventConceptId)
}