-
Notifications
You must be signed in to change notification settings - Fork 0
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
Tefera update branch #100
Tefera update branch #100
Conversation
Hi @randrescastaneda , I have updated country_list (cl_validation_raw()) script, I have also added a function that clean validation report object from the environment variable. |
Hi @randrescastaneda , I have updated test-countries-validation() as per the update implemented in pip_countries(). I have also added gls in the unit test functions when it is requred. |
Thank you so much. I'll check and get back to you. |
Hi @randrescastaneda , Thank you for the feedback, I have updated the unit test functions. But, there are two outstanding issues that I couldn't resolve ("test-load_aux.R" and "test-pip_sign_save.R"). |
@@ -53,7 +53,12 @@ Imports: | |||
joyn, | |||
dm, | |||
config, | |||
collapse | |||
collapse, |
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.
Do we need all these dependencies? For example, do we need covr
? Could it be moved to suggests
?
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 moved covr package to suggests section.
@@ -2,8 +2,26 @@ | |||
|
|||
export("%>%") | |||
export(auto_aux_update) | |||
export(cl_validate_raw) |
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 reason to export all the validation functions? I think they are meant to be used internally. If they are, you should use #' @keywords internal
in the roxygen chunk of those functions. If they are not, please provide a short explanation. Thanks !
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.
As you have suggested, I included #' @Keywords internal to roxygen chunk to all the data validation functions.
Thanks
R/cl_validate_raw.R
Outdated
validate(cl, name = "CL raw data validation") |> | ||
validate_if(is.character(country_code), | ||
description = "`country_code` should be character") |> | ||
validate_cols(in_set(c("ABW", "AFG", "AGO", "ALB", "AND", "ARE", "ARG", "ARM", "ASM", "ATG", "AUS", "AUT", "AZE", |
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 should not be hardcoded. The list of countries could vary from one year to another (though unlikely). Please use unique()
over the column with the country codes in the priceframework data (pfw)
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.
Thank you for the comment, I pulled the country list from pfw data.
Thanks
#' @importFrom assertr in_set not_na is_uniq | ||
#' | ||
#' @export | ||
cpi_validate_raw <- function(cpi, detail = getOption("pipaux.detail.raw")){ |
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 sent you an email showing you a real case of a problem that this check should find out... please add a check for that. THANKS!
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.
The case you have sent me via email shows same cpi value for multiple years. What would be the minimum years where the cpi value could be same? In the example, cpi value are same for four survey reference years. In the latest PR, I checked same cpi / duplicate cpi.
Thanks
R/get_error_validation.R
Outdated
|
||
} | ||
|
||
cli::cli_inform("Validation report ('validation_report') has been added to the environment varaible (.pipaux).") |
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.
Please use cli
syntax. like "({.field validation_report})"
. See here: https://cli.r-lib.org/reference/inline-markup.html
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.
Thank you, I implemented your suggestion.
Thanks
@@ -27,6 +28,9 @@ pip_country_list <- function(action = c("update", "load"), | |||
## Special national accounts -------- | |||
cl <- pip_country_list_update(class_branch = class_branch) | |||
|
|||
# validate country list raw data | |||
cl_validate_raw(cl, detail = detail) |
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 i am a little confused. Where does cl_validate_output()
go? Thanks.
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.
The results from this function depends on value of detail argument. By default (detail = FALSE), for example result cl_validate_output() goes to the console. If detail = TRUE, the result will be emailed (now - will be printed to the console when we run send_report() function)
Thanks
|
||
print(.pipaux$validation_report) | ||
|
||
# fname <- file.path(tempdir(), "data_validation_report.csv") |
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.
We will work on this later, right?
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.
Yes, it will work !
R/weo_validate_raw.R
Outdated
description = "`2026` should be character") |> | ||
validate_if(is.character(`2027`), | ||
description = "`2027` should be character") |> | ||
validate_if(is.character(`2028`), |
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.
There should be an easier way to check all these columns. First, these columns will increase and we can't update the code each time they do. Second, the importance here is that they years exists, so that's what is needed to be checked. There should no be jumps in the years.
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.
Thanks for the comment, I have implemented your comment in the latest PR.
Data/git_metadata.csv
Outdated
@@ -0,0 +1,25 @@ | |||
Repo,hash,branch |
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 am not sure, this file should be part of the PR. It could break something else later on. For now, remove it from the PR. Thanks.
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 have removed this file from the latest PR.
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.
Hi @Tefera19 ,
I think the PR is really, really good. Great job. Thanks.
I added a few comments. Please address them and push to the same branch. You don't neet to create a new PR. Just let me know when it is ready to review again. Thanks!
Hi @Tefera19 , I'm closing this PR because we need this changes to be added to branch Thank you. |
Hi @randrescastaneda,
I have added `detail' argument in the main functions.