Skip to content

generate_artifact_citations

src.generators.citations.generate_artifact_citations

Generate artifact DOI citation counts via OpenAlex and Semantic Scholar and write per-artifact metadata.

Outputs

assets/data/artifact_citations.json assets/data/artifact_citations_summary.json

Usage

python generate_artifact_citations.py --data_dir ../reprodb.github.io/src

fetch_zenodo_doi(record_id: str, cache: dict) -> str

Get DOI for a Zenodo record.

Always returns the Zenodo DOI (10.5281/zenodo.{record_id}) to ensure we get artifact citations, not paper citations from DOIs that authors may have linked.

Source code in src/generators/citations/generate_artifact_citations.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def fetch_zenodo_doi(record_id: str, cache: dict) -> str:
    """Get DOI for a Zenodo record.

    Always returns the Zenodo DOI (10.5281/zenodo.{record_id}) to ensure we get
    artifact citations, not paper citations from DOIs that authors may have linked.
    """
    if record_id in cache:
        return cache[record_id]

    doi = f"10.5281/zenodo.{record_id}".lower()

    url = f"https://zenodo.org/api/records/{record_id}"
    try:
        fetch_json_urllib(url, timeout=30)
        cache[record_id] = doi
        return doi
    except Exception:
        cache[record_id] = ""
        return ""