Learn R Programming

PatientLevelPrediction (version 4.3.10)

similarPlpData: Extract new plpData using plpModel settings use metadata in plpModel to extract similar data and population for new databases:

Description

Extract new plpData using plpModel settings use metadata in plpModel to extract similar data and population for new databases:

Usage

similarPlpData(
  plpModel = NULL,
  newConnectionDetails,
  newCdmDatabaseSchema = NULL,
  newCohortDatabaseSchema = NULL,
  newCohortTable = NULL,
  newCohortId = NULL,
  newOutcomeDatabaseSchema = NULL,
  newOutcomeTable = NULL,
  newOutcomeId = NULL,
  newOracleTempSchema = newCdmDatabaseSchema,
  sample = NULL,
  createPopulation = T,
  createCohorts = T
)

Arguments

plpModel

The trained PatientLevelPrediction model or object returned by runPlp()

newConnectionDetails

The connectionDetails for the new database

newCdmDatabaseSchema

The database schema for the new CDM database

newCohortDatabaseSchema

The database schema where the cohort table is stored

newCohortTable

The table name of the cohort table

newCohortId

The cohort_definition_id for the cohort of at risk people

newOutcomeDatabaseSchema

The database schema where the outcome table is stored

newOutcomeTable

The table name of the outcome table

newOutcomeId

The cohort_definition_id for the outcome

newOracleTempSchema

The temp coracle schema

sample

The number of people to sample (default is NULL meaning use all data)

createPopulation

Whether to create the study population as well

createCohorts

No longer used

Examples

Run this code
# NOT RUN {
# set the connection
connectionDetails <- DatabaseConnector::createConnectionDetails()
   
# load the model and data
plpModel <- loadPlpModel("C:/plpmodel")

# extract the new data in the 'newData.dbo' schema using the model settings 
newDataList <- similarPlpData(plpModel=plpModel, 
                              newConnectionDetails = connectionDetails,
                              newCdmDatabaseSchema = 'newData.dbo',
                              newCohortDatabaseSchema = 'newData.dbo',   
                              newCohortTable = 'cohort', 
                              newCohortId = 1, 
                              newOutcomeDatabaseSchema = 'newData.dbo', 
                              newOutcomeTable = 'outcome',     
                              newOutcomeId = 2)    
               
# get the prediction:
prediction <- applyModel(newDataList$population, newDataList$plpData, plpModel)$prediction
# }

Run the code above in your browser using DataLab