Files
smartguide/service/scripts/multipliers
..

Multiplicator detection — offline pipeline

Detects multiplicators among an institution's researchers — bridgers (connect disconnected research communities), mentors (bring up junior/debutant co-authors), and amplifiers (patents, industry co-authorship, news visibility) — from OpenAlex plus the patent/project/news sources, and writes per-author scores + tags + evidence to a derived Elasticsearch index.

Follows the repo's offline pattern (scripts/patents/index_org_patents.py): all analysis and joining happen offline, the result lands in a separate, institution-parameterised ES index, and a thin read-only backend router is added only once the UI needs it.

New here? Read ROADMAP.md first — a ground-up explanation of the concept, every index field, the related work behind the metrics, and what's next.

Status

M0 — spike: done. M1 — metrics core: done (exit check PASS). M2 — pipeline + multiplicators_v1 index: done (idempotency verified). M3 — amplifier signal joins: wired and indexed (patents / news / CORDIS; results below) — remaining: the coach calibration session. M4 — read router: pending, once the UI needs it. All results per milestone are documented in the sections below.

Setup

cd service/scripts/multipliers
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

Credentials are read from service/src/main/inse/.env:

  • ELASTICSEARCH_URL / ELASTICSEARCH_API_KEY — NES cluster (OpenAlex).
  • ELASTICSEARCH_INSE_URL / ELASTICSEARCH_INSE_API_KEY — INSE cluster (patents, news).

Run the spike

# Extract + audit for University of Duisburg-Essen (writes cache/ + report json)
python spike_audit.py --institution-id I62318514

# Re-audit from the cache without re-hitting ES
python spike_audit.py --institution-id I62318514 --skip-extract

# Also test write/delete permissions on the INSE cluster (throwaway index)
python spike_audit.py --institution-id I62318514 --probe-writes

Outputs land in cache/:

  • authors_<ID>.jsonl.gz — the two-group author union.
  • works_<ID>.jsonl.gz — full-authorship works (external co-authors + institutions).
  • spike_report_<ID>.json — the audit report.

The report answers: reproduction (author/work counts), field coverage (author_position / is_corresponding / institution type), scale (authors-per-work histogram, pair counts at caps 20/50/100), career quality (suspicious-profile %, active_years distribution), signal reachability (org_patents match-type breakdown), and write permissions.

cache/ is disposable and should not be committed (it can be hundreds of MB and contains extracted person data).


M0 spike results (I62318514, run 2026-07-15)

The spike existed to answer six questions the whole design was betting on. Full raw numbers in cache/spike_report_I62318514.json; this section explains each stat, why it was measured, and which downstream metric it feeds.

1. Reproduction — is the extraction correct?

Stat Value Meaning
Author count 4,921 Exactly reproduces the audited seed extraction (llm_evaluations/basic_applied_experimental/ude_audit_report.json). Our port of the query is faithful.
— backend_compatible group 4,740 Authors with last_known_institutions == UDE and a recent UDE affiliation.
— empty_last_known_recent group 181 Authors with a recent UDE affiliation but no last_known_institutions at all. Without this second query group, 3.7% of the cohort would silently vanish — this is why the author set is a union of two queries, not one.
Work count 183,661 All works by those 4,921 authors, globally, unrestricted by institution or year. Matches the seed audit.

Contributes to: everything. This is the corpus. The "all works globally" property is load-bearing for the career metrics: it means active_years is exact for in-set authors (we see their complete history), while for external co-authors we only see works shared with UDE — which is why mentor metrics are restricted to UDE-internal pairs.

2. Field coverage — are the fields the metrics need actually populated?

The OpenAlex Pydantic models declare these fields, but that says nothing about whether the ES index actually populates them. Two sub-scores would have died silently.

Stat Value Feeds Verdict
Authorships total 3,805,507 — denominator
author_position populated 100% last_author_with_junior_first (mentor): the classic supervision signature — PI last, junior first. ✅ computable
is_corresponding populated 100% reserved for later refinement (corresponding-author weighting). ✅ available
institutions.type populated 99.91% cross_sector_share / industry_coauthor_share (bridger + amplifier): share of works with a co-author at type == "company". ✅ computable
Company-institution occurrences 67,131 same dense enough to rank on — this is the strongest ID-linked industry signal we have, stronger than any name-matched source.

