Skip to content

Commit

Permalink
plpModel works as a string when externally validating
Browse files Browse the repository at this point in the history
  • Loading branch information
egillax committed May 7, 2024
1 parent 4eb2e70 commit 88eca36
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions R/ExternalValidatePlp.R
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,16 @@ validateExternal <- function(validationDesignList,
database$outcomeIds <- design$outcomeId

allCovSettings <-
lapply(design$plpModelList, function(plpModel)
plpModel$modelDesign$covariateSettings)
lapply(design$plpModelList, function(plpModel) {
if (is.character(plpModel)) {
modelDesign <- ParallelLogger::loadSettingsFromJson(
normalizePath(file.path(plpModel, 'modelDesign.json'))
)
return(modelDesign$covariateSettings)
} else {
plpModel$modelDesign$covariateSettings
}
})
# compare all to first covSettings, if not the same stop
if (!Reduce(function(x, y)
x &&
Expand All @@ -470,7 +478,7 @@ validateExternal <- function(validationDesignList,
list(
databaseDetails = database,
restrictPlpDataSettings = design$restrictPlpDataSettings,
covariateSettings = design$plpModelList[[1]]$modelDesign$covariateSettings
covariateSettings = allCovSettings[[1]]
)
)
},
Expand Down Expand Up @@ -554,6 +562,9 @@ validateModel <-
outputFolder,
databaseName,
analysisName) {
if (is.character(plpModel)) {
plpModel <- loadPlpModel(plpModel)
}
result <- externalValidatePlp(
plpModel = plpModel,
plpData = plpData,
Expand Down

0 comments on commit 88eca36

Please sign in to comment.