Generates Keeper profile for (a subset of) persons in the provided cohort.

generateKeeper(
  connectionDetails = NULL,
  connection = NULL,
  cdmDatabaseSchema,
  tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"),
  cohortDatabaseSchema,
  cohortTable,
  cohortDefinitionId,
  sampleSize = 20,
  personIds = NULL,
  keeperConceptSets,
  phenotypeName = NULL,
  useDescendants = TRUE,
  removePii = TRUE
)

Arguments

connectionDetails

An R object of type connectionDetails created using the DatabaseConnector::createConnectionDetails() function. Not required of connection is provided.

connection

The connection to the database server created using DatabaseConnector::connect(). Not required if connectionDetails is provided.

cdmDatabaseSchema

The name of the database schema that contains the OMOP CDM instance. Requires read permissions to this database. On SQL Server, this should specify both the database and the schema, so for example 'cdm_instance.dbo'.

tempEmulationSchema

Some database platforms like Oracle and Impala do not truly support temp tables. To emulate temp tables, provide a schema with write privileges where temp tables can be created.

cohortDatabaseSchema

The name of the database schema that is the location where the cohort to review is stored.

cohortTable

The tablename that contains the cohort to review.

cohortDefinitionId

The cohort definition ID that will be used for the cohort.

sampleSize

The maximum number of persons to randomly sample from the cohort.

personIds

Only persons with these IDs will be selected. Can be a vector of numeric or string (to avoid integer overflows).

keeperConceptSets

A data frame with Keeper concept sets as generated by generateKeeperConceptSets().

phenotypeName

(Optional) Name of the phenotype. Will be included in the output.

useDescendants

Include the descendants of the concepts specified in the keeperConceptSets, or use only the verbatim concepts?

removePii

Remove person identifiable information such as person ID and cohort start date from the output? Can be set to FALSE to allow the Keeper results to be joined to patient data later.

Value

Returns a tibble with fields

  • generatedId: A person-specific ID generated by this function.

  • startDay

  • endDay

  • conceptId

  • conceptName

  • category: "symptoms", "priorDisease", ...

  • target: Can be "Disease of interest", "Alternative diagnoses", "Both", "Other", or NA

This contains both the Keeper profiles themselves, as well as some meta-data such as the CDM source name, and cohort prevalence.