diff --git a/.github/workflows/R_CMD_check_Hades.yaml b/.github/workflows/R_CMD_check_Hades.yaml index f7c4ea17e..8f940f131 100644 --- a/.github/workflows/R_CMD_check_Hades.yaml +++ b/.github/workflows/R_CMD_check_Hades.yaml @@ -87,13 +87,13 @@ jobs: path: check/*.tar.gz - name: Install covr - if: runner.os == 'Windows' + if: runner.os == 'Linux' run: | remotes::install_cran("covr") shell: Rscript {0} - + - name: Test coverage - if: runner.os == 'Windows' + if: runner.os == 'Linux' run: covr::codecov() shell: Rscript {0} diff --git a/DESCRIPTION b/DESCRIPTION index ac9fde8ac..700eef1c1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -75,5 +75,5 @@ Remotes: ohdsi/FeatureExtraction, ohdsi/ShinyAppBuilder, ohdsi/ResultModelManager, -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 Encoding: UTF-8 diff --git a/R/AdditionalCovariates.R b/R/AdditionalCovariates.R index 790fe9df4..77204d1de 100644 --- a/R/AdditionalCovariates.R +++ b/R/AdditionalCovariates.R @@ -30,7 +30,7 @@ #' @param cohortTable the table name that contains the target population cohort #' @param rowIdField string representing the unique identifier in the target population cohort #' @param aggregated whether the covariate should be aggregated -#' @param cohortId cohort id for the target cohort +#' @param cohortIds cohort id for the target cohort #' @param covariateSettings settings for the covariate cohorts and time periods #' #' @return @@ -45,7 +45,7 @@ getCohortCovariateData <- function( cohortTable = "#cohort_person", rowIdField = "row_id", aggregated, - cohortId, + cohortIds, covariateSettings ){ @@ -69,7 +69,7 @@ getCohortCovariateData <- function( sql, covariate_cohort_schema = covariateSettings$cohortDatabaseSchema, covariate_cohort_table = covariateSettings$cohortTable, - covariate_cohort_id = covariateSettings$cohortId, + covariate_cohort_id = covariateSettings$cohortIds, cohort_temp_table = cohortTable, row_id_field = rowIdField, startDay = covariateSettings$startDay, @@ -191,7 +191,7 @@ createCohortCovariateSettings <- function( covariateId = cohortId*100000+settingId*1000+analysisId, cohortDatabaseSchema = cohortDatabaseSchema, cohortTable = cohortTable, - cohortId = cohortId, + cohortIds = cohortId, startDay = startDay, endDays = endDay, count = count, diff --git a/R/CyclopsModels.R b/R/CyclopsModels.R index 83c61f098..16f035164 100644 --- a/R/CyclopsModels.R +++ b/R/CyclopsModels.R @@ -211,7 +211,8 @@ fitCyclopsModel <- function( trainDetails = list( analysisId = analysisId, analysisSource = '', #TODO add from model - developmentDatabase = attr(trainData, "metaData")$cdmDatabaseSchema, + developmentDatabase = attr(trainData, "metaData")$cdmDatabaseName, + developmentDatabaseSchema = attr(trainData, "metaData")$cdmDatabaseSchema, attrition = attr(trainData, "metaData")$attrition, trainingTime = paste(as.character(abs(comp)), attr(comp,'units')), trainingDate = Sys.Date(), diff --git a/R/DataSplitting.R b/R/DataSplitting.R index 35519801d..29e7a1ea3 100644 --- a/R/DataSplitting.R +++ b/R/DataSplitting.R @@ -148,6 +148,7 @@ splitData <- function(plpData = plpData, outcomeId = attr(population, "metaData")$outcomeId, targetId = attr(population, "metaData")$targetId, cdmDatabaseSchema = plpData$metaData$databaseDetails$cdmDatabaseSchema, + cdmDatabaseName = plpData$metaData$databaseDetails$cdmDatabaseName, cdmDatabaseId = plpData$metaData$databaseDetails$cdmDatabaseId, restrictPlpDataSettings = attr(population, "metaData")$restrictPlpDataSettings, covariateSettings = plpData$metaData$covariateSettings, @@ -186,6 +187,7 @@ splitData <- function(plpData = plpData, outcomeId = attr(population, "metaData")$outcomeId, targetId = attr(population, "metaData")$targetId, cdmDatabaseSchema = plpData$metaData$databaseDetails$cdmDatabaseSchema, + cdmDatabaseName = plpData$metaData$databaseDetails$cdmDatabaseName, cdmDatabaseId = plpData$metaData$databaseDetails$cdmDatabaseId, restrictPlpDataSettings = attr(population, "metaData")$restrictPlpDataSettings, covariateSettings = plpData$metaData$covariateSettings, diff --git a/R/HelperFunctions.R b/R/HelperFunctions.R index 5c9d1ae3f..c6fd07d13 100644 --- a/R/HelperFunctions.R +++ b/R/HelperFunctions.R @@ -1,6 +1,8 @@ # fix issue with nrow - temp fix for me locally nrow <- function(x){UseMethod("nrow",x)} +#' @exportS3Method NULL nrow.default <- base::nrow +#' @exportS3Method NULL nrow.tbl <- function(x){x %>% dplyr::tally() %>% dplyr::pull()} diff --git a/R/KNN.R b/R/KNN.R index 54ef1528d..834b26eaa 100644 --- a/R/KNN.R +++ b/R/KNN.R @@ -145,7 +145,8 @@ fitKNN <- function(trainData, modelSettings, search = 'none', analysisId, ...){ trainDetails = list( analysisId = analysisId, - developmentDatabase = attr(trainData, "metaData")$cdmDatabaseSchema, + developmentDatabase = attr(trainData, "metaData")$cdmDatabaseName, + developmentDatabaseSchema = attr(trainData, "metaData")$cdmDatabaseSchema, attrition = attr(trainData, "metaData")$attrition, trainingTime = paste(as.character(abs(comp)), attr(comp,'units')), trainingDate = Sys.Date(), diff --git a/R/PatientLevelPrediction.R b/R/PatientLevelPrediction.R index b4e2a82b5..848c42705 100644 --- a/R/PatientLevelPrediction.R +++ b/R/PatientLevelPrediction.R @@ -20,12 +20,11 @@ #' #' @description A package for running predictions using data in the OMOP CDM #' -#' @docType package #' @name PatientLevelPrediction #' @keywords internal #' @importFrom dplyr %>% #' @importFrom rlang .data -NULL +"_PACKAGE" #' A simulation profile #' @docType data diff --git a/R/RClassifier.R b/R/RClassifier.R index 69b575193..a74e2358b 100644 --- a/R/RClassifier.R +++ b/R/RClassifier.R @@ -83,7 +83,8 @@ fitRclassifier <- function( trainDetails = list( analysisId = analysisId, analysisSource = '', #TODO add from model - developmentDatabase = attr(trainData, "metaData")$cdmDatabaseSchema, + developmentDatabase = attr(trainData, "metaData")$cdmDatabaseName, + developmentDatabaseSchema = attr(trainData, "metaData")$cdmDatabaseSchema, attrition = attr(trainData, "metaData")$attrition, trainingTime = paste(as.character(abs(comp)), attr(comp,'units')), trainingDate = Sys.Date(), diff --git a/R/Simulation.R b/R/Simulation.R index ae9c8e34a..b1d115c14 100644 --- a/R/Simulation.R +++ b/R/Simulation.R @@ -162,7 +162,8 @@ simulatePlpData <- function(plpDataSimulationProfile, n = 10000) { metaData = list() metaData$databaseDetails <- list( - cdmDatabaseSchema = 'Profile', + cdmDatabaseSchema = 'CDM_SCHEMA', + cdmDatabaseName = "CDM_NAME", outcomeDatabaseSchema = NULL, cohortDatabaseSchema = NULL, connectionDetails = NULL, diff --git a/R/SklearnClassifier.R b/R/SklearnClassifier.R index 4e386b705..8d4a2603c 100644 --- a/R/SklearnClassifier.R +++ b/R/SklearnClassifier.R @@ -115,7 +115,8 @@ fitSklearn <- function( trainDetails = list( analysisId = analysisId, analysisSource = '', #TODO add from model - developmentDatabase = attr(trainData, "metaData")$cdmDatabaseSchema, + developmentDatabase = attr(trainData, "metaData")$cdmDatabaseName, + developmentDatabaseSchema = attr(trainData, "metaData")$cdmDatabaseSchema, attrition = attr(trainData, "metaData")$attrition, trainingTime = paste(as.character(abs(comp)), attr(comp,'units')), trainingDate = Sys.Date(), diff --git a/man/PatientLevelPrediction.Rd b/man/PatientLevelPrediction.Rd index c3d7c5c47..8bc15fc71 100644 --- a/man/PatientLevelPrediction.Rd +++ b/man/PatientLevelPrediction.Rd @@ -2,9 +2,32 @@ % Please edit documentation in R/PatientLevelPrediction.R \docType{package} \name{PatientLevelPrediction} +\alias{PatientLevelPrediction-package} \alias{PatientLevelPrediction} \title{PatientLevelPrediction} \description{ A package for running predictions using data in the OMOP CDM +} +\seealso{ +Useful links: +\itemize{ + \item \url{https://ohdsi.github.io/PatientLevelPrediction} + \item \url{https://github.com/OHDSI/PatientLevelPrediction} + \item Report bugs at \url{https://github.com/OHDSI/PatientLevelPrediction/issues} +} + +} +\author{ +\strong{Maintainer}: Jenna Reps \email{jreps@its.jnj.com} + +Authors: +\itemize{ + \item Martijn Schuemie + \item Marc Suchard + \item Patrick Ryan + \item Peter Rijnbeek + \item Egill Fridgeirsson +} + } \keyword{internal} diff --git a/man/getCohortCovariateData.Rd b/man/getCohortCovariateData.Rd index ff152f84b..d5333d646 100644 --- a/man/getCohortCovariateData.Rd +++ b/man/getCohortCovariateData.Rd @@ -12,7 +12,7 @@ getCohortCovariateData( cohortTable = "#cohort_person", rowIdField = "row_id", aggregated, - cohortId, + cohortIds, covariateSettings ) } @@ -31,7 +31,7 @@ getCohortCovariateData( \item{aggregated}{whether the covariate should be aggregated} -\item{cohortId}{cohort id for the target cohort} +\item{cohortIds}{cohort id for the target cohort} \item{covariateSettings}{settings for the covariate cohorts and time periods} } diff --git a/tests/testthat/test-covariateExtras.R b/tests/testthat/test-covariateExtras.R index a454761d7..dc1f8ebd2 100644 --- a/tests/testthat/test-covariateExtras.R +++ b/tests/testthat/test-covariateExtras.R @@ -113,7 +113,7 @@ covs <- FeatureExtraction::getDbCovariateData( cohortTable = "cohort", cohortDatabaseSchema = "main", cohortTableIsTemp = F, - cohortId = 1, + cohortIds = c(1), rowIdField = 'rowId', covariateSettings = covSet, aggregated = F