getCohortSql: Get SQL query for Cohort definition.

View source: R/CohortDefinition.R

getCohortSqlR Documentation

Get SQL query for Cohort definition.

Description

Get SQL query for Cohort definition.

Usage

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.

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.

Value

An R object containing the SQL for Cohort definition.

Examples

## Not run: 
getCohortSql(CohortDefinition = (getCohortDefinition(cohortId = 13242, baseUrl = baseUrl)),
             baseUrl = "http://server.org:80/WebAPI")

## End(Not run)

OHDSI/ROhdsiWebApi documentation built on March 15, 2023, 1:23 p.m.