Publications pull from orcid in script. Edits to reflect.

This commit is contained in:
Andreas Gammelgaard Damsbo 2023-05-08 11:23:49 +02:00
parent 60dc4de757
commit 1ff7a20ebf
3 changed files with 29 additions and 43 deletions

27
cv.Rmd
View File

@ -3,7 +3,7 @@ name: Andreas
surname: Gammelgaard Damsbo
position: "MD, PhD-student"
pronouns: he/him
address: "Danish Stroke Centre, Neurology, Aarhus University Hospital"
address: "Danish Stroke Centre, Neurology, Aarhus University Hospital, Denmark"
phone: "+45 2490 3612"
www: "andreas.gdamsbo.dk"
email: "andrlr@rm.dk"
@ -23,6 +23,7 @@ library(tibble)
library(rorcid)
orc_id <- "0000-0002-7559-1154"
get_new_pub_list <- FALSE
# Notes
# https://stackoverflow.com/questions/63067088/syntax-for-publication-list-with-full-authors
@ -57,27 +58,11 @@ tribble(
```
```{r}
library(dplyr)
library(rorcid)
if (!file.exists("publications.bib")) {
works <- rorcid::orcid_works(orc_id)[[1]]
dois <-
Reduce(c, do.call(
cbind,
lapply(works$works$`external-ids.external-id`, function(a) {
if ("doi" %in% c(a[[1]])) {
s <- do.call(cbind, a)
s[, "external-id-normalized.value"][s[, "external-id-type"] == "doi"]
}
})
)) |> na.omit() |> unique()
# rorcid::check_dois(dois)
RefManageR::GetBibEntryWithDOI(dois) |> rbibutils::writeBib("publications.bib")
if (get_new_pub_list | !file.exists("publications.bib")) {
source("orcid_pubs.R")
orcid_pubs(orc_id)
}
bibliography_entries("publications.bib") %>%
arrange(desc(author$family), issued)
arrange(desc(issued))
```

17
orcid_pubs.R Normal file
View File

@ -0,0 +1,17 @@
orcid_pubs <- function(orcid, path="publications.bib"){
dois <- Reduce(c,lapply(orcid,function(o){
works <- rorcid::orcid_works(orcid)[[1]]
Reduce(c, do.call(
cbind,
lapply(works$works$`external-ids.external-id`, function(a) {
if ("doi" %in% c(a[[1]])) {
s <- do.call(cbind, a)
s[, "external-id-normalized.value"][s[, "external-id-type"] == "doi"]
# Using the normalized values, a check has been run for bad DOIs
}
})
)) |> na.omit() |> unique()
}))
RefManageR::GetBibEntryWithDOI(dois) |> rbibutils::writeBib(path)}

View File

@ -23,16 +23,13 @@ library(tibble)
library(rorcid)
orc_id <- "0000-0002-7559-1154"
# Notes
# https://stackoverflow.com/questions/63067088/syntax-for-publication-list-with-full-authors
scholar_id <- "Y80Xqc4AAAAJ"
```
# Publications
```{r}
# library(scholar)
# scholar_id <- "Y80Xqc4AAAAJ"
# l <- get_profile(scholar_id)
# scholar::get_publications(scholar_id) |> writeLines("publications.bib")
# bibliography_entries("publications.bib") %>%
@ -40,24 +37,11 @@ orc_id <- "0000-0002-7559-1154"
```
```{r}
library(dplyr)
library(rorcid)
if (get_new_pub_list | !file.exists("publications.bib")) {
source("orcid_pubs.R")
orcid_pubs(orc_id)
}
# works <- rorcid::orcid_works(orc_id)[[1]]
#
# edu <- do.call("rbind",
# rorcid::orcid_educations(orc_id)[[1]]
# )
# orc_id <- "0000-0002-7559-1154"
# pubs <- orcid_citations(orcid = orc_id, put_code=NULL)
#
# writeLines(pubs$citation, "publications.bib")
# bibliography_entries("pubs.bib") %>%
# arrange(desc(author$family), issued)
bibliography_entries("pubs.bib") %>%
bibliography_entries("publications.bib") %>%
arrange(desc(issued))
## Currently not working; I think it is due to error in DOI lookup with latest article.
```