OHDSI / omock

https://ohdsi.github.io/omock/
Apache License 2.0
2 stars 1 forks source link

recordPerson not working when using mockCohort() #85

Closed martaalcalde closed 3 months ago

martaalcalde commented 4 months ago

When trying to use the argument recordPerson in mockCohort() function, it does not work as I expected. Am I doing something wrong?

cdm <- omock::mockCdmReference() |>
  omock::mockPerson(nPerson = 10) |>
  omock::mockObservationPeriod()

cdm <- cdm |> omock::mockCohort(recordPerson = 1)

cdm$cohort
#> # A tibble: 10 × 4
#>    cohort_definition_id subject_id cohort_start_date cohort_end_date
#>                   <int>      <int> <date>            <date>         
#>  1                    1          1 2001-05-30        2003-05-01     
#>  2                    1          1 2003-05-02        2006-06-10     
#>  3                    1          2 2000-05-04        2000-05-17     
#>  4                    1          2 2000-05-18        2001-01-23     
#>  5                    1          3 2015-01-27        2015-06-28     
#>  6                    1          4 1996-06-30        1998-11-20     
#>  7                    1          5 2012-03-20        2012-04-30     
#>  8                    1          5 2012-05-01        2012-07-24     
#>  9                    1          7 2014-03-07        2014-03-07     
#> 10                    1          7 2014-03-08        2014-03-20

Created on 2024-06-05 with reprex v2.1.0

ilovemane commented 3 months ago

recordPerson is an average. you have 10 people in person table, so it gives you a cohort of 10 x 1 rows.

martaalcalde commented 3 months ago

I see! Thank you Mike!