Skip to content

Commit

Permalink
remove outdated cc license check and normalisation routine #109
Browse files Browse the repository at this point in the history
  • Loading branch information
njahn82 committed Feb 15, 2021
1 parent d47a256 commit 7236525
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 140 deletions.
3 changes: 0 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ export(get_license_md)
export(ind_table_to_gt)
export(indexing_status)
export(license_check)
export(license_normalise)
export(license_report)
export(license_val)
export(metrics_overview)
export(open_apc_collections)
export(open_apc_get)
Expand Down
85 changes: 0 additions & 85 deletions R/cr_md_fetch.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,88 +19,3 @@ get_cr_md <- function(dois, .progress = "text") {
}
out
}
#' License checker
#'
#' Retrieves records from Crossref metadata where
#' the version of record (vor), i.e. publisher version
#' is provided under a Creative Commons license without delay.
#'
#' @param cr tibble with Crossref metadata retrieved from
#' API with `rcrossref:.cr_works()`
#' @importFrom tidyr unnest
#' @importFrom dplyr `%>%` select mutate filter
#'
#' @export
#'
license_val <- function(cr) {
if (!is.null(cr))
license_df <- cr %>%
select(doi, license) %>%
unnest(cols = c(license)) %>%
filter(# applies to version of record
content.version == "vor",
# has CC license
grepl("creativecommons", URL),
# valid without delay
delay.in.days == 0)
return(license_df)
}
#' Obtain records with non-compliant license information
#'
#' @description In case license metadata do not comply, what are the reasons:
#' - Did the publisher provide license metadata for the article?
#' - Is the article provided under a CC license?
#' - Did the CC license apply immediately after publication?
#'
#' @param cr tibble with non-compliant license metadata retrieved from the
#' Crossref API with `rcrossref:.cr_works()`
#' @importFrom tidyr unnest
#' @importFrom dplyr `%>%` select filter
#'
#' @export
license_report <- function(cr) {
faulty_case <- cr %>%
select(doi, license) %>%
unnest(cols = license)
# Are license metadata available?
out <- tibble::tibble(doi = unique(faulty_case$doi))
if (!any(faulty_case[["content.version"]] == "vor")) {
reason <- "No license metadata available for published version (version of record)"
# Is version of record published under an CC license
} else if (nrow(filter(
faulty_case,
content.version == "vor",
grepl("creativecommons", URL)
)) == 0) {
reason <-
"No Creative Commons license metadata found for version of record"
# Do publication and license date match?
} else {
reason <-
"Difference between publication date and the CC license's start_date, suggesting delayed OA publication"
}
out$reason <- reason
return(out)
}
#' Normalise license info from Crossref
#'
#' @param cr tibble with non-compliant license metadata retrieved from the
#' Crossref API with `rcrossref:.cr_works()`
#' @importFrom dplyr `%>%` select filter
#'
#' @export
license_normalise <- function(cr) {
license_val(cr) %>%
mutate(license = URL) %>%
mutate(license = gsub(".*creativecommons.org/licenses/", "cc-", license)) %>%
mutate(license = gsub("/3.0*", "", license)) %>%
mutate(license = gsub("/4.0", "", license)) %>%
mutate(license = gsub("/2.0*", "", license)) %>%
mutate(license = gsub("/uk/legalcode", "", license)) %>%
mutate(license = gsub("/igo", "", license)) %>%
mutate(license = gsub("/legalcode", "", license)) %>%
mutate(license = toupper(license)) %>%
mutate(license = gsub("CC-BY-NCND", "CC-BY-NC-ND", license)) %>%
mutate(license = gsub("/", "", license)) %>%
mutate(license = tolower(license))
}
15 changes: 0 additions & 15 deletions man/license_normalise.Rd

This file was deleted.

20 changes: 0 additions & 20 deletions man/license_report.Rd

This file was deleted.

17 changes: 0 additions & 17 deletions man/license_val.Rd

This file was deleted.

0 comments on commit 7236525

Please sign in to comment.