
Add the ordinal number of the observation period associated that a given date is in. Result is not computed, only query is added.
Source:R/addObservationPeriodId.R
addObservationPeriodIdQuery.Rd
Add the ordinal number of the observation period associated that a given date is in. Result is not computed, only query is added.
Usage
addObservationPeriodIdQuery(
x,
indexDate = "cohort_start_date",
nameObservationPeriodId = "observation_period_id"
)
Examples
# \donttest{
cdm <- mockPatientProfiles()
cdm$cohort1 |>
addObservationPeriodIdQuery()
#> # Source: SQL [?? x 5]
#> # Database: DuckDB v1.2.2 [unknown@Linux 6.11.0-1015-azure:R 4.5.0/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 3 3 1955-12-31 1971-06-11
#> 2 2 5 1949-05-25 1980-12-03
#> 3 2 9 1987-01-29 2008-08-15
#> 4 1 2 1978-03-21 1994-12-15
#> 5 2 1 1967-03-29 1970-04-08
#> 6 2 8 1920-05-10 1928-07-19
#> 7 3 10 1935-01-04 1956-01-14
#> 8 3 6 1951-05-17 1954-01-19
#> 9 1 4 1909-06-30 1912-05-13
#> 10 2 7 1951-01-19 1964-07-01
#> # ℹ 1 more variable: observation_period_id <int>
mockDisconnect(cdm = cdm)
# }