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

the citations stored in litdb sometimes truncate the author list #6

Open
jkitchin opened this issue Dec 12, 2024 · 0 comments
Open

Comments

@jkitchin
Copy link
Owner

jkitchin commented Dec 12, 2024

This is a problem when I use these for candidates in emacs, since you can't search text that isn't there.

Right now the citation comes as

#+BEGIN_SRC jupyter-python
import requests

r = requests.get('https://api.citeas.org/product/http://api.citeas.org/product/https://doi.org/10.1021/[email protected]')

d = r.json()

d['citations'][0]['citation']
#+END_SRC

#+RESULTS:
: Abed, J., Heras-Domingo, J., Sanspeur, R. Y., Luo, M., Alnoush, W., Meira, D. M., … Sargent, E. H. (2024, June 3). Pourbaix Machine Learning Framework Identifies Acidic Water Oxidation Catalysts Exhibiting Suppressed Ruthenium Dissolution. <i>Journal of the American Chemical Society</i>. American Chemical Society (ACS). http://doi.org/10.1021/jacs.4c01353

The only solution I see is not using the citation from citeas.org. It looks like I could use the metadata instead to build up a citation. A lightly tested solution is

#+BEGIN_SRC jupyter-python
md = d['metadata']

cite_data = dict(authors = ', '.join(f'{author["given"]} {author["family"]}'
                    for author in  md['author']),
                 title = md.get('title', None),
                 journal = md.get("container-title", None),
                 volume = md.get('volume', None),
                 issue = md.get('issue', None),
                 page = md.get('page', None),
                 year = md.get('year', None),
                 url = md.get('URL', None))

citation = ''
if cite_data['title']:
    citation += '{title}, '
if cite_data['authors']:
    citation += '{authors}, '
if cite_data['journal']:
    citation += '{journal} '

if cite_data['volume'] and cite_data['issue']:
    citation += '{volume}({issue}) '
elif cite_data['volume']:
    citation += '{volume} '

if cite_data['page']:
    citation += '{page} '

if cite_data['year']:
    citation += '({year}).'

if cite_data['url']:
    citation += ' {url}'
    
citation.format(**cite_data)
#+END_SRC

#+RESULTS:
: Pourbaix Machine Learning Framework Identifies Acidic Water Oxidation Catalysts Exhibiting Suppressed Ruthenium Dissolution, Jehad Abed, Javier Heras-Domingo, Rohan Yuri Sanspeur, Mingchuan Luo, Wajdi Alnoush, Debora Motta Meira, Hsiaotsu Wang, Jian Wang, Jigang Zhou, Daojin Zhou, Khalid Fatih, John R. Kitchin, Drew Higgins, Zachary W. Ulissi, Edward H. Sargent, Journal of the American Chemical Society 146(23) 15740-15750 (2024). https://doi.org/10.1021/jacs.4c01353

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