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

view does not contain data #21

Closed
TMJansen opened this issue Mar 11, 2024 · 6 comments
Closed

view does not contain data #21

TMJansen opened this issue Mar 11, 2024 · 6 comments
Assignees

Comments

@TMJansen
Copy link

When creating a view, both in opalr 3.4.1 as in dev, I do not get to see data in the view or upon download. Same goes for your example. The variables and entity numbers are shown correctly, also after filtering on entities (e.g. where = "$('GENDER').eq(1)")
Am I missing something here?

get dictionary

dict <- opal.table_dictionary_get(o, project = "CNSIM", table = "CNSIM1")

create view

opal.table_view_create(o, "CNSIM", "CNSIM123",
c("CNSIM.CNSIM1", "CNSIM.CNSIM2", "CNSIM.CNSIM3"))

apply dictionary

opal.table_dictionary_update(o, project = "CNSIM", table = "CNSIM123", variables = dict$variables, categories = dict$categories)

Thank you very much for looking into this

@TMJansen
Copy link
Author

NB this example code with more than one table gives an error (now), can maybe be removed from the vignette

then create a view, no variables

opal.table_create(o, "CNSIM", "CNSIM123", tables = c("CNSIM.CNSIM1", "CNSIM.CNSIM2", "CNSIM.CNSIM3"))

@ymarcon ymarcon self-assigned this Mar 11, 2024
@TMJansen
Copy link
Author

A colleague found out that we need an additional "script" column in the variable dictionary.
dict$variables = dict$variables |> mutate(script = paste0("$('", name, "')"))
Can you please add these requirements for views to the documentation?

This statement now works:
opal.table_view_update(o, "CNSIM", "CNSIM123", where = "$('LAB_TSC').ge(5)")

However, a statement with equality still does not work for me: can you please let me know the correct code here?
opal.table_view_update(o, "CNSIM", "CNSIM123", where = "$('GENDER').eq(1)")

@TMJansen
Copy link
Author

NB: this code does work for a view with only one table, so the problem is in the view with multiple tables

opal.table_view_update(o, "CNSIM", "CNSIM123", where = "$('GENDER').eq(1)")

@ymarcon
Copy link
Member

ymarcon commented Mar 15, 2024

The where statement is for filtering the rows. FYI The performance of this feature is not very good, make sure you do not use it on large datasets.

@TMJansen
Copy link
Author

Thank you for the information. Can you please address the issue that the entity filter does not work on multiple tables in one view? E.g.
opal.table_view_update(o, "CNSIM", "CNSIM123",
tables = c("CNSIM.CNSIM1", "CNSIM.CNSIM2", "CNSIM.CNSIM3"),
here = "$('GENDER').eq(1)")

@ymarcon
Copy link
Member

ymarcon commented Mar 27, 2024

When referring to own derived variable (and not a source variable), you must use the $this accessor:

$this('GENDER').eq(1)

@ymarcon ymarcon closed this as completed Mar 27, 2024
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

2 participants