Skip to content

Commit

Permalink
refactor README code into scripts cc @mpadge
Browse files Browse the repository at this point in the history
  • Loading branch information
maelle committed Aug 16, 2024
1 parent 11e3ae2 commit 780a7ae
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 78 deletions.
96 changes: 22 additions & 74 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ knitr::opts_chunk$set(
)
```

![ropensci](icon_lettering_color.png)
![](icon_lettering_color.png)

# rOpenSci Software Peer Review

Expand Down Expand Up @@ -94,92 +94,45 @@ on how to improve the process on our [forum](https://discuss.ropensci.org/) and
rOpenSci's Software Peer Review process is run by our team of dedicated editors and reviewers.
Information on the current team, and the current status of software peer review, can be seen on our [interactive dashboard](https://ropensci-review-tools.github.io/dashboard/).

```{r get-airtable-data, warning=FALSE, echo=FALSE}
if (Sys.getenv("AIRTABLE_API_KEY") == ""){
Sys.setenv(AIRTABLE_API_KEY = params$AIRTABLE_API_KEY)
}
if (Sys.getenv("AIRTABLE_ID") == ""){
Sys.setenv(AIRTABLE_ID = params$AIRTABLE_ID)
}
at_eic <- airtabler::airtable(base = Sys.getenv("AIRTABLE_ID"),
table = "editor-in-chief-rotation")
eic <- at_eic$`editor-in-chief-rotation`$select_all()
at_rev <- airtabler::airtable(base = Sys.getenv("AIRTABLE_ID"),
table = "reviewers-prod")
reviewers <- at_rev$`reviewers-prod`$select_all()
at_guest <- airtabler::airtable(base = "app8dssb6a7PG6Vwj",
table = "guest-editors")
guest_editors <- at_guest$`guest-editors`$select_all()
```{r}
#| echo: false
#| results: 'asis'
source(file.path("scripts", "airtable-get-data.R"), local = knitr::knit_global())
```


### Editor-in-Chief

```{r eic, echo=FALSE, results='asis'}
eic$period_start <- as.Date(eic$period_start)
eic$period_end <- as.Date(eic$period_end)
today <- Sys.Date ()
eic_now <- eic [which (eic$period_start <= today & eic$period_end >= today), ]
eic_name <- eic_now$acting_eic_name [[1]]
eic_id <- eic_now$acting_eic
eic_in_rev_table <- which(reviewers$id == eic_id)
eic_github <- reviewers$github[eic_in_rev_table]
out <- paste0(
"We rotate our Editor-in-Chief, generally every three months. ",
"Our current Editor-in-Chief is [", eic_name, "](https://github.com/",
eic_github, ").\n"
)
cat(out, sep = "")
```{r}
#| echo: false
#| results: 'asis'
source(file.path("scripts", "airtable-get-eic.R"), local = knitr::knit_global())
```


### Editorial team

```{r editors, echo=FALSE}
editor_index_all <- purrr::map_lgl(reviewers$editor, ~!is.null(.))
editors_all <- reviewers[which(editor_index_all), c("name", "github", "Affiliation", "editor")]
editors_all <- editors_all [which(!editors_all$name == eic_name), ]
last_names <- humaniformat::last_name(trimws(editors_all$name))
editors_all <- editors_all[order(last_names), ]
editors_past <- editors_all[grep("Emeritus", editors_all$editor), ]
editors <- editors_all[which(!editors_all$name %in% editors_past$name), ]
```

Our current team of editors for software peer-review includes:

```{r gen_ed_out-fn, echo=FALSE}
gen_ed_out <- function(ed_dat) {
if (!"Affiliation" %in% names(ed_dat)) {
ed_dat$Affiliation <- NA_character_
}
out <- gsub("(,\\sNA|\\s);", ";", paste0(
"- [", ed_dat$name, "](https://github.com/", ed_dat$github, "), ",
ed_dat$Affiliation, ";\n"))
out[length(out)] <- gsub(";\\n$", ".\n", out[length(out)])
return(out)
}
```
```{r editors-out, echo=FALSE, results='asis'}
cat(gen_ed_out(editors), sep = "")
```{r}
#| echo: false
#| results: 'asis'
source(file.path("scripts", "airtable-get-editors.R"), local = knitr::knit_global())
```

### Reviewers and former editors

We are grateful to the following individuals who have offered up their time and expertise to review packages submitted to rOpenSci.

