Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in emr_extract with list iterator #84

Open
nettam opened this issue Nov 13, 2022 · 1 comment
Open

bug in emr_extract with list iterator #84

nettam opened this issue Nov 13, 2022 · 1 comment
Assignees
Labels
bug Something isn't working critical

Comments

@nettam
Copy link
Contributor

nettam commented Nov 13, 2022

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!!!

@nettam nettam added bug Something isn't working critical labels Nov 13, 2022
@aviezerl
Copy link
Collaborator

Note that this happens only when filtering on age 75, i.e., when running:

x <- emr_extract('age', iterator=list(75*year(), 'patients.dob'), filter='!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 are the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working critical
Projects
None yet
Development

No branches or pull requests

2 participants