Skip to content

Commit

Permalink
make nsf award numbers in db better able to detect awards in old EML …
Browse files Browse the repository at this point in the history
…docs
  • Loading branch information
jeanetteclark committed Mar 14, 2024
1 parent d929cad commit d5eb4af
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/checks/nsf.award.number.in.db-2.0.0.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
output = list(
list(value = "No NSF award numbers are present in the metadata document, so this check was skipped.")
))
} else if (!is.null(awardText) &&
str_detect(tolower(awardText), "nsf|national science foundation")) {
} else if (!is.null(awardText)) {
awards <- str_extract(awardText, "[0-9]{6,7}")
} else if (!is.null(awardNumber)) {
awards <- awardNumber
Expand All @@ -42,15 +41,20 @@
if (all(is_found)) {
mdq_result <- list(status = "SUCCESS",
output = list(list(value = "All award numbers were found in the NSF award database.")))
} else {
} else {
outputs <- paste0("The award number '", awards[!is_found], "' was not found in the NSF award database.")
if (length(awards[is_found] > 0)){
outputs_success <- paste0("The award number(s) '", paste0(awards[is_found], collapse = ", "), "' was/were found in the NSF award database.")
outputs <- paste(outputs, outputs_success)
}
mdq_result <- list(status = "ERROR",
output = lapply(outputs, function(message) { list(value = message) }))
}
} else {
mdq_result <- list(status = "SKIP",
output = list(list(value = "No NSF award numbers are present in the metadata document, so this check was skipped.")))
}
]]></code>
<selector>
<name>awardNumber</name>
Expand Down

0 comments on commit d5eb4af

Please sign in to comment.