OHDSI Home | Forums | Wiki | Github

Defining cohort with two distinct drugs with an interval between them

I’m trying to create a cohort in Atlas where the index date is a drug exposure/era and inclusion criteria is having another drug/ingredient from the same group. What I’m currently doing is selecting a drug era as an index date and then creating nested criteria with 2 ‘using distinct’ antecedent drug eras.
First, I think that’s the right way to do it (as opposed to having 1 era + 1 ‘using distinct’ nested era), but would be great to confirm.
Second, I can’t figure out how to specify a time interval (e.g. at least 30 days) between those two ‘using distinct’ eras.
Any help would be greatly appreciated! :slight_smile: (and also tagging @Chris_Knoll)

Hi, @aostropolets ,
First, just wanted to refer you over to the ehden academy information that describes the 3 elements of the expression: Query, Count, and Group. With that info, the following will hopefully make more sense:

The challenge with what you’re trying is that you can’t take a count operation, and then apply some other query logic based on the elements in the count. Individually, you can say ‘Has 2 distinct ingredeints any time prior up to the drug era start date’, which includes itself in that count, so if get a count-distinct result of 2, you know you had 2 different drugs in that group. Also individually, you can specify criteria that says to find a drug era that has a subsequent drug era that starts 30 days after the start/end of the given drug era.

What you aren’t able to do is say 'Determine the drug eras that have something different prior, and using the prior event that is distinct from the current drug era, check to see that the distance between start of one and the end of the other is greater than 30 days.

I am not sure what to call what i’m describing…‘Cross-criteria expression’? But it’s beyond what the query-count-group functions that the Circe cohort expressions give you.

But, depending on how many different ingredients are in your drug group, is it possible to call them out separately and do something like:

a drug era of Drug A:
- Having any of the following: (this is the nested criteria)
  - at least 1 of drug era 'Drug B' starting between 30 days after and all days after index end date (index is the drug A event)
 - or at least 1 drug era of 'Drug C' starting between 30 days after and all days after index end date...
...1 OR for each drug pair to find...

If you were using straight sql, you’d solve all this with a self-join where one side of the join’s drug concept is not equal to the other side of the join’s drug concept. And having those, you can then further restrict the join on number of days between each drug era record. But the notion of ‘joins’ and ‘subqueries’ isn’t exactly what Circe does for you, so you are limited there.

Thanks, Chris, that makes total sense and confirms my suspicion. Will switch to old school sql :slight_smile:
Thanks again!

t