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

Feat/check up to date #338

Merged
merged 7 commits into from Mar 4, 2021
Merged

Feat/check up to date #338

merged 7 commits into from Mar 4, 2021

Conversation

seth127
Copy link
Collaborator

@seth127 seth127 commented Feb 26, 2021

closes #339

Also refactored config_log() to call the new function internally.

@seth127 seth127 requested a review from annacnev March 1, 2021 22:13
@@ -205,27 +187,6 @@ config_log_entry <- function(path,
config[out_fields]
}

#' Compare a file to an MD5 sum
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this moved to utils.R

@@ -56,7 +56,7 @@ test_that("new_model() throws an error if the model file does not exist", {
})

test_that("compare read_model() and new_model() objects", {
temp_mod_path <- create_temp_model(YAML_TEST_FILE)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is unrelated cleanup

@seth127 seth127 force-pushed the refactor/new-model-stan-prep branch from 5c05a69 to f3ac959 Compare March 2, 2021 15:04
Base automatically changed from refactor/new-model-stan-prep to develop March 2, 2021 15:11
Copy link
Contributor

@annacnev annacnev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good- minor suggestions for code aesthetics but nothing really that would change functionality so completely optional.

}

#' @export
check_up_to_date.bbi_nonmem_model <- function(.bbi_object, ...) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check_up_to_date.default <- function(.bbi_object, ...) {

Right now, the bbi_nonmem_summary and bbi_nonmem_model methods are identical so maybe consider just setting this as the default method.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part of the point of this is prepare for adding Stan stuff so, even though these are the same, they're not gonna be the default methods. I considered adding another parent class that they would share, but that seemed a little excessive to have something like

class(.mod)
# "bbi_nonmem_model"  "bbi_nonmem_object"  "bbi_model"  "list"

("bbi_model" is already the parent class that they'll share with Stan and other kinds of models)

Anyway, that would be a totally valid way to do it, but I opted for just duplicating a couple dispatches instead (and made them use the same private helper to avoid copy/paste).

if(isTRUE(any_changes)) {
message(paste(
glue("The following files have changed in {get_model_id(.mod)}"),
paste("*", names(which(changed_files)), collapse = "\n"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this is just a me thing but it's kinda weird to mix paste and glue.. especially because glue has the same base functionality as paste. I.e. this could be rewritten:

message(glue(
glue("The following files have changed in {get_model_id(.mod)}"),
glue_collapse("*", names(which(changed_files)), sep = "\n"),
sep = "\n"
))

paste works so this isn't wrong I just don't see why we are using it if we have already imported the glue package

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, I see that. I always just use paste unless I explicitly need the {} glue thing. I would change it here but... I do this all over the place so consistency is really not within reach.

@seth127 seth127 merged commit 5390d08 into develop Mar 4, 2021
@seth127 seth127 deleted the feat/check_up_to_date branch March 4, 2021 15:09
@seth127 seth127 mentioned this pull request Mar 5, 2021
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

Successfully merging this pull request may close these issues.

check_up_to_date() function
2 participants