OHDSI Home | Forums | Wiki | Github

OHDSICohortExpressions.jl

Circe is the component of OHDSI that converts cohort expressions into SQL. Circe takes JSON formatted cohort expressions, available in Atlas, and produces SQL for populating the cohort table with matching subjects.

OHDSICohortExpressions.jl is an Apache licensed Julia library that re-implements OHDSI’s Circe. It converts a cohort expression into SQL, specialized to a given database system. Although written in Julia, this library can be used directly from R. It does not depend upon Circe, SQLRender, or other OHDSI components. Instead, it uses FunSQL.jl, a Julia library for compositional construction of SQL queries.

We hope the OHDSI community will be interested in an independent implementation of executable cohort expressions. OHDSICohortExpressions does not reproduce the queries generated by Circe, but the queries it generates should produce the same cohorts. An independent implementation can act as a validity check to assure that SQL translation is correct. If, for any cohort expression and database, our library produces a different result, please report this discrepancy so that we could investigate.

OHDSICohortExpressions.jl v0.1 – Proof of Concept

At this time, this implementation is able to convert all 797 cohorts from PhenotypeLibrary v0.1 to generate SQL that works against Amazon RedShift, Microsoft SQL Server, and PostgreSQL. There are still gaps in functionality. When OHDSICohortExpression encounters an expression it cannot yet convert, it raises an assertion error.

t