Finalize CHEBI-route ingredient suggester (MediaIngredientMech#119) - #220
Merged
Conversation
MIM#119 (now closed as answered) settled the two blockers: MediaIngredientMech:NNNNNN is vestigial (drop it), and the equivalence-safe join is the ingredient's CHEBI term from MIM's SSSOM skos:exactMatch rows — NOT the record identifier field, NOT close/narrowMatch (which would generalise). Coverage is 10 environmental_context records, not ~44. Rebuilt the suggester (supersedes draft PR #215) on that basis: - cross_repo_environment.py: mim_exactmatch_chebi() parses the SSSOM (skipping the # preamble; keeps only skos:exactMatch → CHEBI:); mim_ingredients_by_environment() joins each environmental_context record (MIM:<file-stem> subject) to it and scans data/ingredients/ (not the repo root — MIM keeps multi-MB aggregate dumps under data/curated/ that would blow up YAML parsing). + get_chebi_adapter/_cached_oak_adapter. - scripts/suggest_related_ingredients.py + `just suggest-related-ingredients`: emits RelatedIngredient with chebi_term (CANONICAL ChEBI label, not MIM's free-text name, so the id-label gate stays green) + shared_environment_term; env keys are environment_term + modeled_environment; --subsumption supported; skips already-linked CHEBI ids, generic envs, and unresolved labels (reported). Not a draft. - tests: SSSOM join (exactMatch/narrowMatch/non-CHEBI filtering) + suggester helpers. Verified: real run emits Sulfur (CHEBI:26833, "sulfur atom") for the hot-spring mat community (exact ENVO:00000051 match); block LinkML-validates. Yield is 1 today — data-limited by MIM's 10 context records, correct and scales. 254 tests pass; lint clean. Follow-up (NEXT_TASKS): drop the vestigial ^MediaIngredientMech:\d{6}$ pattern from RelatedIngredient.mediaingredientmech_id. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
realmarcin
force-pushed
the
feat/ingredient-suggester-sssom
branch
from
July 20, 2026 04:36
708b92a to
551d20e
Compare
realmarcin
added a commit
that referenced
this pull request
Jul 29, 2026
…thread) (#263) Reconciled against merged PRs since the stale 2026-07-21 date. Marked DONE: - 000031 re-scoping (#256) — was "curator decision still open"; resolved by PR #262. Added a dedicated section recording what changed and why it was a defect rather than a controversy. - Li et al. 2024 ingestion (#259) — was "still not ingested"; PR #261 cached it via the new --from-file path and curated 000068. - §2 "apply modeled_environment matching to the ingredient suggester" — this was never actually pending: suggest_related_ingredients.py has read modeled_environment since PR #220 that created it. §2/#30 now has no actionable remainder here. Corrected a wrong claim that was sitting in the file: the Li 2024 summary said "5-10 mM promotes, >=30 mM inhibits". The >=30 mM part came from the Edison report and describes the paper's anaerobic-sludge system; in the coculture the response is non-monotonic (30 mM recovers in the later stage, only 50 mM inhibits). Also noted that one quoted snippet from that report appears nowhere in the paper. Newly logged: PR #255 (Suillus-Bacillus thiamine SynCom) has been open since 2026-07-26, non-draft, MERGEABLE/CLEAN with all gates green, and was absent from this file entirely. Still open and unchanged: #257 (validate-references reporting), #258 (14 dangling edges, triage), #259 (automated retrieval from blocking publishers), and the upstream-blocked term-minting items in sections 0/1. Co-authored-by: Claude Opus 5 (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.
Context
MIM#119 is closed as answered, which settles the two blockers that held the
draft ingredient suggester (#215). This PR rebuilds it correctly on MIM's guidance
and supersedes #215.
What MIM ruled (#119)
MediaIngredientMech:NNNNNNis vestigial — drop it (follow-up below).skos:exactMatchrows — not the recordidentifierfield (182 recordshave
identifier≠ their ontology mapping, some broken), and notclose/narrowMatch (a narrowMatch → CHEBI would silently generalise).
environmental_contextcoverage is 10 records, not ~44 (a seawater / soil /sulfur cluster).
What
cross_repo_environment.mim_exactmatch_chebi— parsesmappings/ingredient_mappings.sssom.tsv(skips the#preamble), keeps onlyskos:exactMatch→CHEBI:rows.mim_ingredients_by_environment— joins eachenvironmental_contextrecord(
MIM:<file-stem>subject) to that map; scansdata/ingredients/(not the reporoot — MIM keeps multi-MB aggregate dumps under
data/curated/that would chokeYAML parsing).
scripts/suggest_related_ingredients.py+just suggest-related-ingredients— emits
RelatedIngredientwithchebi_term(canonical ChEBI label, notMIM's free-text name → id↔label gate stays green) +
shared_environment_term;env keys are
environment_term+modeled_environment;--subsumptionsupported; skips already-linked CHEBI ids, generic envs, and unresolved labels.
No longer a draft.
Verified
Real run emits Sulfur (CHEBI:26833, "sulfur atom") → hot-spring mat community
(exact
ENVO:00000051match; Sulfur'senvironmental_contextlists hot spring).The emitted block LinkML-validates. Yield is 1 today — data-limited by
MIM's 10 context records; correct and scales as MIM populates the field.
just test— 254 passedjust lint— black + ruff + mypy cleanFollow-up (tracked in NEXT_TASKS)
Drop the vestigial
^MediaIngredientMech:\d{6}$pattern fromRelatedIngredient.mediaingredientmech_id(#119 §1).Closes #215 (superseded).
🤖 Generated with Claude Code