library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(GithubMetrics)

Intro

The following vignette shows how the OS Health is calculated, with the aim of capturing the current vibrancy of the packages community, and their activity on the repo.

It is important to note that ‘OS Health’ is not equivalent to metrics assessed in riskmetric. An example being a stable and mature statistical R package that could be orphaned, or stable enough activity has largely ended. In terms of ‘OS Health’, the developer community is not active - but the package itself could still be robust and meeting all it’s intended use cases (OS Health and the scope of riskmetric would overlap though if the package has stale open issues that are being ignored).

Note - in the context of openpharma.github.io and the pharmaverse.org, we may deprecate using this package and move to GrimoreLab tooling.

Get data

# repos
  repos <- c(
    "Roche/crmPack" ,
    "Roche/rtables",
    "openpharma/visR",
    "openpharma/GithubMetrics",
    "pharmaverse/admiral"
  )

# commits
  commits <- gh_commits_get(
    repos,
    days_back = 365*10
  )

# issues
  issues <- gh_issues_get(repos, days_back =  365*10)

Create metrics

issues_enriched <- issues %>%
  mutate(
    days_open = as.numeric(Sys.Date() - as.Date(created)),
    days_no_activity = as.numeric(Sys.Date() - as.Date(updated))
  ) %>%
  select(
    full_name, state, days_open, days_no_activity
  )

commits_enriched <- commits %>%
  mutate(
    date = as.Date(datetime)
  ) %>%
  select(full_name, date, author)

scoring <- tibble(
  full_name = unique(commits$full_name)
  ) %>%
  left_join(
    gh_metric_issues(issues_enriched), by = "full_name"
  ) %>%
  left_join(
    gh_metric_commits_days_since_commit(commits_enriched), by = "full_name"
  ) %>%
  left_join(
    gh_metric_commits_prepost_midpoint(commits_enriched), by = "full_name"
  ) %>%
  left_join(
    gh_metric_commits_authors_ever(commits_enriched), by = "full_name"
  ) %>%
  left_join(
    gh_metric_commits_authors_prepost_midpoint(commits_enriched), by = "full_name"
  ) %>%
  gh_score()

Results

These results were generated at 2022-02-08 10:19:59.

scoring %>% select(full_name, score) %>%
  knitr::kable(
    caption = "OS Health Score"
  )
OS Health Score
full_name score
Roche/crmPack 86
Roche/rtables 71
openpharma/visR 100
openpharma/GithubMetrics 43
pharmaverse/admiral 86

Negative factors lowering OS health.

for (i in 1:nrow(scoring)){
  cat(glue::glue("

*{scoring[i,]$full_name}*
    
* Score is {scoring[i,]$score}  
{scoring[i,]$warnings}
    
    
  "))
}

Roche/crmPack

  • Score is 86
  • This project had 3 contributors in the last half of it’s life, and 10 in it’s first half

Roche/rtables

  • Score is 71
  • This project has a median inactivity on open issues of 128.5 days
  • This project had 2 contributors in the last half of it’s life, and 17 in it’s first half

openpharma/visR

  • Score is 100

openpharma/GithubMetrics

  • Score is 43
  • This project has 1 contributor(s)
  • This project has a median age for open issues of 367 days
  • This project has a median inactivity on open issues of 366 days
  • This project had 0 contributors in the last half of it’s life, and 1 in it’s first half

pharmaverse/admiral

  • Score is 86
  • This project had 9 contributors in the last half of it’s life, and 27 in it’s first half