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

Downgrade missing metadata file to <check_failure> when validation model output files. (#138) #144

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/check_submission_metadata_file_exists.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ check_submission_metadata_file_exists <- function(file_path, hub_path = ".") {
msg_subject = "Metadata file",
msg_attribute = msg_attribute,
msg_verbs = c("exists", "does not exist"),
error = TRUE
error = FALSE
)
}
3 changes: 0 additions & 3 deletions R/validate_model_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ validate_model_file <- function(hub_path, file_path,
file_path = file_path
), file_path
)
if (is_any_error(checks$metadata_exists)) {
return(checks)
}

custom_checks <- execute_custom_checks(validations_cfg_path = validations_cfg_path)
checks <- combine(checks, custom_checks)
Expand Down
2 changes: 1 addition & 1 deletion inst/check_table.csv
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ file_name,File name valid,TRUE,check_error,validate_model_file,check_file_name,,
file_location,File located in correct team directory,FALSE,check_failure,validate_model_file,check_file_location,,FALSE
round_id_valid,File round ID is valid hub round IDs,TRUE,check_error,validate_model_file,check_valid_round_id,,FALSE
file_format,File format is accepted hub/round format,TRUE,check_error,validate_model_file,check_file_format,,FALSE
metadata_exists,Model metadata file exists in expected location,TRUE,check_error,validate_model_file,check_submission_metadata_file_exists,,FALSE
metadata_exists,Model metadata file exists in expected location,FALSE,check_failure,validate_model_file,check_submission_metadata_file_exists,,FALSE
file_read,File can be read without errors,TRUE,check_error,validate_model_data,check_file_read,,FALSE
valid_round_id_col,Round ID var from config exists in data column names. Skipped if `round_id_from_var` is FALSE in config.,FALSE,check_failure,validate_model_data,check_valid_round_id_col,,FALSE
unique_round_id,Round ID column contains a single unique round ID. Skipped if `round_id_from_var` is FALSE in config.,TRUE,check_error,validate_model_data,check_tbl_unique_round_id,,FALSE
Expand Down
4 changes: 2 additions & 2 deletions man/validate_model_file.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/validate_pr.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/validate_submission.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Code
check_submission_metadata_file_exists(hub_path = hub_path, file_path = "random-model/2022-10-01-random-model.csv")
Output
<error/check_error>
<error/check_failure>
Error:
! Metadata file does not exist at path 'model-metadata/random-model.yml' or 'model-metadata/random-model.yaml'.

867 changes: 701 additions & 166 deletions tests/testthat/_snaps/validate_pr.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions tests/testthat/test-validate_pr.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ test_that("validate_pr flags modifications and deletions in PR", {
branch = "test-mod-del"
)

# This checks that removed metadata and model-output files are detected and
# flagged as check errors.
# It also checks that missing metadata files do not cause early return
# of submission validation of model output file.
mod_checks_error <- suppressMessages(
validate_pr(
hub_path = temp_hub,
Expand Down Expand Up @@ -90,6 +94,10 @@ test_that("validate_pr flags modifications and deletions in PR", {
)
)

# This checks that removed metadata and model-output files are detected and
# flagged as check failure.
# It also checks that missing metadata files do not cause early return
# of submission validation of model output file.
mod_checks_warn <- suppressMessages(
validate_pr(
hub_path = temp_hub,
Expand Down
Loading