|
| 1 | +## setup ---- |
| 2 | + |
| 3 | +if (Sys.getenv("AIRTABLE_API_KEY") == ""){ |
| 4 | + Sys.setenv(AIRTABLE_API_KEY = params$AIRTABLE_API_KEY) |
| 5 | +} |
| 6 | +if (Sys.getenv("AIRTABLE_ID") == ""){ |
| 7 | + Sys.setenv(AIRTABLE_ID = params$AIRTABLE_ID) |
| 8 | +} |
| 9 | + |
| 10 | +## all reviewers ---- |
| 11 | +at_rev <- airtabler::airtable(base = Sys.getenv("AIRTABLE_ID"), |
| 12 | + table = "reviewers-prod") |
| 13 | +reviewers <- at_rev$`reviewers-prod`$select_all() |
| 14 | + |
| 15 | +## eic ---- |
| 16 | + |
| 17 | +at_eic <- airtabler::airtable(base = Sys.getenv("AIRTABLE_ID"), |
| 18 | + table = "editor-in-chief-rotation") |
| 19 | +eic <- at_eic$`editor-in-chief-rotation`$select_all() |
| 20 | + |
| 21 | +eic$period_start <- as.Date(eic$period_start) |
| 22 | +eic$period_end <- as.Date(eic$period_end) |
| 23 | +today <- Sys.Date () |
| 24 | +eic_now <- eic [which (eic$period_start <= today & eic$period_end >= today), ] |
| 25 | +eic_name <- eic_now$acting_eic_name [[1]] |
| 26 | +eic_id <- eic_now$acting_eic |
| 27 | +eic_in_rev_table <- which(reviewers$id == eic_id) |
| 28 | +eic_github <- reviewers$github[eic_in_rev_table] |
| 29 | + |
| 30 | +## guest editors ---- |
| 31 | + |
| 32 | +at_guest <- airtabler::airtable(base = "app8dssb6a7PG6Vwj", |
| 33 | + table = "guest-editors") |
| 34 | + |
| 35 | + |
| 36 | +editor_index_all <- purrr::map_lgl(reviewers$editor, ~!is.null(.)) |
| 37 | +editors_all <- reviewers[which(editor_index_all), c("name", "github", "Affiliation", "editor")] |
| 38 | +editors_all <- editors_all [which(!editors_all$name == eic_name), ] |
| 39 | +last_names <- humaniformat::last_name(trimws(editors_all$name)) |
| 40 | +editors_all <- editors_all[order(last_names), ] |
| 41 | + |
| 42 | +editors_past <- editors_all[grep("Emeritus", editors_all$editor), ] |
| 43 | +editors <- editors_all[which(!editors_all$name %in% editors_past$name), ] |
| 44 | + |
| 45 | +guest_editors <- at_guest$`guest-editors`$select_all() |
| 46 | + |
| 47 | +guest_editors <- airtabler::airtable(base = "app8dssb6a7PG6Vwj", |
| 48 | + table = "guest-editors") |
| 49 | +guest_editors <- guest_editors$`guest-editors`$select_all(fields = list("name", "github")) |
| 50 | +guest_editors <- guest_editors[!(guest_editors$name %in% c(editors$name, "???")), ] |
| 51 | +last_names <- humaniformat::last_name(trimws(guest_editors$name)) |
| 52 | +guest_editors <- guest_editors[order(last_names), ] |
| 53 | + |
| 54 | +## reviewers that are not editors ---- |
| 55 | + |
| 56 | +reviewers <- reviewers[purrr::map_lgl(reviewers$reviews, |
| 57 | + ~!is.null(.)) & |
| 58 | + !(reviewers$name %in% c(editors_all$name, "???")), ] |
| 59 | +last_names <- humaniformat::last_name(trimws(reviewers$name)) |
| 60 | +reviewers <- reviewers[order(last_names), ] |
| 61 | +reviewers$name[is.na(reviewers$name)] <- reviewers$github[is.na(reviewers$name)] |
0 commit comments