Skip to content

Commit 55e8d91

Browse files
committed
make sources configurable
1 parent 666e8f5 commit 55e8d91

4 files changed

Lines changed: 18 additions & 16 deletions

File tree

helm/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: "v1.1.0"
18+
version: "v1.2.0"
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

helm/scripts/search.R

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

5555
get_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+
6672
get_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"),

helm/templates/cron-job.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ spec:
2828
command:
2929
- /bin/sh
3030
- -c
31-
- {{- if .Values.cronjob.rows }}
32-
{{ .Values.cronjob.command }} -r {{ .Values.cronjob.rows }} -n {{ .Values.cronjob.nodes }}
33-
{{- else }}
34-
{{ .Values.cronjob.command }} -n {{ .Values.cronjob.nodes }}
35-
{{- end }}
31+
- {{ .Values.cronjob.command }} -r {{ .Values.cronjob.rows }} -n {{ .Values.cronjob.nodes }} -s {{ .Values.cronjob.sources }}
3632
volumeMounts:
3733
- name: {{ .Values.persistence.claimName }}
3834
mountPath: {{ .Values.persistence.mountPath }}

helm/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ cronjob:
2222
schedule: "0 12 1 * *"
2323
command: Rscript --vanilla /apps/scythe/search.R
2424
nodes: 'urn:node:ARCTIC,urn:node:ESS_DIVE'
25-
# leave blank if returning all rows
25+
sources: 'springer,scopus,xdd'
2626
rows: 10000
2727

2828
serviceAccount:

0 commit comments

Comments
 (0)