Skip to content

Add a script to QC the update-synonyms-sync target#10260

Open
ptgolden wants to merge 3 commits into
masterfrom
synonym-sync-qc
Open

Add a script to QC the update-synonyms-sync target#10260
ptgolden wants to merge 3 commits into
masterfrom
synonym-sync-qc

Conversation

@ptgolden

Copy link
Copy Markdown
Member

This adds a script (synonym_sync_qc) that looks at mondo-edit.obo after update-synonyms-sync has been run (but before it has been committed). It runs two checks:

  1. Are all unstaged changes to mondo-edit.obo confined to lines about synonyms? If not, that means that there are extraneous changes that shouldn't be happening with the synonym sync workflow.

  2. Is the set of synonyms pre-sync the exact same set post-sync? And if so, what axioms (if any) have changed on those synonyms?

(1) uses git diff as the signal for analysis, (2) uses fastobo to actually parse mondo-edit.obo before and after sync. Because fastobo is fast, this runs an analysis on mondo-edit.obo in 6 seconds.

This script also writes a report formatted as markdown. The report details whether the checks passed, and then gives some details about how synonym axioms have changed.

The synonym-sync workflow has been updated to run this script. I also took out the make test invocation in there, since it will be run on the PR automatically anyway.

This adds a script (`synonym_sync_qc`) that looks at `mondo-edit.obo`
after `update-synonyms-sync` has been run (but before it has been
committed). It runs two checks:

1. Are all unstaged changes to `mondo-edit.obo` confined to lines about
   synonyms? If not, that means that there are extraneous changes that
   shouldn't be happening with the synonym sync workflow.

2. Is the set of synonyms pre-sync the exact same set post-sync? And if
   so, what axioms (if any) have changed on those synonyms?

(1) uses `git diff` as the signal for analysis, (2) uses `fastobo` to
actually parse `mondo-edit.obo` before and after sync. Because `fastobo`
is fast, this runs an analysis on `mondo-edit.obo` in 6 seconds.

---

This script also writes a report formatted as markdown. The report
details whether the checks passed, and then gives some details about how
synonym axioms have changed.

---

The synonym-sync workflow has been updated to run this script. I also
took out the `make test` invocation in there, since it will be run on
the PR automatically anyway.
@ptgolden ptgolden requested a review from matentzn as a code owner May 19, 2026 19:04
@ptgolden ptgolden self-assigned this May 19, 2026
@ptgolden

Copy link
Copy Markdown
Member Author

here's an example of the report generated from synonym sync run on current HEAD:

Synonym sync QC report

HEAD:mondo-edit.obo -> mondo-edit.obo

  • Pass 1 (diff confined to synonym: lines): PASS
  • Pass 2 ((term_id, literal) set invariant): PASS
  • Number of modifications on existing synonyms: 31

Pass 1: non-synonym line changes

No non-synonym lines changed.

Pass 2: synonym additions and deletions

No synonyms were added or removed.

Modifications by category

Category Count
scope_change 0
modifier_change 2
provenance_change 29

Provenance xref changes by source prefix

Prefix Added Dropped
DOID 9 4
OMIM 5 7
Orphanet 0 6
icd11.foundation 1 0

modifier_change (2)

MONDO:0015912 — MATINS

- type=None
+ type=ABBREVIATION

MONDO:0017790 — polyposis of gastric fundus without polyposis coli

- type=None
+ type=ABBREVIATION

provenance_change (29)

MONDO:0001106 — renal insufficiency

- xrefs=['NCIT:C4376']
+ xrefs=['DOID:1074', 'NCIT:C4376']

MONDO:0001896 — non-communicating hydrocephalus

- xrefs=['NCIT:C116347']
+ xrefs=['DOID:14159', 'NCIT:C116347']

MONDO:0009106 — SCM type 1

- xrefs=['Orphanet:1671']
+ xrefs=[]

MONDO:0009106 — diastematomyelia

- xrefs=['ICD10CM:Q06.2', 'NCIT:C98913', 'OMIM:222500', 'Orphanet:573278', 'icd11.foundation:2070601288']
+ xrefs=['ICD10CM:Q06.2', 'NCIT:C98913', 'OMIM:222500', 'icd11.foundation:2070601288']

