
Query to add the number of days till the end of the observation period at a certain date
Source:R/addDemographicsQuery.R
addFutureObservationQuery.RdSame as addFutureObservation(), except query is not computed to a table.
Usage
addFutureObservationQuery(
x,
indexDate = "cohort_start_date",
futureObservationName = "future_observation",
futureObservationType = "days"
)Examples
# \donttest{
library(PatientProfiles)
cdm <- mockPatientProfiles(source = "duckdb")
cdm$cohort1 |>
addFutureObservationQuery()
#> # Source: SQL [?? x 5]
#> # Database: DuckDB 1.5.1 [unknown@Linux 6.17.0-1008-azure:R 4.5.3/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 3 4 1933-10-17 1945-01-20
#> 2 1 9 1982-11-23 1992-08-28
#> 3 3 7 1955-11-04 1965-02-03
#> 4 2 6 1981-08-31 1991-03-26
#> 5 1 2 1922-09-07 1928-11-09
#> 6 3 8 1992-08-07 1993-06-15
#> 7 3 1 1937-06-25 1949-11-24
#> 8 3 3 1967-12-28 1971-01-17
#> 9 2 5 1982-11-06 1989-04-02
#> 10 1 10 1934-12-26 1940-09-01
#> # ℹ 1 more variable: future_observation <int>
# }