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

Reproducible metadata attribute #76

Closed
3 tasks done
Tracked by #50
gogonzo opened this issue Jun 21, 2022 · 5 comments
Closed
3 tasks done
Tracked by #50

Reproducible metadata attribute #76

gogonzo opened this issue Jun 21, 2022 · 5 comments

Comments

@gogonzo
Copy link
Contributor

gogonzo commented Jun 21, 2022

Feature description

If TealDataset's metadata was an attribute of the data - then:

  1. Would be reproducible - attr(<dataset>, "metadata") <- <metadata call>.
  2. Would be easy to obtain attr(<raw data>, "metadata")
  3. Wouldn't be needed to specify this as a argument in FilteredData as attr will follow the (raw) data. Only one operation which removes attribute from data.frame is removing a columns - dplyr calls preserve attributes
a <- data.frame(a = 1, b = 2)
attr(a, "metadata") <- "test"
a$c <- 3
attr(a, "metadata")
# "test"

a |>
  dplyr::filter(a == 0) |>
  dplyr::select(-c) |>
  dplyr::left_join(a, "a") |>
  attr("metadata")
# [1] "test"

a[1:2] |> attr("metadata")
# NULL

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.
@gogonzo
Copy link
Contributor Author

gogonzo commented Jun 21, 2022

@kumamiao @nikolas-burkoff What do you think? Currently metadata is put as a slot in TealDataset and FilteredDataset. Maybe it would be better if we keep it in raw data?

@gogonzo gogonzo added the core label Jun 21, 2022
@nikolas-burkoff
Copy link
Contributor

I'm happy with this, we'll also need to make changes in internal connector packages of course

@kumamiao
Copy link

Sounds good, no strong preferences from me as long as app developers can 1) grab the metadata within a module 2) use the front page module to check the metadata

@gogonzo
Copy link
Contributor Author

gogonzo commented Jun 22, 2022

sounds like plan - metadata could be obtained in the module by:

# in case of datasets <FilteredData>
attr(datasets$get_data(<dataname>), "metadata")

# in case of data <list of reactive data>
attr(data[[<dataname>]](), "metadata")

@gogonzo
Copy link
Contributor Author

gogonzo commented Dec 4, 2023

implemented with new teal_data

@gogonzo gogonzo closed this as completed Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants