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.1.3 [unknown@Linux 6.8.0-1017-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 1 4 1971-09-27 1973-01-15
#> 2 1 6 1962-02-23 1966-12-24
#> 3 1 9 1933-05-29 1938-08-25
#> 4 3 10 1911-09-06 1925-12-25
#> 5 1 1 1979-09-10 1982-09-10
#> 6 3 2 1944-01-15 1952-01-20
#> 7 2 7 1977-07-27 1997-12-15
#> 8 1 3 1948-02-24 1950-08-03
#> 9 1 8 1933-05-09 1938-02-16
#> 10 2 5 1914-05-22 1937-10-07
#> # ℹ 1 more variable: observation_period_id <int>
mockDisconnect(cdm = cdm)
# }