From 8c9aa9842019e334c200e5630d0781108523015b Mon Sep 17 00:00:00 2001 From: "marcin p. joachimiak" <4625870+realmarcin@users.noreply.github.com> Date: Mon, 21 Sep 2026 23:46:23 -0700 Subject: [PATCH] Keep bibliography out of the shared-vocabulary edge weight MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `build_subsets.py` filtered DOI out of an edge with shared={t for t in shared if t.split(":")[0]!="DOI" or True} where the `or True` made the condition unconditionally true, so the set was rebuilt unchanged and no citation prefix was ever dropped (#62). `roots.CITATION` already states the principle the filter was reaching for: every Mech cites papers, so counting those alongside the ontologies "would say only that". `build_data.py` keeps them out of the heatmap's ordering and the cell indexes below skip them; the edge weight was the one place that still counted them, which is the single spot where the code contradicted its own written rule. The inconsistency was visible on the page. Three lines down, the examples attached to each edge already excluded DOI by hand, so a chord's weight was partly bibliography while the evidence offered for that weight deliberately was not. Both now read `not in CITATION`, so the two agree by construction and PMID is covered as well — it contributes nothing today, but by accident of the data rather than by design. Measured on the pre-change data before deciding, since this moves published numbers: citation prefixes are 379 of 11,350 total edge weight (3%), touching 9 of 36 edges, and no edge disappears. The largest single shift is CellStructureMech-ProteinTraitsMech, down 15%. No committed data changes here. `assets/fleet/` and `fleet_data.json` are snapshots of the last full pipeline run, so the new numbers appear when the pipeline is next rerun as a whole — a partial rerun would date the heatmap and the edges to different scans. That refresh is owed anyway for #84, #85 and #87. A test asserting no CITATION prefix reaches an edge needs build_subsets.py to be importable, which is #97. Co-Authored-By: Claude Opus 5 (1M context) --- scripts/fleet/build_subsets.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/fleet/build_subsets.py b/scripts/fleet/build_subsets.py index c671703..01e5daa 100644 --- a/scripts/fleet/build_subsets.py +++ b/scripts/fleet/build_subsets.py @@ -155,7 +155,13 @@ def scan(m, keep=None, cap_cell=300): summary={"edges":{},"cells":{}} for a,b in itertools.combinations(ORDER,2): shared=set(idx[a]["terms"])&set(idx[b]["terms"]) - shared={t for t in shared if t.split(":")[0]!="DOI" or True} + # An edge counts shared *concepts*, not shared bibliography. roots.CITATION + # says why: every Mech cites papers, so counting those "would say only + # that". build_data.py already keeps them out of the heatmap ordering and + # the cell indexes below already skip them; the edge weight was the one + # place that still counted them, because this line read + # `!="DOI" or True` and the `or True` made it a no-op (#62). + shared={t for t in shared if t.split(":")[0] not in CITATION} if not shared: continue rows=[] for t in shared: @@ -165,7 +171,7 @@ def scan(m, keep=None, cap_cell=300): byp=collections.Counter(t.split(":")[0] for t in shared) doc={"a":a,"b":b,"base":{a:MECHS[a]["base"],b:MECHS[b]["base"]},"n":len(shared),"by":dict(byp.most_common()),"terms":rows} fn=f"{a}--{b}.json"; json.dump(doc,open(f"{OUT}/edges/{fn}","w"),separators=(",",":"),ensure_ascii=False) - summary["edges"][f"{a}|{b}"]={"n":len(shared),"by":dict(byp.most_common()),"ex":[{"id":r["id"],"label":r["l"]} for r in rows if r["l"] and r["id"].split(":")[0]!="DOI"][:3]} + summary["edges"][f"{a}|{b}"]={"n":len(shared),"by":dict(byp.most_common()),"ex":[{"id":r["id"],"label":r["l"]} for r in rows if r["l"] and r["id"].split(":")[0] not in CITATION][:3]} print("edge",a,b,len(shared),os.path.getsize(f"{OUT}/edges/{fn}")//1024,"KB") for m in ORDER: for p,(n,refs) in idx[m]["cells"].items():