Covariate Matching Based on Record Count

Hi, I’m Sujin from Ajou University, and I have a few questions regarding covariate matching based on record count instead of person count.

Specifically, even when using the option removeDuplicateSubjects == "keep first", I would like to retain all records from the first cohort and perform the matching based on record count.

For example:

  • Suppose a person (A) belongs to both the Target and Comparator cohorts.
  • Patient A has 3 records in the Target cohort and 2 records in the Comparator cohort.
  • The expected result is: If the cohort start date for the Target cohort is earlier than that for the Comparator cohort, the output should show Person count = 1 and Record count = 3.

I would like to ask the following:

  1. Is there a simple way to retain all records from the first cohort within the existing analysis settings?
  2. If not, would it be appropriate to modify the CohortMethod package, specifically the StudyPopulation.R or CreateCohort.sql scripts, to achieve this functionality?

Thanks!