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

Find way to print missing df when check_tbl_values_required() fails #16

Open
annakrystalli opened this issue Aug 2, 2023 · 0 comments
Labels
feature a feature request or enhancement unit-check

Comments

@annakrystalli
Copy link
Contributor

Currently I'm just attaching a tibble of missing required rows that should be present given.

It would be nice to be able to print this to the console in a pretty way.

Briefly experimented with the following:

library(hubValidations)
hub_path <- system.file("testhubs/flusight", package = "hubUtils")
file_path <- "hub-ensemble/2023-05-08-hub-ensemble.parquet"
round_id <- "2023-05-08"
tbl <- read_model_out_file(file_path, hub_path)
res <- check_tbl_values_required(tbl[-(24:25), ], round_id, file_path, hub_path)
res
#> <warning/check_failure>
#> Warning:
#> Required task ID/output type/output type ID combinations missing.  See
#> `missing` attribute for details.


# Print tbl with cli - NOPE
c(names(res$missing), as.vector(t(res$missing))) %>%
    cli::ansi_columns(
        fill = "rows",
        max_cols = ncol(res$missing)) %>%
    cli::boxx()
#> ┌──────────────────────────────────────────────────────────────────────────────────────┐
#> │                                                                                      │
#> │   forecast_date              target                    horizon                       │
#> │   location                   output_type               output_type_id                │
#> │   2023-05-08                 wk ahead inc flu hosp     2                             │
#> │   US                         quantile                  0.01                          │
#> │   2023-05-08                 wk ahead inc flu hosp     2                             │
#> │   US                         quantile                  0.025                         │
#> │                                                                                      │
#> └──────────────────────────────────────────────────────────────────────────────────────┘

# Print tbl with huxtable
huxtable::as_hux(res$missing) %>%
    huxtable::print_screen()
#>      forecast_d   target       horizon   location   output_typ   output_typ  
#>             ate                                     e            e_id        
#>      2023-05-08   wk ahead           2   US         quantile     0.01        
#>                   inc flu                                                    
#>                   hosp                                                       
#>      2023-05-08   wk ahead           2   US         quantile     0.025       
#>                   inc flu                                                    
#>                   hosp                                                       
#> 
#> Column names: forecast_date, target, horizon, location, output_type,
#> output_type_id

Created on 2023-08-02 with reprex v2.0.2

@annakrystalli annakrystalli added feature a feature request or enhancement unit-check labels Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement unit-check
Projects
Status: Todo
Development

No branches or pull requests

1 participant