Get a cohort definition's SQL from WebAPI

getCohortDefinitionSql(cohortId, baseUrl, generateStats = TRUE)

Arguments

cohortId

An integer id representing the id that uniquely identifies a cohort definition in a WebApi instance.

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

The templated SQL to generate the cohort

Details

Obtains the template SQL of a cohort. When using generateStats = TRUE, the following tables are required to exist when executing the SQL: cohort_inclusion, cohort_inclusion_result, cohort_inclusion_stats, and cohort_summary_stats. Also note that the cohort_inclusion table should be populated with the names of the rules prior to executing the cohort definition SQL.