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

PubMed citation error with PubmedBookArticle PMID:26962613 #298

Open
agitter opened this issue Aug 13, 2021 · 2 comments
Open

PubMed citation error with PubmedBookArticle PMID:26962613 #298

agitter opened this issue Aug 13, 2021 · 2 comments

Comments

@agitter
Copy link
Member

agitter commented Aug 13, 2021

Does Manubot support parsing PubmedBookArticle? I encountered the following error with manubot cite pubmed:26962613 and Manubot v0.5.1:

## ERROR
Error parsing the following PubMed metadata for PMID 26962613:
...
## WARNING
Generating csl_item for 'pubmed:26962613' failed due to a ValueError:
Expected article to be an XML element with tag PubmedArticle, received tag 'PubmedBookArticle'
[]
## CRITICAL
Failure: exiting with code 1 due to logged errors

The XML is https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=26962613&rettype=full

This line suggests PubmedBookArticle is supported

assert xml_article.tag in ["PubmedArticle", "PubmedBookArticle"]

but this one does not

if not article.tag == "PubmedArticle":

@dhimmel
Copy link
Member

dhimmel commented Aug 13, 2021

This came up in the past with pubmed:29227604 at #24 (comment).

See also this test:

def test_citekey_to_csl_item_pubmed_book(caplog):
"""
Extracting CSL metadata from books in PubMed is not supported.
Logic not implemented to parse XML returned by
https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=29227604&rettype=full
"""
csl_item = citekey_to_csl_item("pmid:29227604", log_level="ERROR")
assert csl_item is None
assert (
"Expected article to be an XML element with tag PubmedArticle, received tag 'PubmedBookArticle'"
in caplog.text
)

So we're aware that it's not supported and adding a PubmedBookArticle parser would be a bit of work. Maybe we could just fall back to the zotero translator here?

@agitter
Copy link
Member Author

agitter commented Aug 13, 2021

So we're aware that it's not supported and adding a PubmedBookArticle parser would be a bit of work.

I agree that adding a new parser isn't going to be high priority, and this is a rare use case. I was somewhat confused because line 143 allows PubmedBookArticle but then that tag isn't supported by a parser. The existing warning message is sufficiently clear though.

Maybe we could just fall back to the zotero translator here?

That seems like the right solution. In my case I switched to the PubMed URL, and Zotero worked well. The question is whether we want the user to change the identifier or try to automate it for them when this error occurs.

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

2 participants