Query to add the number of days of prior observation in the current observation period at a certain date
Source:R/addDemographicsQuery.R
addPriorObservationQuery.Rd
`r lifecycle::badge("experimental")` Same as `addPriorObservation()`, except query is not computed to a table.
Usage
addPriorObservationQuery(
x,
indexDate = "cohort_start_date",
priorObservationName = "prior_observation",
priorObservationType = "days"
)
Examples
# \donttest{
cdm <- mockPatientProfiles()
cdm$cohort1 |>
addPriorObservationQuery()
#> # 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 2 1 1990-08-27 1993-08-19
#> 2 1 2 1991-03-07 1993-01-31
#> 3 2 3 1970-07-16 1993-09-24
#> 4 3 4 1972-11-17 1981-03-07
#> 5 3 5 1947-02-10 1971-01-04
#> 6 1 6 1965-09-11 1975-07-07
#> 7 3 7 1947-08-01 1980-08-22
#> 8 2 8 1907-07-11 1914-09-12
#> 9 3 9 1923-09-13 1933-05-30
#> 10 2 10 1909-11-27 1913-06-11
#> # ℹ 1 more variable: prior_observation <int>
mockDisconnect(cdm = cdm)
# }