See following example:
library(tidyverse)
emr_db.connect("/net/mraid14/export/tgdata/db/tgdb/emr/mock")
emr_filter.create('lab_1m', 'lab.101', time.shift=c(-1,0)*month())
emr_filter.create('f_75', 'patients.dob', time.shift=c(-76, -74)*year())
emr_vtrack.create('age', 'patients.dob', time.shift=c(-120,0)*year(), func='dt2.earliest')
x <- emr_extract('age', iterator=list(75*year(), 'patients.dob'), filter='f_75 & !lab_1m', stime=emr_date2time(1,1,2012), etime=emr_date2time(1,1,2014))
y <- emr_extract('age', iterator=x, filter='f_75 & !lab_1m')
x and y should be exactly the same!!!
x %>% anti_join(y)
Joining, by = c("id", "time", "ref", "age")
id time ref age
1 171496 1269701 -1 657000
2 2223455 1270385 -1 657000
#x contains entries that were filtered in y!!!
See following example:
library(tidyverse)
emr_db.connect("/net/mraid14/export/tgdata/db/tgdb/emr/mock")
emr_filter.create('lab_1m', 'lab.101', time.shift=c(-1,0)*month())
emr_filter.create('f_75', 'patients.dob', time.shift=c(-76, -74)*year())
emr_vtrack.create('age', 'patients.dob', time.shift=c(-120,0)*year(), func='dt2.earliest')
x <- emr_extract('age', iterator=list(75*year(), 'patients.dob'), filter='f_75 & !lab_1m', stime=emr_date2time(1,1,2012), etime=emr_date2time(1,1,2014))
y <- emr_extract('age', iterator=x, filter='f_75 & !lab_1m')
x and y should be exactly the same!!!
x %>% anti_join(y)
Joining, by = c("id", "time", "ref", "age")
id time ref age
1 171496 1269701 -1 657000
2 2223455 1270385 -1 657000
#x contains entries that were filtered in y!!!