Skip to content

Commit

Permalink
document specification creation function and fix list elements to new…
Browse files Browse the repository at this point in the history
… validatExternal function in PLP
  • Loading branch information
egillax committed Oct 1, 2024
1 parent 93ae511 commit 4a7cf53
Showing 1 changed file with 37 additions and 19 deletions.
56 changes: 37 additions & 19 deletions SettingsFunctions.R
Original file line number Diff line number Diff line change
@@ -1,26 +1,43 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#' Create specifications for the PatientLevelPredictionValidationModule
#'
#' @param validationComponentList a list of the components neccesary for the validationDesigns
#' to be created. Each component in the list is a list with the following list items:
#' - restrictPlpDataSettings: created with `PatientLevelPrediction::createRestrictPlpDataSettings` or
#' a list of such objects
#' - populationSettings: created with `PatientLevelPrediction::createStudyPopulationSettings` or a list
#' of such objects
#' - recalibrate: a string with the recalibration method to use, either `weakRecalibration` pr `calibrationInTheLarge`
#' - runCovariateSummary: `TRUE`/`FALSE` indicating if the `covariateSummary` should be run
#'
#' @return
#' An object of type `PatientLevelPredictionValidationModuleSpecifications`.
#'
#' @export
createPatientLevelPredictionValidationModuleSpecifications <- function(
validationComponentsList = list(
list(
targetId = 1,
oucomeId = 4,
restrictPlpDataSettings = PatientLevelPrediction::createRestrictPlpDataSettings(), # vector
validationSettings = PatientLevelPrediction::createValidationSettings(
recalibrate = "weakRecalibration"
),
populationSettings = PatientLevelPrediction::createStudyPopulationSettings(
riskWindowStart = 90,
riskWindowEnd = 360,
requireTimeAtRisk = F
)
restrictPlpDataSettings = PatientLevelPrediction::createRestrictPlpDataSettings(),
populationSettings = PatientLevelPrediction::createStudyPopulationSettings(),
recalibrate = "weakRecalibration",
runCovariateSummary = TRUE
),
list(
targetId = 3,
oucomeId = 4,
restrictPlpDataSettings = PatientLevelPrediction::createRestrictPlpDataSettings(), # vector
validationSettings = PatientLevelPrediction::createValidationSettings(
recalibrate = "weakRecalibration"
)

restrictPlpDataSettings = PatientLevelPrediction::createRestrictPlpDataSettings(),
populationSettings = PatientLevelPrediction::createStudyPopulationSettings(),
recalibrate = "calibrationInTheLarge",
runCovariateSummary = FALSE
)
)
) {
Expand All @@ -34,4 +51,5 @@ createPatientLevelPredictionValidationModuleSpecifications <- function(
)
class(specifications) <- c("PatientLevelPredictionValidationModuleSpecifications", "ModuleSpecifications")
return(specifications)
}
}

0 comments on commit 4a7cf53

Please sign in to comment.