Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions server/preprocessing/other-scripts/openaire.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ get_papers <- function(query, params) {
funder = funder,
format = 'xml')
pubs_metadata <- parse_response(response)
# FYI: The deactivation of the fill_dois() function is a hotfix
# to enable creation of OpenAIRE project maps
# TODO: root cause analysis of failure mode
# TODO: refactor/replace/remove the function, decision pending
#pubs_metadata <- fill_dois(pubs_metadata)
},
error = function(err){
olog$warn(paste0("vis_id:", .GlobalEnv$VIS_ID, "publications: ", err))
Expand Down Expand Up @@ -193,34 +188,6 @@ parse_response <- function(response) {
}
}

fill_dois <- function(df) {
missing_doi_indices <- which(is.na(df$doi))
titles <- df[missing_doi_indices,]$title
if (exists("DEBUG") && DEBUG) {
olog$debug(paste("Missing DOIs:", length(titles)))
olog$debug("Time for filling missing DOIs")
olog$debug(system.time(cr_works(query=queries(titles), async=TRUE)))
}
tryCatch({
if (length(titles) > 1) {
response <- cr_works(query=queries(titles))
candidates <- lapply(response, get_doi_candidates)
dois <- mapply(check_distance, titles, candidates, USE.NAMES=FALSE)
} else if (length(titles) == 1) {
response <- cr_works(flq=c('query.title'=titles))$data
candidate_response = response[1,]
dois <- check_distance(titles, candidate_response)
} else {
dois <- ""
}
df$doi[c(missing_doi_indices)] <- dois
}, error=function(err){
olog$error(paste("vis_id:", .GlobalEnv$VIS_ID, "DOI enrichment failed:", paste(err)))
}
)
return (df)
}

get_doi_candidates <- function(response){
if (nrow(response) >= 1) {
candidate = response[1,c('doi', 'title')]
Expand Down
Loading