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

cdm_flatten() on a subset can give incorrect "table is empty" errors #20

Open
SulevR opened this issue May 2, 2024 · 0 comments
Open

Comments

@SulevR
Copy link

SulevR commented May 2, 2024

Using cdm_flatten() on a CDM performs table checks for the domains, for example:

assert_tables(cdm, "drugs")

and gives an error if the table is empty:

Error in `assert_tables()`:
! - drug_exposure cdm table is empty

However, when the function is applied to a small subset, it can easily happen that for this particular subset, some table is empty and this is completely OK and should not produce an error.

Reproducible example:

Sys.setenv('EUNOMIA_DATA_FOLDER'=file.path(getwd(),'eunomia'))
cdm_andmebaasi_faili_path=eunomia_dir("GiBleed")
con <- DBI::dbConnect(duckdb::duckdb(), cdm_andmebaasi_faili_path)
cdmTest <- cdm_from_con(con, cdm_name = "eunomia", cdm_schema = "main", write_schema = "main")

# test:
subset=cdmTest %>%
  cdm_subset(person_id = 67)

b=cdm_flatten(subset)

EXPECTED RESULT: No error

ACTUAL RESULT:

Error in `assert_tables()`:
! - procedure_occurrence cdm table is empty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant