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

[Programming question]: Citations of DOIs #141

Open
haesleinhuepf opened this issue Dec 4, 2024 · 2 comments · May be fixed by #142
Open

[Programming question]: Citations of DOIs #141

haesleinhuepf opened this issue Dec 4, 2024 · 2 comments · May be fixed by #142

Comments

@haesleinhuepf
Copy link
Owner

Assume I have a list of DOIs given as a python list of strings. Is there a way to automatically determine if these DOIs were cited anywhere?

git-bob think about this

Copy link
Contributor

github-actions bot commented Dec 4, 2024

This message was generated by git-bob (version: 0.15.0, model: claude-3-5-sonnet-20241022, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully.

Hi!

Yes, it's possible to search for DOI citations using various scholarly APIs. Here's an example using scholarly from Google Scholar and crossref-commons:

import pandas as pd
from scholarly import scholarly
from crossref.restful import Works

def check_doi_citations(doi_list):
    works = Works()
    results = []
    
    for doi in doi_list:
        # Get citation count from Crossref
        try:
            work = works.doi(doi)
            crossref_citations = work['is-referenced-by-count']
        except:
            crossref_citations = None
            
        # Get citation count from Google Scholar
        try:
            query = scholarly.search_pubs(doi)
            pub = next(query)
            scholar_citations = pub.citedby
        except:
            scholar_citations = None
            
        results.append({
            'DOI': doi,
            'Crossref_Citations': crossref_citations,
            'Scholar_Citations': scholar_citations
        })
    
    return pd.DataFrame(results)

# Example usage
dois = ['10.1038/s41592-019-0686-2', '10.1038/s41592-021-01249-6']
citations_df = check_doi_citations(dois)
print(citations_df)

Note: You'll need to install the required packages:

pip install scholarly pandas crossrefapi

This will give you citation counts from both Crossref and Google Scholar. Keep in mind that these APIs might have rate limits and the results might not be 100% accurate.

@haesleinhuepf
Copy link
Owner Author

Very cool! git-bob implement this and print out all citations of these DOIs:
"10.5281/zenodo.5601995", "10.5281/zenodo.10432619", "10.5281/zenodo.7827755"

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