Clarification on entry criteria for cohort definition in Capr

Hi everyone,

@Lui, @Marcela and I are using Capr to define cohorts and we are having a issue regarding the entry criteria definition. We want to define the entry criteria as “All” events per person, allowing multiple entries per person. For that, we are using this code:

# Create the cohort
 entry_criteria <- drugExposure(get(drug))
 
 current_cohort <- cohort(
   entry = entry(
     entry_criteria,
     primaryCriteriaLimit = "All",
     qualifiedLimit = "All",
     observationWindow = continuousObservation(0L, 0L)
   ),
   exit = exit(
     endStrategy = drugExit(get(drug), persistenceWindow = 60L, surveillanceWindow = 0L, daysSupplyOverride = NULL),
     censor = NULL
   )
 )

To verify that patients have multiple entries, we replicated the same cohort definition in ATLAS.

In Atlas, we observed that patients have multiple entries (Records count > People count). In contrast, when using the same definition in Capr, we find that the number of persons matches that of Atlas; however, the People count is equal to the Records count, indicating that patients are entering the cohort only once.

We would like to understand the reasons behind this difference and how we can ensure that patients can have multiple entries in Capr.

Thank you!

@mdlavallee92 @Adam_Black

Hi @Julia_Rodrigues,

When I look at the generated json from the capr cohort with:

cat(as.json(current_cohort))

And compare it to the atlas generated json (in export tab). Then I see the difference:

current_cohort:

  "ExpressionLimit": {
    "Type": "First"
  },

atlas cohort:

 "ExpressionLimit": {
    "Type": "All"
  },

This looks like it could have something to do with your difference. If you add to your cohort generation:

current_cohort <- cohort(
   entry = entry(
     entry_criteria,
     primaryCriteriaLimit = "All",
     qualifiedLimit = "All",
     observationWindow = continuousObservation(0L, 0L)
   ),
   attrition = attrition(expressionLimit = "All"),
   exit = exit(
     endStrategy = drugExit(get(drug), persistenceWindow = 60L, surveillanceWindow = 0L, daysSupplyOverride = NULL),
     censor = NULL
   )
 )

Then it matches. You could try that.

Egill

2 Likes

Hi @egillax
I really appreciate your help! Everything worked perfectly. Thank you so much! :slight_smile:

Thanks Egill!

Yes as in atlas you need to set the limit of the inclusion rules (ie the expression limit). Capr uses “First” by default which narrows to a per subject view (atlas uses the same default as well).


Image from atlas are all the potential limit toggles in circe.

limit initial events → primaryCriteriaLimit
limit initial events under additiona l criteria → qualifiedLimit
limit qualifying events → expressionLimit

The Capr commands align with the name of the slot in the circe json. As Egill shows if you want all events you need to toggle the limits to “all” throughout the definition. If you want subjects only then it depends on when you want to apply the limit (during the initial cohort entry query or during the attrition).

Glad this was resolved here. You can also post your Capr questions on the issues page of the package github Issues · OHDSI/Capr

1 Like

There was discussion in TAG (t? advisory group) to define schema for conceptset and for cohort json.

tagging @Frank

Naming in GUI (Atlas) and in schema/JSON/Capr will be important. (having it as close as possible or have mapping)