Fix PALLADIUM CHEBI enum: CHEBI:33373 (promethium) → CHEBI:33363 (palladium) - #206
Merged
Conversation
MetalElementEnum.PALLADIUM was grounded to CHEBI:33373, which is actually
"promethium atom" — one of a run of sequential CHEBI ids shared with the
lanthanides, a copy-paste/off-by-one grounding error. The correct term is
CHEBI:33363 ("palladium"), confirmed via OAK.
- schema/communitymech.yaml: PALLADIUM meaning -> CHEBI:33363
- datamodel/communitymech.py: regenerated (just gen-python)
- metal_extraction.py: fix parallel METAL_CHEBI_MAP key
Community YAMLs already cited CHEBI:33363 in their term.{id,label} pairs, so
no data records needed changing. validate-all clean; 197 tests pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
realmarcin
added a commit
that referenced
this pull request
Jul 19, 2026
…tion) Auditing MetalElementEnum + RareEarthElementEnum after the PALLADIUM fix (#206) found 13 more wrong `meaning:` groundings — the ids had drifted off-by-one within the CHEBI:333xx lanthanide block, plus a couple of digit transpositions (e.g. INDIUM CHEBI:49464 = aluminium trifluoride; YTTRIUM CHEBI:49976 = zinc dichloride; SAMARIUM<->TERBIUM and THULIUM<->DYSPROSIUM swaps). Same class of copy/paste error as PALLADIUM. Ground every rare-earth element to its (3+) cation, matching each enum `description:` "X(3+) cation" (this also normalises the previously atom-grounded Nd/Gd/Lu/Sc to their cation ids). Dy/Er/Tm have no (3+) term in ChEBI, so they stay atom-grounded with descriptions annotated to say so. - schema/communitymech.yaml: 13 REE + INDIUM meanings repointed - datamodel/communitymech.py: regenerated (just gen-python) - metal_extraction.py: REE_CHEBI_MAP + METAL_CHEBI_MAP (INDIUM) mirror fixed - NEXT_TASKS.md: log the finding; item 1 (this fix) done, item 2 (a guard test validating enum meanings against canonical labels) left deferred Shipped records ground REEs via their own term.{id,label} pairs and were already correct, so the KGX export was unaffected; the bug lived in the schema enum + the mirror map. Re-audit: 0 mismatches. validate-all clean; 197 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
realmarcin
added a commit
that referenced
this pull request
Jul 19, 2026
…tion) (#207) Auditing MetalElementEnum + RareEarthElementEnum after the PALLADIUM fix (#206) found 13 more wrong `meaning:` groundings — the ids had drifted off-by-one within the CHEBI:333xx lanthanide block, plus a couple of digit transpositions (e.g. INDIUM CHEBI:49464 = aluminium trifluoride; YTTRIUM CHEBI:49976 = zinc dichloride; SAMARIUM<->TERBIUM and THULIUM<->DYSPROSIUM swaps). Same class of copy/paste error as PALLADIUM. Ground every rare-earth element to its (3+) cation, matching each enum `description:` "X(3+) cation" (this also normalises the previously atom-grounded Nd/Gd/Lu/Sc to their cation ids). Dy/Er/Tm have no (3+) term in ChEBI, so they stay atom-grounded with descriptions annotated to say so. - schema/communitymech.yaml: 13 REE + INDIUM meanings repointed - datamodel/communitymech.py: regenerated (just gen-python) - metal_extraction.py: REE_CHEBI_MAP + METAL_CHEBI_MAP (INDIUM) mirror fixed - NEXT_TASKS.md: log the finding; item 1 (this fix) done, item 2 (a guard test validating enum meanings against canonical labels) left deferred Shipped records ground REEs via their own term.{id,label} pairs and were already correct, so the KGX export was unaffected; the bug lived in the schema enum + the mirror map. Re-audit: 0 mismatches. validate-all clean; 197 tests pass. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
realmarcin
added a commit
that referenced
this pull request
Jul 19, 2026
Enum `meaning:` groundings aren't covered by validate-products (which only checks
record-level term.{id,label} pairs), which is why PALLADIUM→promethium (#206) and
13 REE/INDIUM mis-groundings (#207) drifted undetected.
Add tests/test_element_enum_groundings.py, which runs in the validate-strict
pytest step (already a blocking CI gate) with no network:
- freezes the verified meaning: ids for MetalElementEnum + RareEarthElementEnum
so a bad hand-edit fails;
- asserts no two element PVs share a CHEBI id (catches the swap/dup pattern);
- resolves each id against its canonical ChEBI label (element name must appear),
but only when the ChEBI sqlite is already cached locally, so it never forces a
multi-GB download in CI.
Verified the label check flags all three historical bugs (PALLADIUM CHEBI:33373
promethium, INDIUM CHEBI:49464 aluminium trifluoride, YTTRIUM CHEBI:49976 zinc
dichloride). A KB-wide guard over every enum via linkml-term-validator remains
deferred (same no-exceptions blocker as validate-terms-all) — noted in NEXT_TASKS.
201 tests pass (was 197); lint clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
realmarcin
added a commit
that referenced
this pull request
Jul 19, 2026
… (#208) Enum `meaning:` groundings aren't covered by validate-products (which only checks record-level term.{id,label} pairs), which is why PALLADIUM→promethium (#206) and 13 REE/INDIUM mis-groundings (#207) drifted undetected. Add tests/test_element_enum_groundings.py, which runs in the validate-strict pytest step (already a blocking CI gate) with no network: - freezes the verified meaning: ids for MetalElementEnum + RareEarthElementEnum so a bad hand-edit fails; - asserts no two element PVs share a CHEBI id (catches the swap/dup pattern); - resolves each id against its canonical ChEBI label (element name must appear), but only when the ChEBI sqlite is already cached locally, so it never forces a multi-GB download in CI. Verified the label check flags all three historical bugs (PALLADIUM CHEBI:33373 promethium, INDIUM CHEBI:49464 aluminium trifluoride, YTTRIUM CHEBI:49976 zinc dichloride). A KB-wide guard over every enum via linkml-term-validator remains deferred (same no-exceptions blocker as validate-terms-all) — noted in NEXT_TASKS. 201 tests pass (was 197); lint clean. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
MetalElementEnum.PALLADIUMin the LinkML schema was grounded toCHEBI:33373, which is actually promethium atom — not palladium. The id sits in a run of sequential CHEBI ids shared with the lanthanides (NEODYMIUM33372, TERBIUM33374, GADOLINIUM33375…), a classic copy-paste / off-by-one grounding error. The correct term isCHEBI:33363("palladium"), confirmed via OAK.Fix
src/communitymech/schema/communitymech.yaml—PALLADIUMmeaning: CHEBI:33373→CHEBI:33363src/communitymech/datamodel/communitymech.py— regenerated (just gen-python)src/communitymech/metal_extraction.py— corrected the parallelMETAL_CHEBI_MAPkeyThe curated community YAMLs already cited the correct
CHEBI:33363in theirterm.{id,label}pairs, so no data records needed editing — the bug was confined to the schema's authoritative enum grounding.Verification
just validate-all— clean (exit 0)just test— 197 passed🤖 Generated with Claude Code