Contributes to: confirms the metric set needs no fallbacks. Had institutions.type been empty, the amplifier would have collapsed onto 123 high-confidence patents (see §6).

3. Scale — where does the pair explosion land, and what cap do we need?

Co-author pair generation is quadratic per work: a work with n authors yields n·(n−1)/2 pairs. The distribution of authors-per-work decides whether the self-join is feasible locally and where to cap it.

Stat Value
Authors per work p50 / p90 / p99 / max 5 / 17 / 144 / 4,839
Works with > 100 authors 2,459 (1.3%)
Pair instances at cap 20 / 50 / 100 3.9M / 8.0M / 13.9M

Why max_authors_per_work matters (the cap): the max-4,839-author work alone would generate ~11.7M pairs — more than the entire rest of the corpus at cap 50 — and a hyperauthored consortium paper (CERN/medical mega-trials) carries no real collaboration signal: being 1 of 4,839 names says nothing about who actually works with whom, but it would create a giant artificial clique that inflates betweenness and strength for everyone on it, poisoning the bridger score. The cap drops works above the threshold from graph construction only — they still count for publication years / active_years.

Chosen: max_authors_per_work = 50. Rationale: p90 = 17, so a cap of 50 keeps ≥ 99% of works (cap sits well above p90, below p99 = 144) while excluding only true hyperauthorship; the resulting 8.0M pair instances collapse to ~1–2M distinct edges, comfortably in-memory for polars. It's a config value (extraction.max_authors_per_work), not code — tunable per institution.

Contributes to: graph construction (Stage C); confirms the "pure local compute, no DuckDB/warehouse" bet.

4. Career quality — can we bucket careers, and how bad is profile merging?

Background: analysis/career_stage/ established that first_publication_year is unreliable at UDE (merged OpenAlex profiles → debut years of 1893/1906 for active professors) and that active_years (distinct years with ≥ 1 publication) is robust. The pipeline therefore buckets by active_years and uses prefix-counted active_years_at(A, Y) instead of debut years for the mentor metrics.

Stat Value Meaning / use
Suspicious profiles 225 (4.6%) first_year < 1970 or career_span > 60 (same flag as persons/logic.py). These are likely merged identities. They are not dropped — their active_years is still fine — but their evidence is marked low_confidence. Especially important for the bridger score: a merged profile is one node standing in for two people and systematically fakes bridging.
active_years p50 / p90 / max / mean 4 / 25 / 60 / 8.9 p50 = 4 means half the cohort is career-stage "Early" (≤ 4). This is why percentile normalization happens within career buckets (Early/Emerging/Established/Senior via _classify_career_stage): institution-wide percentiles would just rank seniority, and no early-career person could ever surface as a multiplicator.

Contributes to: career bucketing (scoring), mentor junior/senior thresholds, confidence flags on evidence.

5. Permissions — can we ship the result anywhere?

Initial spike: PUT to create an index on the INSE cluster → 403 (key can read, not create). Resolved 2026-07-15: multiplicators_v1 was created by the cluster admin, and the standard INSE key can now write to it (verified: doc create + delete both succeed). The build step must therefore never try to create/re-create the index — only delete-by-institution + bulk-index into the existing one (same constraint as org_patents, whose key also rejects _delete_by_query; use the search + bulk-delete loop from patents/org/elastic_search_client.py).

Contributes to: M2 index/build design.

6. Signal reachability — which amplifier sources are real?

Stat Value Meaning
org_patents docs for UDE 436 The patent→OpenAlex-author link index exists and is populated.
— match_type: name 313 Name-only match. Evidence only, weight 0 — name matching is the weakest link type.
— match_type: both 65 Institution assignee and name match — highest confidence. Scores.
— match_type: institution 58 Institution-assignee match. Scores.

Contributes to: amplifier sub-score. Only 123 patents are high-confidence, so patents are a secondary amplifier signal; the primary is industry_coauthor_share (67k ID-linked company co-authorships, §2). News (aktuell_postproc, exact-string person match) enters at low weight; DFG (token containment) and Bund (no person link) are excluded entirely.

