Creates a concept set for any domain except drugs. For drugs, use the createDrugConceptSet() function. Alternatively, you can call the createConceptSet() function which automatically routes to the correct function.

Follows the following flow:

  1. Determine the domain of the input, and retrieves corresponding concept filters and settings.

  2. If no seed concept IDs are provided, run the seed concept finder to find seed concepts.

  3. Run the concept recommender to get recommended concepts.

  4. Use the concept adjucator to adjudicate whether concepts belong to the concept set or not.

  5. Convert the approved concepts to a concept set expression. If condenseConceptSet = TRUE, a parsimoneous representation will be generated.

Steps 3 and 4 are executed twice.

Throws a warning of class NoApprovedConceptsWarning if none of the recommended concepts are approved during adjudication.

createNonDrugConceptSet(
  name,
  seedConceptIds = NULL,
  clinicalDefinition = NULL,
  llmClient,
  connectionDetails,
  vocabDatabaseSchema,
  tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"),
  cacheFolder = NULL,
  excludedVocabularyIds = c("ICDO3"),
  seedConceptFinder = DefaultSeedConceptFinder$new(),
  conceptRecommender = HecateConceptRecommender$new(),
  maxNforAdjudication = 5000,
  conceptAdjudicator = DefaultConceptAdjudicator$new(),
  condenseConceptSet = TRUE
)

Arguments

name

The name of the concept set to create. This should be an informative name reflecting the concept set target (the idea expressed by the concept set).

seedConceptIds

Optional: a set of one or more concept IDs that resemble the concept set target.

clinicalDefinition

Optional: a clinical definition of the concept set target.

llmClient

An ellmer chat object to connect to a large language model, as created for example using ellmer::chat_ollama().

connectionDetails

An object with details for connecting to a database server, as created using DatabaseConnector::createConnectionDetails().

vocabDatabaseSchema

The database and or schema where the OHDSI Vocabulary tables are loaded.

tempEmulationSchema

For database platforms that do not natively support temp tables, a database schema where the user has write access.

cacheFolder

Optional: Folder where intermediary results can be stored.

excludedVocabularyIds

Character vector of OHDSI Vocabulary names to exclude.

seedConceptFinder

An object of class SeedConceptFinder for finding seed concepts when not provided.

conceptRecommender

An object of class ConceptRecommender for recommending additional concepts.

maxNforAdjudication

If the number of concepts to adjudicate is greater than this number, a warning of class TooManyConceptsWarning is thrown, and the concept set will be simplified to the first seed concept plus descendants.

conceptAdjudicator

An object of class ConceptAdjudicator for adjudicating recommended concepts.

condenseConceptSet

Condense the resulting concept set?

Value

A concept set expression