Get SQL query for Cohort definition.

getCohortSql(cohortDefinition, baseUrl, generateStats = TRUE)

Arguments

cohortDefinition

An R list object (not JSON) representing the Cohort definition. It is the output R expression object of list object from CohortDefinition

baseUrl

The base URL for the WebApi instance, for example: "http://server.org:80/WebAPI".

generateStats

Should the SQL include the code for generating inclusion rule statistics? Note that if TRUE, several additional tables are expected to exists as described in the details. By default this is TRUE.

Value

An R object containing the SQL for Cohort definition.

Details

Given a valid Cohort definition R-object (not JSON) this function will return the parameterized SQL in OHDSI SQL dialect. This SQL may be used along with OHDSI R-package 'SQLRender' to render/translate to target SQL dialect and parameters rendered.

Examples

if (FALSE) {
getCohortSql(CohortDefinition = (getCohortDefinition(cohortId = 13242, baseUrl = baseUrl)),
             baseUrl = "http://server.org:80/WebAPI")
}