@@ -52,11 +52,6 @@ get_papers <- function(query, params) {
5252 funder = funder ,
5353 format = ' xml' )
5454 pubs_metadata <- parse_response(response )
55- # FYI: The deactivation of the fill_dois() function is a hotfix
56- # to enable creation of OpenAIRE project maps
57- # TODO: root cause analysis of failure mode
58- # TODO: refactor/replace/remove the function, decision pending
59- # pubs_metadata <- fill_dois(pubs_metadata)
6055 },
6156 error = function (err ){
6257 olog $ warn(paste0(" vis_id:" , .GlobalEnv $ VIS_ID , " publications: " , err ))
@@ -193,34 +188,6 @@ parse_response <- function(response) {
193188 }
194189}
195190
196- fill_dois <- function (df ) {
197- missing_doi_indices <- which(is.na(df $ doi ))
198- titles <- df [missing_doi_indices ,]$ title
199- if (exists(" DEBUG" ) && DEBUG ) {
200- olog $ debug(paste(" Missing DOIs:" , length(titles )))
201- olog $ debug(" Time for filling missing DOIs" )
202- olog $ debug(system.time(cr_works(query = queries(titles ), async = TRUE )))
203- }
204- tryCatch({
205- if (length(titles ) > 1 ) {
206- response <- cr_works(query = queries(titles ))
207- candidates <- lapply(response , get_doi_candidates )
208- dois <- mapply(check_distance , titles , candidates , USE.NAMES = FALSE )
209- } else if (length(titles ) == 1 ) {
210- response <- cr_works(flq = c(' query.title' = titles ))$ data
211- candidate_response = response [1 ,]
212- dois <- check_distance(titles , candidate_response )
213- } else {
214- dois <- " "
215- }
216- df $ doi [c(missing_doi_indices )] <- dois
217- }, error = function (err ){
218- olog $ error(paste(" vis_id:" , .GlobalEnv $ VIS_ID , " DOI enrichment failed:" , paste(err )))
219- }
220- )
221- return (df )
222- }
223-
224191get_doi_candidates <- function (response ){
225192 if (nrow(response ) > = 1 ) {
226193 candidate = response [1 ,c(' doi' , ' title' )]
0 commit comments