Skip to content

Added get_evidence() with the backend chosen from backend_database - #124

Merged
tonywu1999 merged 1 commit into
develfrom
MSstatsBioNet/work/20261006_phase4b-evidence
Oct 6, 2026
Merged

tonywu1999 merged 1 commit into
develfrom
MSstatsBioNet/work/20261006_phase4b-evidence

Conversation

@tonywu1999

@tonywu1999 tonywu1999 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor
  • New exported generic get_evidence(); the INDRA method replaces .extract_evidence_text() and uses the backend's cogex_url
  • New R/backend-registry.R splits edges by backend_database and calls each group's default backend
  • filterSubnetworkByContext() and the four topic functions take backend = NULL
  • New test-evidence.R; the old evidence tests moved there and mocks now target .fetch_evidence()

Context and solution

Evidence lookup previously used an INDRA-specific extraction path. This change adds a get_evidence() generic and moves evidence retrieval behind the NetworkBackend interface. When callers do not supply a backend, the code selects one from each edge group’s backend_database.

Changes

  • Export get_evidence() and add a default NetworkBackend method.
  • Add IndraBackend evidence retrieval from the CoGEx evidence endpoint. The method batches unique statement hashes and returns edge rows with evidence text and PMID.
  • Add backend registry dispatch. It groups edges by backend_database when no backend is supplied and uses the registered default for each group.
  • Add optional backend arguments to filterSubnetworkByContext() and four topic functions.
  • Update topic evidence collection and context filtering to use the backend retrieval path.
  • Document the new API and backend arguments in NEWS.md and the relevant help files.

Tests

  • Add test-evidence.R coverage for evidence retrieval, backend dispatch, input validation, and backend propagation to context and topic functions.
  • Update context-filtering and hierarchical-topic tests to mock .fetch_evidence() instead of .extract_evidence_text().
  • Test execution results were not provided.

Coding guidelines

  • No coding-guideline violations were identified in the supplied change summary.

* New exported generic get_evidence(); the INDRA method replaces .extract_evidence_text() and uses the backend's cogex_url
* New R/backend-registry.R splits edges by backend_database and calls each group's default backend
* filterSubnetworkByContext() and the four topic functions take backend = NULL
* New test-evidence.R; the old evidence tests moved there and mocks now target .fetch_evidence()

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aa4f3ea7-c555-4edc-aa6f-bc76c7df2f2b
📥 Commits

Reviewing files that changed from the base of the PR and between 4de7183 and d037861.

📒 Files selected for processing (21)
  • NAMESPACE
  • NEWS.md
  • R/AllGenerics.R
  • R/backend-indra-cogex.R
  • R/backend-indra.R
  • R/backend-registry.R
  • R/bootstrapTopicModels.R
  • R/compareTopicModels.R
  • R/decomposeSubnetworkByTopic.R
  • R/decomposeSubnetworkIntoHierarchicalTopics.R
  • R/filterSubnetworkByContext.R
  • R/utils_decomposeSubnetworkByTopic.R
  • man/bootstrapTopicModels.Rd
  • man/compareTopicModels.Rd
  • man/decomposeSubnetworkByTopic.Rd
  • man/decomposeSubnetworkIntoHierarchicalTopics.Rd
  • man/filterSubnetworkByContext.Rd
  • man/get_evidence.Rd
  • tests/testthat/test-decomposeSubnetworkIntoHierarchicalTopics.R
  • tests/testthat/test-evidence.R
  • tests/testthat/test-filterSubnetworkByContext.R

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The package adds get_evidence() as a backend-dispatched API, implements evidence retrieval for IndraBackend, and adds backend selection to context filtering and topic workflows. When no backend is supplied, edge backend_database values determine the default backend.

Changes

Evidence retrieval API

Layer / File(s) Summary
Evidence API and INDRA retrieval
NAMESPACE, NEWS.md, R/AllGenerics.R, R/backend-indra-cogex.R, R/backend-indra.R, R/filterSubnetworkByContext.R, man/get_evidence.Rd, tests/testthat/test-evidence.R
The package exports get_evidence() and adds a default method for unsupported backends. The IndraBackend method queries unique statement hashes through the backend CoGEx URL and returns rows containing edge fields, evidence text, and PMID. The old evidence-query helpers in context filtering are removed. Tests cover retrieval, validation, and empty results.

Backend routing and workflows

Layer / File(s) Summary
Backend resolution and context filtering
R/backend-registry.R, R/filterSubnetworkByContext.R, man/filterSubnetworkByContext.Rd, NEWS.md, tests/testthat/test-evidence.R, tests/testthat/test-filterSubnetworkByContext.R
The registry validates an explicit backend or resolves defaults from backend_database, groups edges, and fetches evidence for each group. Context filtering passes its optional backend to evidence fetching. Tests cover backend resolution, propagation, and context-filtering behavior.
Backend propagation through topic workflows
R/bootstrapTopicModels.R, R/compareTopicModels.R, R/decomposeSubnetworkByTopic.R, R/decomposeSubnetworkIntoHierarchicalTopics.R, R/utils_decomposeSubnetworkByTopic.R, man/bootstrapTopicModels.Rd, man/compareTopicModels.Rd, man/decomposeSubnetworkByTopic.Rd, man/decomposeSubnetworkIntoHierarchicalTopics.Rd, tests/testthat/test-decomposeSubnetworkIntoHierarchicalTopics.R, tests/testthat/test-evidence.R
Topic functions add an optional backend argument and pass it to evidence and corpus construction. Documentation describes default backend selection and reuse of retrieved evidence. Tests check backend propagation and evidence reuse.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ContextAndTopicFunctions
  participant fetch_evidence
  participant BackendRegistry
  participant get_evidence
  participant IndraBackend
  ContextAndTopicFunctions->>fetch_evidence: Pass edges and optional backend
  fetch_evidence->>BackendRegistry: Resolve backend for edge groups
  BackendRegistry->>get_evidence: Fetch evidence for each group
  get_evidence->>IndraBackend: Dispatch evidence request
Loading

Merge Risk: ⚪ Minimal · up to d0378

No identified issue currently blocks merging. The live CoGEx evidence request has not been validated.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description summarizes the main code changes, but omits the required motivation and testing sections and does not address the review checklist. Add a short motivation and context section, describe the tests added or modified and their results, and complete or explicitly address each checklist item.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the new get_evidence() API and its backend selection from backend_database.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

I’m a rabbit with notes in my paws,
I hop through evidence, hash by hash.
New backends join the trail with care,
Edge rows bring sentences to share.
I thump for tidy results in the grass.

Comment @coderabbitai help to get the list of available commands.

@tonywu1999
tonywu1999 merged commit c4e6b33 into devel Oct 6, 2026
4 checks passed
@tonywu1999
tonywu1999 deleted the MSstatsBioNet/work/20261006_phase4b-evidence branch October 6, 2026 21:54
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.23%. Comparing base (4de7183) to head (d037861).
⚠️ Report is 1 commits behind head on devel.

Files with missing lines Patch % Lines
R/backend-indra-cogex.R 76.31% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            devel     #124      +/-   ##
==========================================
+ Coverage   82.53%   85.23%   +2.70%     
==========================================
  Files          21       22       +1     
  Lines        2496     2547      +51     
==========================================
+ Hits         2060     2171     +111     
+ Misses        436      376      -60     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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