ontometer_corpus.paper.dedup_audit¶
Deduplication audit: how far the choice of one copy per ontology agrees with evidence the pipeline does not use.
Part of the resource paper's analysis. Deduplication decides that two
registry copies are one ontology from their IRIs and declared terms
(ontometer_corpus.pipeline.dedup, Pass D). The registries also name their
copies, by acronym, prefix or title, and deduplication never reads those
names, so they serve as an independent check:
- Merges. Passes C and D are replayed on a copy of
corpus.dbto recover which copy each folded copy was folded into. A merge whose two copies carry the same registry acronym, or titles sharing at least half their words, is confirmed by the names; every other merge needs a verdict from the review file. - Candidate misses. Pairs of ontologies that deduplication keeps apart but that share a registry acronym, a title, or an ontology IRI (a split IRI) are candidates for a missed merge, each needing a verdict.
Both lists carry what a reviewer needs: the IRIs, sizes, the share of the smaller copy's terms found in the larger (containment), their Jaccard overlap, and whether any releases of the two have identical term sets.
The review file (dedup_review.csv: kind,a,b,verdict,note) holds the
verdicts: kind is merge or candidate, a/b the two
source_ids, verdict one of same (one ontology), part (a
module, extract or variant of the other) or distinct. A name-confirmed
merge needs no row; a row overrides it. Pairs without a verdict are
reported as unreviewed, never guessed.
A second, independent review checks the first. --blind-sheet FILE writes
every pair the review file judges, in a seeded random order, with the evidence
but without the verdicts; a second reviewer fills in verdict and passes the
sheet back with --second FILE. Agreement and Cohen's kappa are computed over
the pairs both reviews judge, against --first FILE when given: the first
review as it stood before disagreements were resolved into the review file.
Precisions carry Wilson 95% intervals.
<corpus>/corpus.db, the structural sidecars in the object store,
the review file (default <corpus>/dedup_review.csv), and with
--second a second reviewer's sheet.
Usage
ontometer-corpus paper dedup-audit --corpus DIR --store DIR --out DIR [--stats FILE]
Attributes¶
VERDICTS = ('same', 'part', 'distinct')
module-attribute
¶
BLIND_SEED = 0
module-attribute
¶
BLIND_COLUMNS = ('kind', 'a', 'b', 'a_names', 'b_names', 'a_iri', 'b_iri', 'a_terms', 'b_terms', 'containment', 'jaccard', 'identical_release', 'same_registry')
module-attribute
¶
MAX_GROUP = 6
module-attribute
¶
TITLE_AGREE = 0.5
module-attribute
¶
Classes¶
Evidence
¶
Term overlap and release history of a pair of rows.
Source code in ontometer_corpus/paper/dedup_audit.py
Attributes¶
rows = rows.set_index('id', drop=False)
instance-attribute
¶
family_hashes = defaultdict(set)
instance-attribute
¶
Methods:¶
__init__(rows, paths)
¶
Source code in ontometer_corpus/paper/dedup_audit.py
terms(row_id)
¶
Source code in ontometer_corpus/paper/dedup_audit.py
pair(a_id, b_id)
¶
Source code in ontometer_corpus/paper/dedup_audit.py
Functions:¶
registry_names(source_id, raw_metadata)
¶
(acronym, title) a registry gives a copy; empty where it gives none.
OntoPortal: the ontology's acronym and name. OBO: its id and title. LOV:
its prefix (LOV's name is a version label). OKG: its title, and the
acronym in a BioPortal or OBO homepage. Ontohub: the file name.
Source code in ontometer_corpus/paper/dedup_audit.py
acronym_key(acronym)
¶
title_tokens(title)
¶
names_verdict(a, b)
¶
agree, disagree or unknown on the registry names alone.
Source code in ontometer_corpus/paper/dedup_audit.py
replay(paths)
¶
Replay Passes C-E on a copy of corpus.db.
Returns the parsed canonical rows, each folded row id mapped to the row kept for it, and the row ids that stay latest.
Source code in ontometer_corpus/paper/dedup_audit.py
candidate_pairs(latest)
¶
Pairs of distinct ontologies sharing an acronym, a title or an IRI key; and the number of name groups too large to be identity.
Source code in ontometer_corpus/paper/dedup_audit.py
load_review(path)
¶
Source code in ontometer_corpus/paper/dedup_audit.py
attach(df, kind, review)
¶
Source code in ontometer_corpus/paper/dedup_audit.py
excess_nodes(pairs)
¶
Ontologies counted more than once: pairs judged same grouped into
connected components, each counting its size less one.
Source code in ontometer_corpus/paper/dedup_audit.py
wilson(successes, n, z=1.96)
¶
Wilson score interval of a proportion (95% by default).
Source code in ontometer_corpus/paper/dedup_audit.py
cohen_kappa(first, second)
¶
Cohen's kappa of two reviews of the same pairs: agreement beyond chance.
Source code in ontometer_corpus/paper/dedup_audit.py
agreement(review, second)
¶
Agreement of two reviews over the pairs both judge.
Source code in ontometer_corpus/paper/dedup_audit.py
disagreements(first, second_path)
¶
The pairs the two reviews judge differently, with the evidence and both verdicts.
final is left empty for the resolved verdict, which belongs in the review file.
Source code in ontometer_corpus/paper/dedup_audit.py
blind_sheet(merges, candidates, review)
¶
Every pair the review judges, with its evidence and empty verdicts, in a seeded order.
Source code in ontometer_corpus/paper/dedup_audit.py
summarise(merges, candidates, n_ontologies)
¶
Source code in ontometer_corpus/paper/dedup_audit.py
stats_macros(s)
¶
Source code in ontometer_corpus/paper/dedup_audit.py
main(out, review_path, stats_path, blind_path, second_path, first_path, paths)
¶
Compare deduplication's merges and splits with the registries' names.
Source code in ontometer_corpus/paper/dedup_audit.py
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 | |