Skip to content

Commit fbd463d

Browse files
committed
add data input to org dashboard #99
1 parent 8d73cdc commit fbd463d

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: repometrics
22
Title: Metrics for Your Code Repository
3-
Version: 0.1.6.006
3+
Version: 0.1.6.007
44
Authors@R:
55
person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-2172-5265"))

R/quarto-dashboard-org.R

+23
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#' @export
1313
orgmetrics_dashboard <- function (data_org, data_users, action = "preview") {
1414

15+
data_org <- data_org_preprocess (data_org)
16+
1517
requireNamespace ("brio")
1618
requireNamespace ("jsonlite")
1719
requireNamespace ("quarto")
@@ -23,8 +25,29 @@ orgmetrics_dashboard <- function (data_org, data_users, action = "preview") {
2325
path_src <- system.file ("extdata", "quarto-org", package = "repometrics")
2426
path_dest <- fs::path (fs::path_temp (), "quarto-org")
2527
dir <- fs::dir_copy (path_src, path_dest, overwrite = TRUE)
28+
saveRDS (data_org, fs::path (dir, "results-org.Rds"))
2629

2730
withr::with_dir (dir, {
2831
do.call (eval (parse (text = quarto_action)), list ())
2932
})
3033
}
34+
35+
#' Pre-process organization data by converting all model values to standard
36+
#' z-scores, retrieving the latest value only for each package, and generating
37+
#' a "final" score from the sum across all model scores. Higher values of this
38+
#' final score are better than lower values.
39+
#' @noRd
40+
data_org_preprocess <- function (data_org) {
41+
42+
data_org |>
43+
dplyr::mutate (
44+
dplyr::across (dplyr::where (is.numeric), ~ scale (.) [, 1])
45+
) |>
46+
dplyr::group_by (package) |>
47+
dplyr::slice_head (n = 1L) |>
48+
dplyr::mutate (
49+
final = sum (dplyr::across (dplyr::where (is.numeric))),
50+
.after = "date"
51+
) |>
52+
dplyr::arrange (dplyr::desc (final))
53+
}

codemeta.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"codeRepository": "https://github.com/ropensci-review-tools/repometrics",
99
"issueTracker": "https://github.com/ropensci-review-tools/repometrics/issues",
1010
"license": "https://spdx.org/licenses/GPL-3.0",
11-
"version": "0.1.6.006",
11+
"version": "0.1.6.007",
1212
"programmingLanguage": {
1313
"@type": "ComputerLanguage",
1414
"name": "R",

0 commit comments

Comments
 (0)