MONDO:0009106 — split cord malformation

- xrefs=['GARD:0001851', 'Orphanet:573278']
+ xrefs=['GARD:0001851', 'Orphanet:573278', 'icd11.foundation:2070601288']

MONDO:0009106 — split cord malformation type 1

- xrefs=['Orphanet:1671']
+ xrefs=[]

MONDO:0009106 — split spinal cord malformation

- xrefs=['GARD:0001851', 'Orphanet:573278']
+ xrefs=['GARD:0001851']

MONDO:0009366 — NPH

- xrefs=[]
+ xrefs=['DOID:1572']

MONDO:0009835 — Immunosuppressive measles encephalitis

- xrefs=['DOID:8970', 'icd11.foundation:1098683540']
+ xrefs=['icd11.foundation:1098683540']

MONDO:0010598 — glycogen storage disease IXa1

- xrefs=['OMIM:306000']
+ xrefs=['DOID:0111042', 'OMIM:306000']

MONDO:0010598 — glycogen storage disease type IXa

- xrefs=['DOID:0111042', 'https://www.ncbi.nlm.nih.gov/books/NBK55061/']
+ xrefs=['https://www.ncbi.nlm.nih.gov/books/NBK55061/']

MONDO:0011323 — BAM syndrome

- xrefs=['OMIM:603457', 'https://orcid.org/0000-0001-9310-0163']
+ xrefs=['https://orcid.org/0000-0001-9310-0163']

MONDO:0011323 — Bosma syndrome

- xrefs=['OMIM:603457', 'https://orcid.org/0000-0001-9310-0163']
+ xrefs=['https://orcid.org/0000-0001-9310-0163']

MONDO:0011323 — Ruprecht Majewski syndrome

- xrefs=['OMIM:603457', 'https://orcid.org/0000-0001-9310-0163']
+ xrefs=['https://orcid.org/0000-0001-9310-0163']

MONDO:0011996 — leukimia, chronic myeloid

- xrefs=['OMIM:608232']
+ xrefs=[]

MONDO:0013767 — RALD

- xrefs=['DOID:0110117', 'OMIM:614470', 'Orphanet:268114']
+ xrefs=['DOID:0110117', 'Orphanet:268114']

MONDO:0013767 — RAS-associated autoimmune leukoproliferative disorder

- xrefs=['DOID:0110117', 'OMIM:614470']
+ xrefs=['DOID:0110117']

MONDO:0013947 — Young adult-onset dHMN

- xrefs=['DOID:0111214', 'Orphanet:314485']
+ xrefs=[]

MONDO:0013947 — young adult-onset distal hereditary motor neuropathy

- xrefs=['DOID:0111214', 'Orphanet:314485']
+ xrefs=[]

MONDO:0014392 — SLC13A5 Citrate Transporter Disorder

- xrefs=['NORD:1914']
+ xrefs=['DOID:0080453', 'NORD:1914']

MONDO:0015912 — Alport syndrome with macrothrombocytopenia

- xrefs=['OMIM:155100']
+ xrefs=[]

MONDO:0015912 — FTNS

- xrefs=[]
+ xrefs=['OMIM:155100']

MONDO:0015912 — MATINS

- xrefs=['https://orcid.org/0000-0001-9310-0163']
+ xrefs=['OMIM:155100', 'https://orcid.org/0000-0001-9310-0163']

MONDO:0015912 — MHA

- xrefs=[]
+ xrefs=['OMIM:155100']

MONDO:0015912 — SBS

- xrefs=[]
+ xrefs=['OMIM:155100']

MONDO:0019719 — congenital anomalies of kidney and urinary tract

- xrefs=['OMIMPS:610805', 'Orphanet:93545']
+ xrefs=['DOID:0080205', 'OMIMPS:610805', 'Orphanet:93545']

MONDO:0032578 — CDCBM9

- xrefs=[]
+ xrefs=['DOID:0061138', 'OMIM:618174']

MONDO:0044640 — AR-CMT2T

