Skip to content

generate_artifinder

src.generators.artifinder.generate_artifinder

Generate ArtiFinder integration outputs.

Downloads the ArtiFinder-Data set, matches each discovered artifact link to an existing artifact-evaluation (AE) paper by title + author list, and:

  • back-patches assets/data/artifacts.json to add an artifinder_urls list to every AE artifact that ArtiFinder found a link for. These links carry no badges and never affect any score; the only place they may be reused is repository statistics (GitHub stars/forks), per project policy.
  • writes small Jekyll aggregates for the ArtiFinder discovery page: _data/artifinder_summary.yml, _data/artifinder_by_year.yml, _data/artifinder_by_conference.yml.

The raw discovered links live in the upstream ArtiFinder-Data repository; we do not republish them here.

Usage::

python -m src.generators.artifinder.generate_artifinder --data_dir ../reprodb.github.io/src

match_entries(entries: list[dict], artifacts: list[dict], authors_by_title: dict[str, set[str]]) -> list[dict]

Match ArtiFinder entries to AE artifacts by title + author overlap.

Mutates matched artifacts in place to append artifinder_urls and returns the per-entry match records (used only to build the aggregates).

First pass: same conference + year + identical normalised title. Second pass (fuzzy): for still-unmatched entries, the closest AE title in the same conference+year with a :data:FUZZY_MIN_RATIO similarity, to recover same-paper titles that differ by Unicode/LaTeX artifacts or minor wording. Both passes reject a match when author lists are known on both sides but share no author (guards against title collisions / different papers).

Source code in src/generators/artifinder/generate_artifinder.py
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
def match_entries(
    entries: list[dict],
    artifacts: list[dict],
    authors_by_title: dict[str, set[str]],
) -> list[dict]:
    """Match ArtiFinder entries to AE artifacts by title + author overlap.

    Mutates matched ``artifacts`` in place to append ``artifinder_urls`` and
    returns the per-entry match records (used only to build the aggregates).

    First pass: same conference + year + identical normalised title. Second
    pass (fuzzy): for still-unmatched entries, the closest AE title in the same
    conference+year with a :data:`FUZZY_MIN_RATIO` similarity, to recover
    same-paper titles that differ by Unicode/LaTeX artifacts or minor wording.
    Both passes reject a match when author lists are known on both sides but
    share no author (guards against title collisions / different papers).
    """
    # Index artifacts by (conference, year, normalized_title) and by (conf, year).
    artifact_index: dict[tuple[str, int, str], dict] = {}
    by_conf_year: dict[tuple[str, int], list[tuple[str, dict]]] = defaultdict(list)
    for art_row in artifacts:
        conf = str(art_row.get("conference", "")).upper()
        year = int(art_row.get("year", 0))
        ant = normalize_title(art_row.get("title", ""))
        artifact_index.setdefault((conf, year, ant), art_row)
        by_conf_year[(conf, year)].append((ant, art_row))

    def _authors_overlap_ok(entry_authors: set[str], ae_norm_title: str) -> bool:
        """False only when both sides list authors but none overlap."""
        art_authors = authors_by_title.get(ae_norm_title, set())
        if entry_authors and art_authors:
            return bool(entry_authors & art_authors)
        return True

    def _fuzzy_match(nt: str, conf: str, year: int, entry_authors: set[str]) -> dict | None:
        """Return the best fuzzy-matching AE artifact in the same conf/year, or None."""
        best_ratio, best_art, best_nt = 0.0, None, ""
        for ant, art_row in by_conf_year.get((conf, year), ()):
            if not ant:
                continue
            ratio = SequenceMatcher(None, nt, ant).ratio()
            if ratio > best_ratio:
                best_ratio, best_art, best_nt = ratio, art_row, ant
        if best_art is not None and best_ratio >= FUZZY_MIN_RATIO and _authors_overlap_ok(entry_authors, best_nt):
            return best_art
        return None

    records: list[dict] = []
    fuzzy_matched = 0

    for entry in entries:
        conf = str(entry["conference"]).upper()
        year = int(entry["year"])
        nt = normalize_title(entry["title"])
        url = entry["discovered_artifact"]
        entry_authors = _author_key_set(entry.get("authors", []))

        # First pass: exact normalised title.
        art = artifact_index.get((conf, year, nt))
        matched = False
        via_fuzzy = False
        if art is not None and _authors_overlap_ok(entry_authors, nt):
            matched = True
        else:
            art = None

        # Second pass: fuzzy title within the same conference + year.
        if art is None:
            art = _fuzzy_match(nt, conf, year, entry_authors)
            if art is not None:
                matched = True
                via_fuzzy = True

        records.append(
            {
                "conference": entry["conference"],
                "year": year,
                "artifact_url": url,
                "matched_ae": matched,
            }
        )

        if matched and art is not None:
            if via_fuzzy:
                fuzzy_matched += 1
            existing = set(art.get("artifact_urls", [])) | set(art.get("artifinder_urls", []))
            # Compare on a scheme-insensitive / trailing-slash-insensitive basis.
            norm_existing = {u.rstrip("/") for u in existing}
            if url.rstrip("/") not in norm_existing:
                art.setdefault("artifinder_urls", []).append(url)

    if fuzzy_matched:
        logger.info("  ArtiFinder: %d links matched to AE papers via fuzzy title fallback", fuzzy_matched)

    return records