Spike exit criteria — all met (see below for M1)

  • ✅ Extraction reproduces the audited counts exactly.
  • ✅ Every planned metric is confirmed computable — no fallbacks needed.
  • ✅ max_authors_per_work = 50 chosen from measured data.
  • ✅ Write path to multiplicators_v1 verified end-to-end.
  • ✅ Amplifier signal priorities re-ordered based on measured density (industry co-authorship primary, patents secondary).

M1 results (metrics core, run 2026-07-15)

Modules: graph.py (co-author graph via polars self-join, decay weights, hyperauthorship cap), metrics.py (Brandes betweenness with inverted weights, Burt constraint on the full graph incl. externals, field entropy, industry co-author share, debut-year-free mentor metrics on active_years_at), scoring.py + multipliers.yaml (within-career-bucket percentiles → weighted sub-scores → tags). 26 unit tests (pytest), including exact agreement with networkx oracles for betweenness/constraint and the planted-1893-outlier regression guard for active_years_at.

Run with:

python build.py --institution-id I62318514          # scores + summary from the cache
python validate_sample.py --institution-id I62318514 # 60-person exit check

Full-corpus run (I62318514)

Stat Value
Runtime end-to-end 2.6 min (load 15s, graph 31s, metrics 112s) — exit criterion was < 15 min
Graph 639,544 nodes (4,921 focal + externals), 4,143,499 edges
Works used / capped 160,396 / 4,823 (max_authors_per_work = 50)
Tags at threshold 0.85 bridger 66, mentor 91, amplifier 609

The amplifier tag count is inflated for now: only industry_coauthor_share exists at M1 (patents/news/CORDIS join in M3), so weight redistribution makes it a single-metric sub-score. Ignore amplifier tags until M3.

M1 exit check — PASS

Against the 60 hand-labeled researchers in analysis/career_stage/career_stage_sample.csv (31 Professor / 29 Researcher), mentor scores must concentrate on professors:

known status n median mentor score
Professor 25 0.715
Researcher 18 0.493

Top of the list is face-valid: senior professors with 30–50 mentored juniors and strong last-author-with-junior-first signatures (Bacher, Sures, Hering, Gunzer, …). The two high-scoring "Researchers" are informative, not embarrassing: e.g. a core-facility scientist with 37 juniors but zero last-author works — the independent supervision signature correctly separates "publishes with many juniors" from "supervises them".

⚠ Cohort-coverage finding (must be decided in M2)

17 of the 60 sample people are missing from the 4,921-author cohort. Diagnosed causes:

  1. University-hospital clinicians are systematically excluded. Prominent UDE medicine professors (e.g. Witzke, Bingel) have last_known_institutions = Essen University Hospital (I4210119759), and the hospital is not in UDE's OpenAlex lineage — OpenAlex models it as a related institution, not a child. 2,437 active (2025+) authors sit behind this gap — roughly half a cohort. Fix: make the cohort definition accept a list of institution IDs (I62318514 + I4210119759 + …) per deployment, sourced from associated_institutions and confirmed by a human.
  2. Stale affiliation years exclude current staff. E.g. Saccà has last_known = UDE but no affiliations.years >= 2025 entry, so the recency filter drops her. Fix candidates: widen the window (>= 2023), or accept last_known = UDE alone with a works-recency check.

Both are extraction-time cohort decisions with precision/recall tradeoffs — they belong to the coaches/product owner, not to code defaults.


M1 validation in detail (what was checked, against what ground truth)

The ground truth

analysis/career_stage/career_stage_sample.csv — 60 UDE researchers with manually researched role labels (known_status: 31 Professor / 29 Researcher incl. doctoral), across five discipline groups (Biology, CS, Engineering, Medicine, Sociology), each with an OpenAlex author ID (so the join to our scores is exact — no name matching involved). The sample was originally built for the career-stage analysis; it does not label anyone as a "multiplicator" — no such ground truth exists yet (that is the M3 golden set the innovation coaches will provide).

What exactly was evaluated

