From 4a3505a864651146b16c4c4951499a5418016771 Mon Sep 17 00:00:00 2001 From: Anthony Sena Date: Mon, 16 Sep 2024 16:34:28 -0400 Subject: [PATCH] Add PLP RDMS to results (#166) * Add RDMS to PLP results * Update GHA dependencies --- .github/workflows/R_CMD_check_Hades.yaml | 4 ++-- R/Module-PatientLevelPrediction.R | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/R_CMD_check_Hades.yaml b/.github/workflows/R_CMD_check_Hades.yaml index 5887ede7..f5cf2832 100644 --- a/.github/workflows/R_CMD_check_Hades.yaml +++ b/.github/workflows/R_CMD_check_Hades.yaml @@ -85,7 +85,7 @@ jobs: - name: Upload source package if: success() && runner.os == 'Windows' && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: package_tarball path: check/*.tar.gz @@ -156,7 +156,7 @@ jobs: # # - name: Download package tarball # if: ${{ env.new_version != '' }} - # uses: actions/download-artifact@v2 + # uses: actions/download-artifact@v4 # with: # name: package_tarball # diff --git a/R/Module-PatientLevelPrediction.R b/R/Module-PatientLevelPrediction.R index cfeefcef..7c63443f 100644 --- a/R/Module-PatientLevelPrediction.R +++ b/R/Module-PatientLevelPrediction.R @@ -34,7 +34,7 @@ PatientLevelPredictionModule <- R6::R6Class( cohortDatabaseSchema = jobContext$moduleExecutionSettings$workDatabaseSchema, cdmDatabaseName = jobContext$moduleExecutionSettings$connectionDetailsReference, cdmDatabaseId = jobContext$moduleExecutionSettings$cdmDatabaseMetaData$databaseId, - # tempEmulationSchema = , is there s temp schema specified anywhere? + tempEmulationSchema = jobContext$moduleExecutionSettings$tempEmulationSchema, cohortTable = jobContext$moduleExecutionSettings$cohortTableNames$cohortTable, outcomeDatabaseSchema = jobContext$moduleExecutionSettings$workDatabaseSchema, outcomeTable = jobContext$moduleExecutionSettings$cohortTableNames$cohortTable @@ -73,6 +73,13 @@ PatientLevelPredictionModule <- R6::R6Class( fileAppend = NULL ) + resultsDataModel <- private$.getResultsDataModelSpecification() + CohortGenerator::writeCsv( + x = resultsDataModel, + file = file.path(resultsFolder, "resultsDataModelSpecification.csv"), + warnOnFileNameCaseMismatch = F + ) + private$.message(paste("Results available at:", resultsFolder)) }, #' @description Create the results data model for the module @@ -166,6 +173,19 @@ PatientLevelPredictionModule <- R6::R6Class( } return(modelDesignList) + }, + .getResultsDataModelSpecification = function() { + rdms <- CohortGenerator::readCsv( + file = private$.getResultsDataModelSpecificationFileLocation() + ) + rdms$tableName <-paste0(self$tablePrefix, rdms$tableName) + return(rdms) + }, + .getResultsDataModelSpecificationFileLocation = function() { + return(system.file( + file.path("settings", "resultsDataModelSpecification.csv"), + package = "PatientLevelPrediction" + )) } ) )