generate_artifinder(data_dir: str, min_year: int | None = DEFAULT_MIN_YEAR, conf_regex: str | None = None, local_dir: str | None = None) -> dict

Run the ArtiFinder integration and write all output files.

Source code in src/generators/artifinder/generate_artifinder.py
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
def generate_artifinder(
    data_dir: str,
    min_year: int | None = DEFAULT_MIN_YEAR,
    conf_regex: str | None = None,
    local_dir: str | None = None,
) -> dict:
    """Run the ArtiFinder integration and write all output files."""
    root = Path(data_dir)
    assets_data = root / "assets" / "data"
    jekyll_data = root / "_data"
    build_dir = root / "_build"

    data = load_artifinder(conf_regex=conf_regex, min_year=min_year, local_dir=local_dir)
    if not data.entries:
        logger.warning("ArtiFinder: no entries loaded; writing empty outputs")

    artifacts = load_json(assets_data / "artifacts.json", default=[]) or []

    pa_path = resolve_data_path(root, "paper_authors_map.json")
    paper_authors = load_json(pa_path, default=[]) or [] if pa_path.exists() else []
    authors_by_title = _build_paper_authors_index(paper_authors)

    records = match_entries(data.entries, artifacts, authors_by_title)

    # Back-patch artifacts.json (only artifinder_urls were possibly added). This
    # is the single place ArtiFinder links are persisted for AE papers; the raw
    # links stay in the upstream ArtiFinder-Data repo. The repo_stats stage
    # reads the GitHub links directly from here.
    save_validated_json(assets_data / "artifacts.json", artifacts, Artifact)

    # Discovered papers that never went through AE become extra search rows so
    # they are findable in the site search (marked, no badges, no scores).
    search_entries = _build_search_entries(data.entries, records)
    save_json(build_dir / "artifinder_search_entries.json", search_entries)

    # Author-indexed non-AE discoveries so they can be listed (marked) on
    # author and institution profile pages without affecting any score.
    author_index = _build_author_index(data.entries, records)
    save_json(assets_data / "artifinder_authors.json", author_index)

    # Website statistics (Jekyll _data) for the ArtiFinder discovery page.
    summary, by_year, by_conf = _build_stats(data.counts, records, data.source_updated)
    # Distinct authors across all discovered-artifact entries (analogous to the
    # AE "total authors" figure shown on the methodology page).
    summary["author_count"] = len(
        {_af_author_key(a) for e in data.entries for a in e.get("authors", []) if _af_author_key(a)}
    )
    save_yaml(jekyll_data / "artifinder_summary.yml", summary)
    save_yaml(jekyll_data / "artifinder_by_year.yml", by_year)
    save_yaml(jekyll_data / "artifinder_by_conference.yml", by_conf)

    logger.info(
        "ArtiFinder: %d discovered links (%d matched to AE, %d non-AE search rows, %d GitHub), min_year=%s",
        summary["total_discovered"],
        summary["total_matched_ae"],
        len(search_entries),
        summary["github_count"],
        min_year,
    )
    return summary