- xrefs=['Orphanet:495274']
+ xrefs=['DOID:0110160', 'Orphanet:495274']

MONDO:0044640 — autosomal recessive axonal Charcot-Marie-Tooth disease type 2T

- xrefs=['Orphanet:495274']
+ xrefs=['DOID:0110160', 'Orphanet:495274']

Put rdfs:label in the header, and the text of the synonym beneath,
showing what type of synonym it is in the synced version.
@ptgolden

Copy link
Copy Markdown
Member Author

I changed the report a little bit, to make it clear what the label is and what the synonym is:


Synonym sync QC report

HEAD:mondo-edit.obo -> mondo-edit.obo

  • Pass 1 (diff confined to synonym: lines): PASS
  • Pass 2 ((term_id, literal) set invariant): PASS
  • Number of modifications on existing synonyms: 31

Pass 1: non-synonym line changes

No non-synonym lines changed.

Pass 2: synonym additions and deletions

No synonyms were added or removed.

Modifications by category

Category Count
scope_change 0
modifier_change 2
provenance_change 29

Provenance xref changes by source prefix

Prefix Added Dropped
DOID 9 4
OMIM 5 7
Orphanet 0 6
icd11.foundation 1 0

modifier_change (2)

MONDO:0015912 macrothrombocytopenia and granulocyte inclusions with or without nephritis or sensorineural hearing loss

  • EXACT ABBREVIATION synonym: "MATINS"
- type=None
+ type=ABBREVIATION

MONDO:0017790 gastric adenocarcinoma and proximal polyposis of the stomach

  • EXACT ABBREVIATION synonym: "polyposis of gastric fundus without polyposis coli"
- type=None
+ type=ABBREVIATION

provenance_change (29)

MONDO:0001106 kidney failure

  • EXACT synonym: "renal insufficiency"
- xrefs=['NCIT:C4376']
+ xrefs=['DOID:1074', 'NCIT:C4376']

MONDO:0001896 obstructive hydrocephalus

  • EXACT synonym: "non-communicating hydrocephalus"
- xrefs=['NCIT:C116347']
+ xrefs=['DOID:14159', 'NCIT:C116347']

MONDO:0009106 diastematomyelia

  • NARROW ABBREVIATION synonym: "SCM type 1"
- xrefs=['Orphanet:1671']
+ xrefs=[]

MONDO:0009106 diastematomyelia

  • EXACT synonym: "diastematomyelia"
- xrefs=['ICD10CM:Q06.2', 'NCIT:C98913', 'OMIM:222500', 'Orphanet:573278', 'icd11.foundation:2070601288']
+ xrefs=['ICD10CM:Q06.2', 'NCIT:C98913', 'OMIM:222500', 'icd11.foundation:2070601288']

MONDO:0009106 diastematomyelia

  • EXACT synonym: "split cord malformation"
- xrefs=['GARD:0001851', 'Orphanet:573278']
+ xrefs=['GARD:0001851', 'Orphanet:573278', 'icd11.foundation:2070601288']

MONDO:0009106 diastematomyelia

  • NARROW synonym: "split cord malformation type 1"
- xrefs=['Orphanet:1671']
+ xrefs=[]

MONDO:0009106 diastematomyelia

  • EXACT synonym: "split spinal cord malformation"
- xrefs=['GARD:0001851', 'Orphanet:573278']
+ xrefs=['GARD:0001851']

MONDO:0009366 normal pressure hydrocephalus

  • EXACT ABBREVIATION synonym: "NPH"
- xrefs=[]
+ xrefs=['DOID:1572']

MONDO:0009835 subacute sclerosing panencephalitis

  • EXACT synonym: "Immunosuppressive measles encephalitis"
- xrefs=['DOID:8970', 'icd11.foundation:1098683540']
+ xrefs=['icd11.foundation:1098683540']

MONDO:0010598 glycogen storage disease IXa1

  • EXACT synonym: "glycogen storage disease IXa1"
- xrefs=['OMIM:306000']
+ xrefs=['DOID:0111042', 'OMIM:306000']

MONDO:0010598 glycogen storage disease IXa1

  • EXACT synonym: "glycogen storage disease type IXa"