One directional sanity check on the riskiest sub-score: supervision is part of the professor role, so if the mentor sub-score measures anything like real mentorship, professors must score systematically higher than researchers. Defined check: professors' median mentor sub-score > researchers'.

The check is stronger than it looks because scores are percentiles within career buckets: a Senior researcher is compared against Senior professors, not against PhD students, so a trivial "older people score higher" effect is largely normalized away — the gap has to come from mentor behaviour (juniors mentored, last-author-with-junior- first works), not raw seniority.

Results (UDE-only cohort, 2026-07-15; archived as cache/*_I62318514.udeonly.json)

43 of 60 matched (17 missing — see the cohort-coverage finding above). Medians:

sub-score Professor (n=25) Researcher (n=18) check
mentor 0.715 0.493 PASS
bridger 0.603 0.508 (informational)
amplifier 0.655 0.413 (single-metric until M3 — ignore)

Ranking detail, more convincing than the medians:

  • Top = senior professors with strong dual signals: Gerd Bacher (37 juniors, 16 last-author-junior-first works), Bernd Sures (52, 24), Daniel Hering (35, 25), Matthias Gunzer (54 juniors).
  • Bottom = early-career researchers with 0 juniors.
  • The two high-scoring "Researchers" are the system working, not failing: Birte Möhlendick (0.924, 12 juniors) — plausibly a group leader whose formal title lags her role; Farnusch Kaschani (0.714, 37 juniors but 0 last-author works) — the classic core-facility-scientist profile: on many students' papers without supervising them. The two mentor signals disagreeing on exactly this person is why last_author_with_junior_first exists as an independent cross-check.

What this does NOT show

It validates the direction of the mentor proxy, not that top-ranked people are good mentors or multiplicators: professor-vs-researcher is a coarse label, n=43 is small, bridger has no ground truth in this sample, and amplifier is a single-metric score until M3. The real validation is the coach golden set (M3). This check is kept as a regression: re-run validate_sample.py after every weight change or dump refresh.


Cohort fix + re-run (2026-07-15, config version 2)

The hospital gap above is fixed by a configurable cohort list: cohorts.<primary-ID>. institution_ids in multipliers.yaml. How the list was discovered — and how to build one for another university — is documented in ASSOCIATED_INSTITUTIONS.md. For UDE it holds 9 institutions — UDE, Essen University Hospital, the West German Heart Center, the Erwin L. Hahn Institute, and the five OpenAlex lineage children (RISP, DTNW, KWI, ZBT, IUTA) — with the deliberate exclusions (Kliniken Essen-Mitte, the independent An-Institute) documented inline for the coaches to revisit. Candidates were sourced from associated_institutions in openalex-institutions; the extractor now matches last_known_institutions / affiliations by institution ID terms over the whole list.

Before / after (UDE-only → 9-institution cohort)

UDE-only cohort note
Authors 4,921 6,583 +1,662, mostly hospital clinicians
Works 183,661 221,603
Graph 640k nodes / 4.14M edges 764k / 5.26M
Pipeline runtime 2.6 min 4.5 min still far under the 15-min criterion
Sample matched 43/60 45/60 Witzke + Bingel recovered
Mentor exit check 0.715 vs 0.493 PASS 0.699 vs 0.493 PASS stable
Tags (bridger/mentor/amplifier) 66/91/609 96/131/763 scales with cohort

Face validity of the fix: both recovered professors immediately tag as mentors with strong evidence — Witzke (Senior, 73 juniors mentored), Bingel (Senior, 34 juniors, 21 last-author-with-junior-first works).

The remaining 15 missing, fully diagnosed

  • 9 × correctly excluded — they left UDE (last_known now Halle, Würzburg, Greifswald, OU Netherlands, ISG, or none). The sample is older than the corpus; these are not gaps.
  • 6 × stale-affiliation cases — last_known IS in the cohort but their most recent cohort affiliation year is 2021–2024, so the affiliation_years_gte: 2025 recency filter drops them. At least one (Saccà, last seen 2024) is a current professor — publication lag alone can push someone out of a 1-year window. Recommendation for M2: set extraction.affiliation_years_gte: 2023 (already config) — captures normal publication lag while still excluding long-departed authors. Decide with the coaches; it trades a little precision for recall.

M2 — pipeline + ES index (done 2026-07-15)

New modules: extract.py (canonical cohort-aware extraction, config-driven), index.py (MultiplicatorsIndexClient for multiplicators_v1 on the INSE cluster), build.py (single entry point: extract → graph → metrics → scoring → index). spike_audit.py remains self-contained for auditing any institution.

python build.py --institution-id I62318514                 # full run (reuses cache)
python build.py --institution-id I62318514 --force-extract # refresh from ES
python build.py --institution-id I62318514 --no-index      # local artifacts only

Index contract (multiplicators_v1, INSE cluster)

  • Doc _id = <institution_short>_<author_short> (e.g. I62318514_A5087456839); one doc per author per institution.
  • Every doc: raw metrics, per-bucket percentiles, sub-scores, tags, career bucket, suspicious_profile, evidence (junior ids), config_hash, computed_at, cohort_institution_ids. Explicit mapping is PUT on every run (additive).
  • Idempotent re-runs: collect the institution's doc ids → bulk-delete → bulk-index → poll _count until the expected count is visible. Verified: delete 9,474 → index 9,474 → count 9,474.

Key-permission gotchas (learned the hard way, encoded in index.py)

The admin-created index + standard INSE key allows: read, _bulk index/delete, _mapping updates, _count. It does not allow: index create/delete, _delete_by_query (same as org_patents), and — new finding — _refresh (indices:admin/refresh → 403). A first client version silently relied on refresh and saw phantom docs during delete (stale visibility inflated the delete count) and a too-early post-index count. The client now never calls _refresh: it collects all doc ids BEFORE deleting, and verifies by polling _count (auto-refresh ≈ 1s) instead.

Run with affiliation_years_gte: 2023 (config v2 → v3)

2025 cutoff 2023 cutoff
Authors / works 6,583 / 221,603 9,475 / 267,467
Graph 764k nodes / 5.26M edges 865k / 5.82M
Full runtime (incl. extract + index) — ~14.5 min
Sample matched 45/60 51/60
Mentor exit check 0.699 vs 0.493 PASS 0.740 vs 0.494 PASS (wider gap)

The 9 still-missing sample people are exactly the 9 confirmed leavers (last_known now Halle, Würzburg, Greifswald, …) — correct exclusions, zero unexplained gaps. All six stale-affiliation cases were recovered (some via 2023+ affiliations with the hospital / institute cohort members rather than UDE itself).

Career-bucket distribution in the index: Early 5,361 / Emerging 1,591 / Established 777 / Senior 1,745. Tags: bridger 133, mentor 161, amplifier 1,107 (amplifier still single-metric until M3 — ignore).

Next (M3)

Wire the signal joins into the amplifier score (org_patents match_type institution/both, news with name normalization at low weight, CORDIS DOI-join), then calibrate the YAML weights with the innovation coaches against their golden set. M4 (read router in inse/) once the UI needs it.


M3 — amplifier signal joins (done 2026-07-15)

Before wiring, a live-index audit showed the amplifier was degenerate: its only input (industry_coauthor_share) was 0 for 61.5% of the cohort, and the "top amplifiers" were small-denominator ratio artifacts (share = 1.0 with 2 typed works). Two fixes:

  1. Shrinkage: scoring now uses industry_coauthor_share_shrunk = company/(typed+k) (k=5, config signals.industry_share_shrinkage_k); the raw share stays in the doc.
  2. Three independent signal joins (signals.py), weights in YAML (shrunk share 0.50 / patents 0.25 / CORDIS 0.15 / news 0.10):
signal join mechanism UDE yield (9,474 authors)
patent_count org_patents.matched_authors author IDs, match_type ∈ {institution, both}; name-only kept as patent_count_name_only evidence, never scored 55 authors (17 more name-only)
news_mentions aktuell_postproc LLM-extracted names, normalized-exact match (casefold + diacritic fold); a normalized name shared by >1 cohort authors credits NO ONE 1,369 authors; 839 ambiguous names skipped (precision over recall)
cordis_eu_projects DOI overlap with cordis_eu_*_publications → distinct projectIDs. Case-insensitive term matching — 21% of CORDIS DOIs contain uppercase and a plain terms query silently misses them 1,342 authors

Signal join runtime ≈ 9 min (the case-insensitive CORDIS batches dominate); total pipeline ≈ 20 min. Mentor/bridger untouched: validation unchanged (51/60, mentor check PASS 0.740 vs 0.494).

Effect on the amplifier tag

Tags went 1,107 → 10. With four independent inputs, a ≥0.85 weighted mean of within-bucket percentiles requires being near the top on most channels — the tag now means something. The new top-10 is face-valid (Wiltfang, Erbel, Kaiser, Schierning — patent-holding, industry-connected, media-visible seniors). Two open calibration questions for the coaches:

  • Threshold per tag? 0.85 yields 133 bridgers / 161 mentors / 10 amplifiers. If more amplifier candidates are wanted, either lower a per-tag threshold (currently one global tags.threshold) or re-weight.
  • Split-profile artifact: an Early-bucket author with 1 active year made top-10 amplifier — almost certainly a split OpenAlex profile of a senior professor (patents/news land on the fragment). Bucket-relative ranking amplifies fragments; the suspicious_profile flag does not catch splits (only merges). Known limitation — ORCID-based resolution is the deferred fix.

M3 remaining

The coach calibration session: golden set of 10–20 known multiplicators, tune the YAML (weights, per-tag thresholds), re-run validate_sample.py as regression.


Network visualization index (multiplicator_networks_v1, added 2026-07-16)

The scores index answers what did this person score; this companion index answers who are they connected to and how — everything a frontend needs to draw the ego-network figures (force layout, role colors, tooltips) without recomputing anything. Materialized by build.py (networks.py) while the full graph is in memory, because the neighbor-neighbor edges that make graph shape readable (dense mesh = one community; spokes with gaps = brokered structural holes) come from works that do NOT include the ego — no request-time query can reconstruct them.

One doc per focal author, _id = <institution>_<author> (same scheme as scores):

field content
nodes[] {id, name, role, inst, active_years, suspicious}; role ∈ ego / mentee / cohort / industry / external
edges[] {a, b, w, n_works, cross, first_year, last_year} — w = decayed tie strength, cross = mostly cross-institution
ego{} header duplicate (bucket, tags, sub_scores, max_sub_score) so a network endpoint renders standalone
totals total_coauthors, cohort_coauthors, mentee_count, shown, shown_mentees
provenance config_hash, computed_at, cohort_institution_ids

Selection: strongest network.max_nodes (42) co-authors by tie weight with up to network.max_forced_mentees (14) mentees force-included first — mentees' ties are decayed and team-size-divided, so a pure top-by-weight cut hides exactly the people the mentor score is about. Positions are NOT stored: the webapp's echarts graph series (force layout) lays out at render time; map role → color, active_years → symbol size, cross → dashed line.

nodes/edges are mapped "enabled": false (stored, never indexed) — the index stays small and fast for the queryable header fields (institution_id, author_id, ego.tags, computed_at, …). Skip building with --no-network.

Regenerating the HTML report

make_report.py renders a self-contained HTML report of four contrasting cases straight from the two live ES indices — no local cache required, so it works on any machine with cluster access after a build has run:

python make_report.py --institution-id I62318514
# -> reports/multiplier_networks.html   (open in any browser; light/dark toggle)

python make_report.py --institution-id I62318514 \
    --author-ids A5113304257,A5043495754,A5007801159,A5123934012   # explicit cast

The cast is pinned in report.featured_author_ids (config) so the report is reproducible across weight tunes and dump refreshes; --author-ids overrides it and --auto falls back to selecting the current top bridger / mentor / amplifier plus the highest-scoring person who carries no tag — the last one exposes where the thresholds bite (and, when that person's best sub-score is above 0.85, the tags.min_active_years guard that withholds tags from one-year profiles, which are usually split OpenAlex identities — the case suspicious_profile cannot catch, since that flag detects merges).

The page layout lives in report_template.html (tracked); reports/ and cache/ are gitignored, so a git clean -fdx or fresh checkout wipes generated reports and extracts — re-run the command above to rebuild the report, and build.py only if the indices themselves need refreshing.