
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{
library(PatientProfiles)
cdm <- mockPatientProfiles(source = "duckdb")
cdm$cohort1 |>
addPriorObservationQuery()
#> # Source: SQL [?? x 5]
#> # Database: DuckDB 1.3.3-dev231 [unknown@Linux 6.11.0-1018-azure:R 4.5.1/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 1 3 1963-05-20 1970-03-12
#> 2 3 5 1962-12-16 1966-01-09
#> 3 1 1 1970-08-16 1973-10-23
#> 4 3 8 2002-06-08 2012-06-11
#> 5 2 6 1957-12-07 1987-12-10
#> 6 1 7 1955-12-20 1969-11-18
#> 7 3 2 1958-01-09 1959-03-08
#> 8 3 4 1933-11-22 1937-11-30
#> 9 3 10 1950-08-06 1967-05-10
#> 10 2 9 1996-11-29 1998-10-22
#> # ℹ 1 more variable: prior_observation <int>
# }