darwin-eu-dev / omopgenerics

https://darwin-eu-dev.github.io/omopgenerics/
Apache License 2.0
2 stars 1 forks source link

summarised result - ability to check consistent package versions #477

Closed edward-burn closed 2 weeks ago

edward-burn commented 1 month ago

For example, this would allow me to easily check data partners had used the same versions of an analytic package used to generate a result

catalamarti commented 3 weeks ago

create function:

resultPackageVersion <- function(result) {
  - check that it is a summarised result (validateResultArgument with all checks turned to FALSE)
  - get settings and report packages and versions used
  - if there are multiple versions of a package throw a warning
}
ilovemane commented 2 weeks ago

I am a bit unclear on this one. So this function is just checking the summariseResult don't contain different package version? Or we comparing two different summariseResult object? @catalamarti

ilovemane commented 2 weeks ago

i guess this will be used after we bind all the summariseResult from different dataPartner? Or we apply this before?

catalamarti commented 2 weeks ago

resultPackageVersion <- function(result) {
  # initial checks
  validateResultArguemnt(result)

  # get sets
  set <- settings(result) |>
    dplyr::select("result_id", "result_type", "package_name", "package_version")

  # throw warning if two versions of the same package have been used
  pkgToWarn <- set |>
    dplyr::group_by(.data$package_name) |>
    dplyr::tally() |>
    dplyr::filter(.data$n > 1)
  # message with the used versions

  # fancy print
  cli::cli_inform("{xx} different packages used in this {.cls summarised_result}:")
  x <- set |>
    dplyr::select("package_name", "package_version") |>
    dplyr::distinct()
  # ....

  return(invisible(set))
}