```{r reviewers, echo=FALSE, results='asis'}
reviewers <- reviewers[purrr::map_lgl(reviewers$reviews,
~!is.null(.)) &
!(reviewers$name %in% c(editors_all$name, "???")), ]
# get last names
last_names <- humaniformat::last_name(trimws(reviewers$name))
reviewers <- reviewers[order(last_names), ]
reviewers$name[is.na(reviewers$name)] <- reviewers$github[is.na(reviewers$name)]
cat(paste0("[", reviewers$name, "](https://github.com/", reviewers$github, ")", collapse = " \U00B7 "))
```{r}
#| echo: false
#| results: 'asis'
source(file.path("scripts", "airtable-get-reviewers.R"), local = knitr::knit_global())
```

We are also grateful to the following individuals who have previously served as editors.
Expand All @@ -191,10 +144,5 @@ cat(gen_ed_out(editors_past), sep = "")
And the following who have served as guest editors.

```{r guest-editors-out, echo=FALSE, results='asis'}
guest_editors <- guest_editors[!(guest_editors$name %in%
c(editors_all$name, eic_name, "???")), ]
# get last names
last_names <- humaniformat::last_name(trimws(guest_editors$name))
guest_editors <- guest_editors[order(last_names), ]
cat(gen_ed_out(guest_editors), sep = "")
```
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@

<figure>
<img src="icon_lettering_color.png" alt="ropensci" />
<figcaption aria-hidden="true">ropensci</figcaption>
</figure>
![](icon_lettering_color.png)

# rOpenSci Software Peer Review

Expand Down Expand Up @@ -471,4 +468,5 @@ served as editors.
And the following who have served as guest editors.

- [Ana Laura Diedrichs](https://github.com/anadiedrichs);
- [Adam Sparks](https://github.com/adamhsparks);
- [Hao Zhu](https://github.com/haozhu233).
61 changes: 61 additions & 0 deletions scripts/airtable-get-data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
## setup ----

if (Sys.getenv("AIRTABLE_API_KEY") == ""){
Sys.setenv(AIRTABLE_API_KEY = params$AIRTABLE_API_KEY)
}
if (Sys.getenv("AIRTABLE_ID") == ""){
Sys.setenv(AIRTABLE_ID = params$AIRTABLE_ID)
}

## all reviewers ----
at_rev <- airtabler::airtable(base = Sys.getenv("AIRTABLE_ID"),
table = "reviewers-prod")
reviewers <- at_rev$`reviewers-prod`$select_all()

## eic ----

at_eic <- airtabler::airtable(base = Sys.getenv("AIRTABLE_ID"),
table = "editor-in-chief-rotation")
eic <- at_eic$`editor-in-chief-rotation`$select_all()

eic$period_start <- as.Date(eic$period_start)
eic$period_end <- as.Date(eic$period_end)
today <- Sys.Date ()
eic_now <- eic [which (eic$period_start <= today & eic$period_end >= today), ]
eic_name <- eic_now$acting_eic_name [[1]]
eic_id <- eic_now$acting_eic
eic_in_rev_table <- which(reviewers$id == eic_id)
eic_github <- reviewers$github[eic_in_rev_table]

## guest editors ----

at_guest <- airtabler::airtable(base = "app8dssb6a7PG6Vwj",
table = "guest-editors")


editor_index_all <- purrr::map_lgl(reviewers$editor, ~!is.null(.))
editors_all <- reviewers[which(editor_index_all), c("name", "github", "Affiliation", "editor")]
editors_all <- editors_all [which(!editors_all$name == eic_name), ]
last_names <- humaniformat::last_name(trimws(editors_all$name))
editors_all <- editors_all[order(last_names), ]

editors_past <- editors_all[grep("Emeritus", editors_all$editor), ]
editors <- editors_all[which(!editors_all$name %in% editors_past$name), ]

guest_editors <- at_guest$`guest-editors`$select_all()

guest_editors <- airtabler::airtable(base = "app8dssb6a7PG6Vwj",
table = "guest-editors")
guest_editors <- guest_editors$`guest-editors`$select_all(fields = list("name", "github"))
guest_editors <- guest_editors[!(guest_editors$name %in% c(editors$name, "???")), ]
last_names <- humaniformat::last_name(trimws(guest_editors$name))
guest_editors <- guest_editors[order(last_names), ]

## reviewers that are not editors ----

reviewers <- reviewers[purrr::map_lgl(reviewers$reviews,
~!is.null(.)) &
!(reviewers$name %in% c(editors_all$name, "???")), ]
last_names <- humaniformat::last_name(trimws(reviewers$name))
reviewers <- reviewers[order(last_names), ]
reviewers$name[is.na(reviewers$name)] <- reviewers$github[is.na(reviewers$name)]
12 changes: 12 additions & 0 deletions scripts/airtable-get-editors.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
gen_ed_out <- function(ed_dat) {
if (!"Affiliation" %in% names(ed_dat)) {
ed_dat$Affiliation <- NA_character_
}
out <- gsub("(,\\sNA|\\s);", ";", paste0(
"- [", ed_dat$name, "](https://github.com/", ed_dat$github, "), ",
ed_dat$Affiliation, ";\n"))
out[length(out)] <- gsub(";\\n$", ".\n", out[length(out)])
return(out)
}

cat(gen_ed_out(editors), sep = "")
6 changes: 6 additions & 0 deletions scripts/airtable-get-eic.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
out <- paste0(
"We rotate our Editor-in-Chief, generally every three months. ",
"Our current Editor-in-Chief is [", eic_name, "](https://github.com/",
eic_github, ").\n"
)
cat(out, sep = "")
1 change: 1 addition & 0 deletions scripts/airtable-get-guest-editors.R
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cat(paste0("[", guest_editors$name, "](https://github.com/", guest_editors$github, ")", collapse = " \U00B7 "))
1 change: 1 addition & 0 deletions scripts/airtable-get-reviewers.R
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cat(paste0("[", reviewers$name, "](https://github.com/", reviewers$github, ")", collapse = " \U00B7 "))

0 comments on commit 780a7ae

Please sign in to comment.