
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.2.0 [unknown@Linux 6.8.0-1021-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 1 1 1950-07-22 1953-08-22
#> 2 2 2 1936-01-21 1950-12-30
#> 3 1 3 1991-06-12 1994-03-01
#> 4 1 4 1934-05-03 1935-02-16
#> 5 2 5 1922-12-30 1923-03-15
#> 6 2 6 1991-05-27 2009-09-07
#> 7 1 7 1977-08-10 1993-01-03
#> 8 3 8 1979-03-25 1993-04-09
#> 9 1 9 1905-07-13 1911-07-18
#> 10 1 10 1979-01-16 1981-09-18
#> # ℹ 1 more variable: prior_observation <int>
mockDisconnect(cdm = cdm)
# }