From a7944704393df385933676c32b142bd942f56867 Mon Sep 17 00:00:00 2001 From: Henrik John Date: Mon, 29 Jul 2024 15:40:13 +0200 Subject: [PATCH] Use population and restrict data settings from model --- Main.R | 15 +++++++++++---- renv.lock | 5 ++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Main.R b/Main.R index 68ca2c1..2b05592 100644 --- a/Main.R +++ b/Main.R @@ -78,18 +78,24 @@ getModelInfo <- function(strategusOutputPath) { databaseMetaDataPath <- file.path(directoryPath, "database_meta_data.csv") modelDesign <- file.path(directoryPath, "model_designs.csv") cohorts <- file.path(directoryPath, "cohorts.csv") + populationSettingsPath <- file.path(directoryPath, "population_settings.csv") + plpDataSettingsPath <- file.path(directoryPath, "plp_data_settings.csv") modelData <- read.csv(modelFilePath) databaseDetails <- read.csv(databaseDetailsPath) databaseMetaData <- read.csv(databaseMetaDataPath) modelDesign <- read.csv(modelDesign) cohorts <- read.csv(cohorts) + populationSettings <- read.csv(populationSettingsPath) + plpDataSettings <- read.csv(plpDataSettingsPath) modelData$plp_model_file <- file.path(directoryPath, "models", basename(modelData$plp_model_file)) - + enrichedData <- merge(modelData, databaseDetails, by = "database_id") finalModelData <- merge(enrichedData, databaseMetaData, by.y = "database_id", by.x = "database_meta_data_id") finalModelData <- merge(finalModelData, modelDesign, by = "model_design_id") + finalModelData <- merge(finalModelData, populationSettings, by = "population_settings_id") + finalModelData <- merge(finalModelData, plpDataSettings, by = "plp_data_settings_id") finalModelData <- merge(finalModelData, cohorts, by.x = "outcome_id", by.y = "cohort_id") finalModelData <- within(finalModelData, { outcome_id <- cohort_definition_id @@ -109,7 +115,8 @@ getModelInfo <- function(strategusOutputPath) { } } finalSelectedData <- combinedData %>% - select(cdm_source_abbreviation, analysis_id, model_design_id, model_type, target_id, outcome_id, plp_model_file) + select(cdm_source_abbreviation, analysis_id, model_design_id, model_type, target_id, outcome_id, plp_model_file, + plp_data_settings_json, population_settings_json) } getSharedResourceByClassName <- function(sharedResources, className) { @@ -222,8 +229,8 @@ execute <- function(jobContext) { design <- PatientLevelPrediction::createValidationDesign( targetId = df$target_id[1], outcomeId = df$outcome_id[1], - populationSettings = PatientLevelPrediction:::createStudyPopulationSettings(), - restrictPlpDataSettings = PatientLevelPrediction::createRestrictPlpDataSettings(), + populationSettings = NULL, # use setting from model + restrictPlpDataSettings = NULL, # use setting from model plpModelList = as.list(df$plp_model_file) ) designs[[i]] <- design # Adding elements to a list diff --git a/renv.lock b/renv.lock index 376c51e..6e273a4 100644 --- a/renv.lock +++ b/renv.lock @@ -128,14 +128,13 @@ }, "PatientLevelPrediction": { "Package": "PatientLevelPrediction", - "Version": "6.3.8", "Source": "GitHub", "RemoteType": "github", "RemoteHost": "api.github.com", - "RemoteUsername": "ohdsi", "RemoteRepo": "PatientLevelPrediction", + "RemoteUsername": "ohdsi", "RemoteRef": "develop", - "RemoteSha": "9e8925377bd078400af8294c29f982e58f60c3f7" + "RemoteSha": "fb31e2fee1c8c654d673557a7a737333c8f7601b" }, "R6": { "Package": "R6",