R/ConceptAdjudicator.R
DefaultConceptAdjudicator.RdDefaultConceptAdjudicator constructor
This adjudicator implements a 2-stage concept adjudication process using prompts. If the number of input concepts
is greater than or equal to nForQuickScreen, the quickscreen stage is entered. In this stage,
quickScreenBatchSize concepts at a time are fed to the LLM using the quickScreenPrompt and
quickScreenSystemPrompt prompts. Any remaining concepts go on to stage 2, where batchSize concepts are fed to
the LLM using the prompt and
systemPrompt prompts.
The following placeholders in the prompts will be replaced with their actual values when adjudicating:
%name%: The name of the concept set (the concept set target).
%definition%: The clinical definition of the concept set. If not provided during adjudication, the entire line with this placeholder will be deleted.
%concepts%: A JSON string representing the candidate concepts.
The following JSON output formats is expected for the main concept adjudication. This should include all concepts from the input:
[
{
"conceptId": <Candidate Concept id>,
"conceptName": "<Candidate Concept name>",
"decision": "<KEEP or REMOVE>",
"rationale": "<Brief rational for the decision>"
}
]The following JSON output formats is expected for the quick screening. This should include only concepts to remove*:
[
{
"conceptId": <Candidate Concept id>,
"conceptName": "<Candidate Concept name>",
"rationale": "Brief explanation of why the concept does not imply the Target Term"
}
]If a prompt is not provided in this constructor it will assume the default value included in this package.
To disable the quick screen stage, set nForQuickScreen = 999999.
ConceptAdjudicator -> DefaultConceptAdjudicator
DefaultConceptAdjudicator$new()DefaultConceptAdjudicator$new(
batchSize = 20,
nForQuickScreen = 500,
quickScreenBatchSize = 200,
prompt = NULL,
systemPrompt = NULL,
quickScreenPrompt = NULL,
quickScreenSystemPrompt = NULL
)batchSizeThe number of concepts to adjudicate at once.
nForQuickScreenThe minimum number of concepts to trigger the quick screening.
quickScreenBatchSizeThe number of concepts to enter quick screening at once.
promptThe prompt for the main concept adjudication. See Details for requirements
systemPromptThe system prompt for the main concept adjudication. See Details for requirements
quickScreenPromptThe prompt for the quick screening. See Details for requirements
quickScreenSystemPromptThe system prompt for the quick screening. See Details for requirements
DefaultConceptAdjudicator$adjudicateConcepts()Adjudicates concepts using the default LLM implementation.
DefaultConceptAdjudicator$adjudicateConcepts(
concepts,
name,
clinicalDefinition = NULL,
llmClient,
costTracker = NULL
)conceptsAn object of type Concepts as created using asConcepts().
nameThe name of the concept set.
clinicalDefinitionOptional: a clinical definition of the concept set target.
llmClientAn ellmer chat object to connect to a large language model, as created for example using
ellmer::chat_ollama().
costTrackerAn environment with an amount variable for keeping track of the total LLM costs.