| Type: | Package |
| Title: | Construct Cohort Inclusion and Restriction Criteria Expressions |
| Version: | 1.4.0 |
| Date: | 2026-11-01 |
| Maintainer: | Chris Knoll <cknoll@ohdsi.org> |
| Description: | Wraps the 'CIRCE' (https://github.com/ohdsi/circe-be) 'Java' library allowing cohort definition expressions to be edited and converted to 'Markdown' or 'SQL'. |
| License: | Apache License 2.0 |
| URL: | https://ohdsi.github.io/CirceR/, https://github.com/OHDSI/CirceR/ |
| BugReports: | https://github.com/OHDSI/CirceR/issues/ |
| SystemRequirements: | Java (>= 8) |
| Depends: | R (≥ 3.5.0) |
| Imports: | rJava, RJSONIO |
| Suggests: | testthat, knitr, rmarkdown, reticulate |
| NeedsCompilation: | no |
| Language: | en-US |
| Encoding: | UTF-8 |
| Config/roxygen2/version: | 8.0.0 |
| Packaged: | 2026-11-02 15:14:27 UTC; cknoll1 |
| Author: | Chris Knoll [aut, cre], Martijn Schuemie [aut] |
| Repository: | CRAN |
| Date/Publication: | 2026-11-02 15:50:02 UTC |
CirceR: Construct Cohort Inclusion and Restriction Criteria Expressions
Description
Wraps the 'CIRCE' (https://github.com/ohdsi/circe-be) 'Java' library allowing cohort definition expressions to be edited and converted to 'Markdown' or 'SQL'.
Author(s)
Maintainer: Chris Knoll cknoll@ohdsi.org
Authors:
Chris Knoll cknoll@ohdsi.org
Martijn Schuemie
See Also
Useful links:
Report bugs at https://github.com/OHDSI/CirceR/issues/
Get the backend implementation
Description
Get the backend implementation
Usage
.get_backend()
Value
An object with class 'circe_backend_python' or 'circe_backend_java'.
Build cohort SQL
Description
Generates the OMOP CDM Sql to generate the cohort expression
Usage
buildCohortQuery(expression, options)
Arguments
expression |
result of cohortExpressionFromJson containing the cohort expression. |
options |
The options built using createGenerateOptions() |
Value
A character vector containing the OHDSI Sql for the cohort expression
Build conceptset SQL
Description
Generates the OMOP CDM Sql to resolve the concept set expression
Usage
buildConceptSetQuery(conceptSetJSON)
Arguments
conceptSetJSON |
a string containing the JSON for the conceptset expression. |
Value
A character vector containing the OHDSI Sql for the conceptset expression
An example cohort definition
Description
An example cohort definition
Usage
data(cohortDefinitionJson)
Format
A character vector containing a JSON string
Details
An example cohort expression in JSON format
Render read JSON into a CohortExpression instance
Description
Reads a String (json) and deserializes it into a org.ohdsi.circe.cohortdefinition.CohortExpression
Usage
cohortExpressionFromJson(expressionJson)
Arguments
expressionJson |
A character vector containing the cohort expression. |
Value
A java instance of org.ohdsi.circe.cohortdefinition.CohortExpression.
Render cohort print-friendly
Description
Generates a print-friendly (human-readable) representation of the cohort definition. This can for example be used in a study protocol.
Usage
cohortPrintFriendly(expression)
Arguments
expression |
A character vector or result of cohortExpressionFromJson containing the cohort expression. |
Value
A character vector containing the markdown.
Render read JSON into a ConceptSetExpression instance
Description
Reads a String (json) and deserializes it into a org.ohdsi.circe.vocabulary.CohortExpression
Usage
conceptSetExpressionFromJson(expressionJson)
Arguments
expressionJson |
A character vector containing the cohort expression. |
Value
A java instance of org.ohdsi.circe.cohortdefinition.CohortExpression.
An example concept set
Description
An example concept set
Usage
data(conceptSetJson)
Format
A character vector containing a JSON string
Details
An example concept set in JSON format
An example concept set list
Description
An example concept set list
Usage
data(conceptSetListJson)
Format
A character vector containing a JSON string
Details
An example concept set list in JSON format
Render conceptSet array for print-friendly
Description
Generates a print-friendly (human-readable) representation of an array of concept sets. This can for example be used in a study protocol.
Usage
conceptSetListPrintFriendly(conceptSetList)
Arguments
conceptSetList |
A ConceptSet[] (from cohortExpression.conceptSets), a JSON string, or a list from RJSONIO::fromJson |
Value
A character vector containing the markdown.
Render conceptSet array for print-friendly
Description
Generates a print-friendly (human-readable) representation of a single concept set. This can for example be used in a study protocol.
Usage
conceptSetPrintFriendly(conceptSet)
Arguments
conceptSet |
A ConceptSet (from cohortExpression.conceptSets[i]), a JSON string, or a list from RJSONIO::fromJson |
Value
A character vector containing the markdown.
Create Generation Options
Description
Creates the generation options object for use in generateSql()
Usage
createGenerateOptions(
cohortIdFieldName,
cohortId,
cdmSchema,
targetTable,
resultSchema,
vocabularySchema,
generateStats
)
Arguments
cohortIdFieldName |
The field that contains the cohortId in the cohort table. |
cohortId |
The generated cohort ID. |
cdmSchema |
The value of the CDM schema. |
targetTable |
the cohort table name. |
resultSchema |
the schema the cohort table belongs to. |
vocabularySchema |
the schema of the vocabulary tables (defaults to cdmSchema) |
generateStats |
a boolean representing if the query should include inclusion rule statistics calculation |
Value
A jObj that can be passed to generateSql().
Enables the Python backend
Description
Sets the CIRCER_BACKEND environment variable to 'python'.
Usage
enablePythonBackend()
Ensures the Java backend is available
Description
Ensures the Java backend is available
Usage
ensureJavaBackend()
Ensures the Python backend is available
Description
Ensures the Python backend is available
Usage
ensurePythonBackend()
Value
The 'circe' module (from the ohdsi-circepy package).
Checks if the Python backend is enabled
Description
Checks if the Python backend is enabled
Usage
usePythonBackend()
Value
TRUE if CIRCER_BACKEND environment variable is set to 'python', FALSE otherwise.