@@ -12,7 +12,8 @@ main <- function(){
1212 option_list <- list (
1313 make_option(c(" -r" , " --rows" ), type = " integer" , default = 100000 ,
1414 help = " Number of rows to return from query [default %default]" ),
15- make_option(c(" -n" , " --nodes" ), type = " character" , help = " Comma separated list of nodes to query" )
15+ make_option(c(" -n" , " --nodes" ), type = " character" , help = " Comma separated list of nodes to query" ),
16+ make_option(c(" -s" , " --sources" ), type = " character" , help = " Comma separated list of sources to use" )
1617 )
1718
1819 # parse command-line arguments
@@ -21,8 +22,7 @@ main <- function(){
2122
2223 num_rows <- opts $ rows
2324 nodes <- strsplit(opts $ nodes , " ," , fixed = TRUE )[[1 ]]
24-
25- sources <- c(" plos" , " xdd" , " scopus" , " springer" )
25+ sources <- strsplit(opts $ sources , " ," , fixed = TRUE )[[1 ]]
2626
2727 dois <- c()
2828 for (node in nodes ){
@@ -45,7 +45,7 @@ main <- function(){
4545 existing_citations <- get_metrics_citations()
4646 new_citations <- anti_join(found_citations , existing_citations , by = c(" dataset_id" = " target_id" , " article_id" = " source_id" ))
4747 if (nrow(new_citations ) > 0 ) {
48- write.csv(new_citations , fp , row.names = FALSE )
48+ write.csv(new_citations , fp , row_names = FALSE )
4949 } else {
5050 writeLines(" No new citations found." , fp )
5151 }
@@ -54,15 +54,21 @@ main <- function(){
5454
5555get_node_dois <- function (node_id , num_rows ) {
5656 mn <- getMNode(CNode(" PROD" ), node_id )
57- queryParamList <- list (q = " id:doi* OR seriesId:doi*" ,
58- fl = " id, seriesId" ,
59- start = " 0" ,
60- rows = num_rows )
61- result <- query(mn , solrQuery = queryParamList , as = " data.frame" , parse = FALSE )
57+ result <- data.frame ()
58+ for (i in seq(0 , num_rows - 1000 , 1000 )){
59+ res <- dataone :: query(mn , list (q = " id:doi* OR seriesId:doi*" ,
60+ fl = " id, seriesId" ,
61+ start = i ,
62+ rows = 1000 ),
63+ as = " data.frame" ,
64+ parse = FALSE )
65+ result <- rbind(cd , res )
66+ }
6267 pids <- c(result $ id , result $ seriesId )
6368 dois <- grep(" doi:" , pids , value = TRUE )
6469 return (dois )
6570}
71+
6672get_metrics_citations <- function (from = as.POSIXct(" 2000-01-01" ), to = as.POSIXct(Sys.Date())){
6773 from <- as.Date(from ); to <- as.Date(to )
6874 from_q <- paste(stringr :: str_pad(month(from ), 2 , side = " left" , pad = " 0" ),
0 commit comments