OHDSI / CohortGenerator

An R package for instantiating cohorts using data in the CDM.
https://ohdsi.github.io/CohortGenerator/
11 stars 10 forks source link

Cohort Algebra operators - union, minus, intersect #95

Open gowthamrao opened 1 year ago

gowthamrao commented 1 year ago

I had built a package called CohortAlgebra that was able to do many of these algebraic operator on instantiated cohorts called CohortAlgebra. It works, but i am hoping that CohortGenerator would take on these. Reason: cohortGenerator has the pipe operations, handles cohort definition set, and can store the SQL in cohortDefinitionSet object.

The operators i would like to ask may be explained by these graphs

Cohort Union image

Intersect example 1 image

Intersect example 2 image

Intersect example 3 image

Intersect example 4 image

Intersect example 5 image

Minus 1 image

Minus 2 image

anthonysena commented 1 month ago

@gowthamrao - is this still a desire for CohortAlgebra? I'm unclear on if are proposing to relocate this logic into CohortGenerator or to provide more capabilities for using CohortAlgebra via CohortGenerator?

gowthamrao commented 1 month ago

I am proposing to integrate the logic from CohortAlgebra to CohortGenerator. CohortAlgebra does the same thing as CohortGenerator i.e. generate new cohort from other cohorts.