OHDSI Home | Forums | Wiki | Github

Problem with Patient Level Prediction library

Hi all
i am trying to perform external validation with Patient level prediction.
I follow the guidelines as are dictated in this site:

even if i am able to create the external validation package and the results
however when i am trying to create the shiny app that includes the validation results
the app outputs the following error and crashes:

Warning: Error in do.call: ‘what’ must be a function or character string
65: do.call
64: getPlpResult [helpers.R#54]
63: [/home/yannis/R/x86_64-pc-linux-gnu-library/3.6/PatientLevelPrediction/shiny/PLPViewer/server.R#60]
47: plpResult
46: [/home/yannis/R/x86_64-pc-linux-gnu-library/3.6/PatientLevelPrediction/shiny/PLPViewer/server.R#165]
3: shiny::runApp
2: viewPlps
1: PatientLevelPrediction::viewMultiplePlp
Warning: Error in do.call: ‘what’ must be a function or character string
119:

the code that i run has the folllowing structure:

outputFolder<-"/blabla/testmodelsResults_ex"
mypackage::execute(connectionDetails = connectionDetails,
cdmDatabaseSchema = cdmDatabaseSchema,
cdmDatabaseName = cdmDatabaseName,
cohortDatabaseSchema = cohortDatabaseSchema,
cohortTable = cohortTable,
oracleTempSchema = oracleTempSchema,
outputFolder = outputFolder,
createProtocol = F,
createCohorts = T,
runAnalyses = T,
createResultsDoc = F,
packageResults = F,
createShiny = T,
# createValidationPackage = T,
createValidationPackage = T,
minCellCount= 5)
PatientLevelPrediction::viewMultiplePlp(outputFolder)

library(mypackageValidation)
outputFolder_val <-"/blabla/testmodelsResults_ex/Validation"

mypackageValidation::execute(connectionDetails = connectionDetails,
databaseName = cdmDatabaseName,
cdmDatabaseSchema = cdmDatabaseSchema,
cohortDatabaseSchema = cohortDatabaseSchema,
oracleTempSchema = oracleTempSchema,
cohortTable = cohortTable,
outputFolder = outputFolder_val,
createCohorts = T,
runValidation = T,
packageResults = F,
minCellCount = 5,
sampleSize = NULL)

mypackage::execute(connectionDetails = connectionDetails,
cdmDatabaseSchema = cdmDatabaseSchema,
cdmDatabaseName = cdmDatabaseName,
cohortDatabaseSchema = cohortDatabaseSchema,
cohortTable = cohortTable,
outputFolder =outputFolder,
minCellCount= 5,
createShiny = T)
PatientLevelPrediction::viewMultiplePlp(outputFolder)

Am i doing something wrong?

thank you in advance.

try:

library(PatientLevelPrediction)
viewMultiplePlp(outputFolder)

It seems it can’t find the ‘loadPlpResult’ function. Let me know if that works? If so, I’ll need to edit the skeleton Description to make sure PatientLevelPrediction is in the namespace when the skeleton study is loaded.

Hi i did as you mentioned, however the problem remains.
i still get the same error

What version of PatientLevelPrediction do you have - packageVersion(“PatientLevelPrediction”)?

Do you have results in the outputFolder?

I can’t see anything obvious in the current code that would make the column ‘plpResultLoad’ NULL but that must be happening?

My package version is 4.3.5
and actually i have data in the output folder that is the strange.

PatientLevelPrediction::viewMultiplePlp(outputFolder) uses the shiny app inside PatientLevelPrediction to view the results.

execute(…, createShiny = T) with any ATLAS package uses the old shiny app that is inside the study package and creates a shiny directory in the outputFolder. Try opening that old shiny app and see whether it works?

Hi actually by some debugging
i found that the problem occurs in this function:

getPlpResult ← function(result,validation,summaryTable, inputType,trueRow){
if(inputType == ‘plpResult’){
i ← trueRow
if(i ==1){
tempResult ← result
tempResult$type ← ‘test’
}else{
tempResult ← validation$validation[[i-1]]
tempResult$type ← ‘validation’
}
tempResult$log ← ‘log not available’
}else if(inputType == ‘plpNoClass’){
tempResult ← result
tempResult$type ← ‘validation’
tempResult$log ← ‘log not available’
}else if( inputType == ‘file’) {
tempResult ← NULL
loc ← summaryTable[trueRow,]$plpResultLocation
locLoaderFunc ← summaryTable[trueRow,]$plpResultLoad
logLocation ← gsub(‘plpResult’,‘plpLog.txt’, gsub(‘validationResult.rds’,‘plpLog.txt’,gsub(‘plpResult.rds’,‘plpLog.txt’, as.character(loc))))
if(file.exists(logLocation)){
txt ← readLines(logLocation)
} else{
txt ← ‘log not available’
}
if(file.exists(as.character(loc))){
tempResult ← do.call(as.character(locLoaderFunc), list(as.character(loc)))
tempResult$log ← txt
tempResult$type ← ifelse(length(grep(’/Validation’,loc))>0,‘validation’,‘test’)
}
}else {
stop(‘Incorrect class’)
}
return(tempResult)
}
In particular:
it gets as input trueRow=[1 3]
and collapses at the point:
f(file.exists(as.character(loc))){
tempResult ← do.call(as.character(locLoaderFunc), list(as.character(loc)))
tempResult$log ← txt
tempResult$type ← ifelse(length(grep(’/Validation’,loc))>0,‘validation’,‘test’)
}

since i dont know enough about the package,is it ok to get a list of trueRow without iteration
and returning results?,since i suspect either i have done a terrible configuration or it might be a bug?

kind regards
yannis

t