Skip to content

Finalize CHEBI-route ingredient suggester (MediaIngredientMech#119) - #220

Merged
realmarcin merged 1 commit into
mainfrom
feat/ingredient-suggester-sssom
Jul 20, 2026
Merged

Finalize CHEBI-route ingredient suggester (MediaIngredientMech#119)#220
realmarcin merged 1 commit into
mainfrom
feat/ingredient-suggester-sssom

Conversation

@realmarcin

Copy link
Copy Markdown
Contributor

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)

  1. MediaIngredientMech:NNNNNN is vestigial — drop it (follow-up below).
  2. The equivalence-safe join is the ingredient's CHEBI term from MIM's SSSOM
    skos:exactMatch rows — not the record identifier field (182 records
    have identifier ≠ their ontology mapping, some broken), and not
    close/narrowMatch (a narrowMatch → CHEBI would silently generalise).
  3. environmental_context coverage is 10 records, not ~44 (a seawater / soil /
    sulfur cluster).

What

  • cross_repo_environment.mim_exactmatch_chebi — parses
    mappings/ingredient_mappings.sssom.tsv (skips the # preamble), keeps only
    skos:exactMatchCHEBI: rows.
  • mim_ingredients_by_environment — joins each environmental_context record
    (MIM:<file-stem> subject) to that map; scans data/ingredients/ (not the repo
    root — MIM keeps multi-MB aggregate dumps under data/curated/ that would choke
    YAML parsing).
  • scripts/suggest_related_ingredients.py + just suggest-related-ingredients
    — emits RelatedIngredient with chebi_term (canonical ChEBI label, not
    MIM's free-text name → 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.
    No longer a draft.
  • Tests: SSSOM join (exactMatch vs narrowMatch vs non-CHEBI) + suggester helpers.

Verified

Real run emits Sulfur (CHEBI:26833, "sulfur atom") → hot-spring mat community
(exact ENVO:00000051 match; Sulfur's environmental_context lists 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 test254 passed
  • just lint — black + ruff + mypy clean

Follow-up (tracked in NEXT_TASKS)

Drop the vestigial ^MediaIngredientMech:\d{6}$ pattern from
RelatedIngredient.mediaingredientmech_id (#119 §1).

Closes #215 (superseded).

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 20, 2026 04:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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
realmarcin force-pushed the feat/ingredient-suggester-sssom branch from 708b92a to 551d20e Compare July 20, 2026 04:36
@realmarcin
realmarcin merged commit 7db8ebf into main Jul 20, 2026
2 checks passed
@realmarcin
realmarcin deleted the feat/ingredient-suggester-sssom branch July 20, 2026 04:38
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>
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