Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: use_history in entrez_search becomes web_history #166

Open
billdenney opened this issue Jan 28, 2021 · 0 comments
Open

Comments

@billdenney
Copy link

I learned a bit more about web_history earlier tonight, and I learned how to use it in #163. As I was thinking about the argument, I think it would be more helpful if instead of use_history, the argument was web_history, and it would take a web_history object (or something containing a web_history) and use that instead of creating a new web_history.

What works now is:

library(rentrez)

query_part1 <- "(adolescent[Title/Abstract] OR adolescents[Title/Abstract] OR apprentice[Title/Abstract] OR apprentices[Title/Abstract] OR child[Title/Abstract] OR children[Title/Abstract] OR pupil[Title/Abstract] OR pupils[Title/Abstract] OR student[Title/Abstract] OR students[Title/Abstract] OR teenager[Title/Abstract] OR teenagers[Title/Abstract] OR trainee[Title/Abstract] OR trainees[Title/Abstract] OR young adult[Title/Abstract] OR young adults[Title/Abstract] OR young people[Title/Abstract] OR young worker[Title/Abstract] OR young workers[Title/Abstract] OR younger population[Title/Abstract] OR youth[Title/Abstract])"
query_part3 <- "(frequency[Title/Abstract] OR frequencys[Title/Abstract] OR occurence[Title/Abstract] OR prevalence[Title/Abstract] OR prevalences[Title/Abstract] OR rate[Title/Abstract] OR rates[Title/Abstract] OR risk[Title/Abstract] OR risks[Title/Abstract])"

q1 <- entrez_search(db="pubmed", term=query_part1, use_history=TRUE)
q3 <- entrez_search(db="pubmed", term=query_part3, use_history=TRUE, WebEnv=q1$web_history$WebEnv)

query_combine_1_3 <- sprintf("#%s AND #%s", q1$web_history$QueryKey, q3$web_history$QueryKey)
q1_3 <- entrez_search(db="pubmed", term=query_combine_1_3, use_history=TRUE, WebEnv=q1$web_history$WebEnv)

What I'm hoping could work with this feature request is replaces the last 4 lines with:

q1 <- entrez_search(db="pubmed", term=query_part1, web_history=TRUE)
q3 <- entrez_search(db="pubmed", term=query_part3, web_history=q1)

query_combine_1_3 <- sprintf("#%s AND #%s", q1$web_history$QueryKey, q3$web_history$QueryKey)
q1_3 <- entrez_search(db="pubmed", term=query_combine_1_3, web_history=q1)

The differences are:

  • q1: use_history has been replaced with web_history
  • q2: with web_history, it would automatically extract the web_history object from q1, and it would automatically add the WebEnv request variable.

This would also suggest that an as_web_history() generic function that would extract the web_history from any object containing a web_history object would be helpful to make this work more smoothly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant