-
Notifications
You must be signed in to change notification settings - Fork 15
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
[WIP] Add derived subvar #453
base: master
Are you sure you want to change the base?
Conversation
This reverts commit b5494f1.
R/add-subvariable.R:160:1: style: Variable and function names should not be longer than 30 characters. addSubvarsToSelectCatDerivation <- function(deriv, new_vars, existing_cats) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ R/add-subvariable.R:207:1: style: Lines should not be more than 100 characters. "cannot add subvariables.\n ", paste0(var_aliases, "(", cats_for_vars, ")", collapse = ", ")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tests/testthat/test-add-subvariable.R:71:1: style: Lines should not be more than 100 characters. test_that("Cannot add new categories when adding existing variable to derived select_cat array", {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Codecov Report
@@ Coverage Diff @@
## master #453 +/- ##
==========================================
- Coverage 90.55% 90.11% -0.45%
==========================================
Files 121 121
Lines 6932 7048 +116
==========================================
+ Hits 6277 6351 +74
- Misses 655 697 +42
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expanding out some of the TODOs
derivation(variable) <- new_deriv | ||
# We don't get metadata from original variable like we would if we were creating | ||
# subvariable during original derivation... | ||
# TODO: It would be nice to update name in the same POST as updating derivation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a derivation can have a subreferences
field? Is that the best way?
R/add-subvariable.R
Outdated
# subvariable during original derivation... | ||
# TODO: It would be nice to update name in the same POST as updating derivation | ||
# to ensure consistency, but I don't see how yet | ||
# TODO: Also, the alias is really ugly for newly created subvariables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to get the server's naming logic? I tried just adding the alias explicitly, hoping that the server would dedup for me, but this resulted in a failure.
|
||
with_test_authentication({ | ||
# adding to derived array | ||
# TODO: Use existing fixture? Add this to fixtures? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This simple example works well for these tests, but we usually use newDatasetFromFixture()
, worth changing to that (either by using existing fixture or adding this one there)?
R/add-subvariable.R:96:1: style: Lines should not be more than 100 characters. new_deriv <- addToSelectCatDerivation(old_deriv, subvariable, new_map_ids, categories(variable))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
R/add-subvariable.R:96:1: style: Lines should not be more than 100 characters. new_deriv <- addToSelectCatDerivation(old_deriv, subvariable, new_map_ids, categories(variable))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Definitely not ready for primetime yet, but wanted to get some notes down.
Weird things:
absolutifyVariables
(which modifies the derivation expression before user sees it) is wrong in some cases, likely having to do with array variables. It seems to assume that the variable is given by relative URL, but withinmap
zcl function, variables are given by ID only. I have gotten around this by not converting to absolute paths, but I'd like to actually fix.