- xrefs=['DOID:0111042', 'https://www.ncbi.nlm.nih.gov/books/NBK55061/']
+ xrefs=['https://www.ncbi.nlm.nih.gov/books/NBK55061/']

MONDO:0011323 arhinia, choanal atresia, and microphthalmia

  • EXACT synonym: "BAM syndrome"
- xrefs=['OMIM:603457', 'https://orcid.org/0000-0001-9310-0163']
+ xrefs=['https://orcid.org/0000-0001-9310-0163']

MONDO:0011323 arhinia, choanal atresia, and microphthalmia

  • EXACT synonym: "Bosma syndrome"
- xrefs=['OMIM:603457', 'https://orcid.org/0000-0001-9310-0163']
+ xrefs=['https://orcid.org/0000-0001-9310-0163']

MONDO:0011323 arhinia, choanal atresia, and microphthalmia

  • EXACT synonym: "Ruprecht Majewski syndrome"
- xrefs=['OMIM:603457', 'https://orcid.org/0000-0001-9310-0163']
+ xrefs=['https://orcid.org/0000-0001-9310-0163']

MONDO:0011996 chronic myeloid leukemia

  • EXACT synonym: "leukimia, chronic myeloid"
- xrefs=['OMIM:608232']
+ xrefs=[]

MONDO:0013767 autoimmune lymphoproliferative syndrome type 4

  • EXACT ABBREVIATION synonym: "RALD"
- xrefs=['DOID:0110117', 'OMIM:614470', 'Orphanet:268114']
+ xrefs=['DOID:0110117', 'Orphanet:268114']

MONDO:0013767 autoimmune lymphoproliferative syndrome type 4

  • EXACT synonym: "RAS-associated autoimmune leukoproliferative disorder"
- xrefs=['DOID:0110117', 'OMIM:614470']
+ xrefs=['DOID:0110117']

MONDO:0013947 neuronopathy, distal hereditary motor, autosomal recessive 5

  • BROAD synonym: "Young adult-onset dHMN"
- xrefs=['DOID:0111214', 'Orphanet:314485']
+ xrefs=[]

MONDO:0013947 neuronopathy, distal hereditary motor, autosomal recessive 5

  • BROAD synonym: "young adult-onset distal hereditary motor neuropathy"
- xrefs=['DOID:0111214', 'Orphanet:314485']
+ xrefs=[]

MONDO:0014392 developmental and epileptic encephalopathy, 25

  • EXACT synonym: "SLC13A5 Citrate Transporter Disorder"
- xrefs=['NORD:1914']
+ xrefs=['DOID:0080453', 'NORD:1914']

MONDO:0015912 macrothrombocytopenia and granulocyte inclusions with or without nephritis or sensorineural hearing loss

  • EXACT synonym: "Alport syndrome with macrothrombocytopenia"
- xrefs=['OMIM:155100']
+ xrefs=[]

MONDO:0015912 macrothrombocytopenia and granulocyte inclusions with or without nephritis or sensorineural hearing loss

  • EXACT ABBREVIATION synonym: "FTNS"
- xrefs=[]
+ xrefs=['OMIM:155100']

MONDO:0015912 macrothrombocytopenia and granulocyte inclusions with or without nephritis or sensorineural hearing loss

  • EXACT ABBREVIATION synonym: "MATINS"
- xrefs=['https://orcid.org/0000-0001-9310-0163']
+ xrefs=['OMIM:155100', 'https://orcid.org/0000-0001-9310-0163']

MONDO:0015912 macrothrombocytopenia and granulocyte inclusions with or without nephritis or sensorineural hearing loss

  • EXACT ABBREVIATION synonym: "MHA"
- xrefs=[]
+ xrefs=['OMIM:155100']

MONDO:0015912 macrothrombocytopenia and granulocyte inclusions with or without nephritis or sensorineural hearing loss

  • EXACT ABBREVIATION synonym: "SBS"
- xrefs=[]
+ xrefs=['OMIM:155100']

MONDO:0019719 congenital anomaly of kidney and urinary tract

  • EXACT synonym: "congenital anomalies of kidney and urinary tract"
- xrefs=['OMIMPS:610805', 'Orphanet:93545']
+ xrefs=['DOID:0080205', 'OMIMPS:610805', 'Orphanet:93545']

MONDO:0032578 cortical dysplasia, complex, with other brain malformations 9

  • EXACT ABBREVIATION synonym: "CDCBM9"
- xrefs=[]
+ xrefs=['DOID:0061138', 'OMIM:618174']

MONDO:0044640 Charcot-Marie-Tooth disease type 2T

  • EXACT ABBREVIATION synonym: "AR-CMT2T"
- xrefs=['Orphanet:495274']
+ xrefs=['DOID:0110160', 'Orphanet:495274']

MONDO:0044640 Charcot-Marie-Tooth disease type 2T

  • EXACT synonym: "autosomal recessive axonal Charcot-Marie-Tooth disease type 2T"
- xrefs=['Orphanet:495274']
+ xrefs=['DOID:0110160', 'Orphanet:495274']

@matentzn matentzn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Looks amazing. Can we wrap the detailed lists in <details>...</details> and add some way to crop the list at say 30 entries per category in case the PR has MAAAANY changes (that would make the github PR field blow up)?

And then I am just happy to go ahead and try!

@matentzn matentzn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the <details> thing i mentioned earlier

make GITHUB_ACTION=true IMP=false PAT=false update-synonyms-sync -B

- name: QC to ensure that nothing other than provenance has changed
run: cd src/ontology; make GITHUB_ACTION=true IMP=false PAT=false test -B

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure make test REALLY runs as you say - I dont think so without additional prodding (action triggering action)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here's a PR from a previous run: #10194
image

That QC is run from a PR event.

The QC in the sync workflow runs before the PR is created, on the exact same SHA, but it doesn't count as the required QC check. That makes it totally superfluous.

@ptgolden

Copy link
Copy Markdown
Member Author

This is great! Looks amazing. Can we wrap the detailed lists in <details>...</details> and add some way to crop the list at say 30 entries per category in case the PR has MAAAANY changes (that would make the github PR field blow up)?

Yep, good idea.

Should there possibly be some diagnostic about synonyms that have lost all provenance?

@matentzn

Copy link
Copy Markdown
Member

Should there possibly be some diagnostic about synonyms that have lost all provenance?

For now just a number; maybe broken by "prefix that used to support it". But we have not yet decided how exactly SOP these cases.

1. Allow calling the script on a specific ref, to get a summary of
   changes for commits in the past (not just unstaged changes)

2. Add an option to export a short summary, appropriate for a pull
   request body.

3. Add that summary as the PR body in the synonyms.yaml workflow, and
   attach the full report as an artifact that is hyperlinked. (To
   prevent a super long commit message).
@ptgolden

Copy link
Copy Markdown
Member Author

Make sure make test REALLY runs as you say - I dont think so without additional prodding (action triggering action)

You were completely right about this. And it led me to an interesting conclusion.

We have been talking about the limitations of using the built-in $GITHUB_TOKEN vs using a personal-access token (PAT) or a GitHub Actions token. What I'm realizing is that I strongly suspect that you have already uploaded a PAT to this repository, and it was being used by this workflow along with a few others. You can see it here:

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
branch-suffix: short-commit-hash
labels: automated
body: "Update the confirmed synonyms axiom annotation."
title: "Monthly confirmed synonyms evidence update"
base: ${{ github.head_ref }}
branch: "confirmed_synonyms_evidence"
token: ${{ secrets.GH_TOKEN }}

{{ secrets.GH_TOKEN }} is pointing to your personal PAT. What this means is that a PR created from this workflow does re-trigger workflows.

In my view, it would be good to stop relying on this, and remove instances of your PAT, if possible. I have changes coming into #10244 which will do just that. I'll wait on this one until we finish that.

@matentzn

Copy link
Copy Markdown
Member

In my view, it would be good to stop relying on this, and remove instances of your PAT, if possible. I have changes coming into #10244 which will do just that. I'll wait on this one until we finish that.

Please micromanage my reviews on slack on this - happy to follow your nose on this one! Whats the next step then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants