Skip to content

Comments

feature(curation): Add functionality to filter results by curation#61

Merged
tonywu1999 merged 5 commits intodevelfrom
feature-curation
Nov 4, 2025
Merged

feature(curation): Add functionality to filter results by curation#61
tonywu1999 merged 5 commits intodevelfrom
feature-curation

Conversation

@tonywu1999
Copy link
Contributor

@tonywu1999 tonywu1999 commented Nov 4, 2025

Summary by CodeRabbit

  • New Features
    • Added optional filter_by_curation parameter to filter subnetwork results by curation status (default: disabled).
    • Added api_key parameter to enable API authentication for enhanced filtering capabilities.
    • Evidence counts can now be adjusted based on curation feedback data when filtering is enabled.

Summary by CodeRabbit

Release Notes

  • New Features
    • Introduced optional curation-based filtering to refine network results by evaluating data quality and reliability metrics
    • Added support for optional API key parameter to enable authenticated access and enhanced service features

@coderabbitai
Copy link

coderabbitai bot commented Nov 4, 2025

Walkthrough

Adds optional filter_by_curation and api_key parameters to getSubnetworkFromIndra, introduces an internal .get_incorrect_curation_count() helper that queries INDRA's curation API, and applies optional curation-based adjustments to evidence counts during response filtering. Documentation and imports updated.

Changes

Cohort / File(s) Change Summary
Namespace / Imports
NAMESPACE
Added GET and status_code imports (from httr) for API calls.
Main function
R/getSubnetworkFromIndra.R
Extended public function signature with filter_by_curation = FALSE and api_key = ""; forwarded these to .filterIndraResponse. Documentation comments updated.
Utilities
R/utils_getSubnetworkFromIndra.R
Added internal .get_incorrect_curation_count(stmt_hash, api_key) to query INDRA curation endpoint; extended .filterIndraResponse(...) signature to accept filter_by_curation and api_key; when enabled, subtracts incorrect curation counts from evidence_count per statement with brief pauses between requests; added httr (GET, status_code, content) and jsonlite::fromJSON usage.
Documentation
man/getSubnetworkFromIndra.Rd
Updated function signature and added \arguments entries for filter_by_curation and api_key.

Sequence Diagram

sequenceDiagram
    participant User
    participant getSubnetwork as getSubnetworkFromIndra
    participant filterIndra as .filterIndraResponse
    participant getCuration as .get_incorrect_curation_count
    participant INDRA as INDRA_API

    User->>getSubnetwork: Call (filter_by_curation=TRUE, api_key)
    getSubnetwork->>filterIndra: Pass params & response

    rect rgb(230,245,255)
      Note over filterIndra: When filter_by_curation == TRUE
      filterIndra->>getCuration: For each statement: request curation count
      getCuration->>INDRA: HTTP GET /curation (stmt_hash, api_key)
      INDRA-->>getCuration: Return count or error (fallback 0)
      getCuration-->>filterIndra: incorrect_count
      filterIndra->>filterIndra: Adjust evidence_count -= incorrect_count
      filterIndra->>filterIndra: Throttle (short pause) between requests
    end

    filterIndra->>filterIndra: Apply evidence_count cutoff
    filterIndra-->>getSubnetwork: Filtered results
    getSubnetwork-->>User: Return subnetwork
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to .get_incorrect_curation_count() error handling, HTTP status handling, and JSON parsing.
  • Verify correct threading of filter_by_curation and api_key through public -> utils functions.
  • Check throttling timing and that evidence_count adjustments are applied before final filtering.

Possibly related PRs

Suggested labels

Review effort 3/5

Poem

🐰 I hopped through INDRA's fields of notes,
Counting curations, small and remote,
I shave off mistakes with a careful paw,
Networks grow truer—hip, hop, hurrah! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is incomplete. While it includes a high-level summary of new features (filter_by_curation, api_key parameters), it lacks the detailed structure required by the template, including 'Motivation and Context' section, comprehensive 'Changes' bullet points, 'Testing' details, and the completion checklist. Add 'Motivation and Context' explaining the problem this solves, expand 'Changes' with detailed bullet points for each modification, describe unit tests added, and complete the pre-review checklist items.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feature(curation): Add functionality to filter results by curation' accurately and specifically describes the main change: adding curation-based filtering functionality to the subnetwork results.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature-curation

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4271be8 and 0503630.

📒 Files selected for processing (1)
  • R/utils_getSubnetworkFromIndra.R (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: pkgdown
  • GitHub Check: test-coverage
  • GitHub Check: build
🔇 Additional comments (3)
R/utils_getSubnetworkFromIndra.R (3)

102-104: Clear parameter documentation.

The documentation accurately describes the new parameters and their purpose.


109-110: Backward-compatible signature extension.

The new parameters with sensible defaults maintain backward compatibility.


135-138: Correct filter sequencing.

Applying the evidence count threshold after the optional curation adjustment ensures that curated evidence counts are properly considered in the filtering logic.


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

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

@github-actions
Copy link

github-actions bot commented Nov 4, 2025

Failed to generate code suggestions for PR

@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2025

Codecov Report

❌ Patch coverage is 18.75000% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.59%. Comparing base (afe0d21) to head (0503630).

Files with missing lines Patch % Lines
R/utils_getSubnetworkFromIndra.R 16.12% 26 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            devel      #61      +/-   ##
==========================================
- Coverage   63.89%   62.59%   -1.30%     
==========================================
  Files           7        7              
  Lines        1227     1254      +27     
==========================================
+ Hits          784      785       +1     
- Misses        443      469      +26     

☔ View full report in Codecov by Sentry.
📢 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.

@tonywu1999 tonywu1999 changed the title feat(curation): Add functionality to filter results by curation feature(curation): Add functionality to filter results by curation Nov 4, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
R/utils_getSubnetworkFromIndra.R (1)

131-131: Consider adding progress indication for long-running operations.

The 100ms delay between API requests (necessary to avoid rate limiting) means that processing 100 statements takes at least 10 seconds. Consider adding progress indication for better user experience.

Example:

if (filter_by_curation) {
    message(sprintf("Applying curation-based filtering to %d statements...", length(res)))
    for (i in seq_along(res)) {
        if (i %% 50 == 0) {
            message(sprintf("Processed %d/%d statements", i, length(res)))
        }
        # ... existing code ...
    }
    message("Curation filtering complete.")
}
man/getSubnetworkFromIndra.Rd (1)

17-19: LGTM! Documentation correctly describes new parameters.

The documentation accurately reflects the new filter_by_curation and api_key parameters.

Consider enhancing the api_key documentation to include security guidance:

-\item{api_key}{string of INDRA API key for accessing curated statements.}
+\item{api_key}{string of INDRA API key for accessing curated statements.
+Required when filter_by_curation is TRUE. The API key should be kept secure
+and not committed to version control.}

Also applies to: 59-63

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between afe0d21 and 4271be8.

📒 Files selected for processing (4)
  • NAMESPACE (1 hunks)
  • R/getSubnetworkFromIndra.R (2 hunks)
  • R/utils_getSubnetworkFromIndra.R (2 hunks)
  • man/getSubnetworkFromIndra.Rd (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: pkgdown
  • GitHub Check: test-coverage
  • GitHub Check: build
🔇 Additional comments (3)
NAMESPACE (1)

21-21: LGTM! Imports support new curation API functionality.

The httr::GET and httr::status_code imports are correctly added to support the new .get_incorrect_curation_count helper function.

Also applies to: 25-25

R/getSubnetworkFromIndra.R (1)

65-65: LGTM! Parameters correctly passed to internal filter.

The new parameters are properly passed to .filterIndraResponse for processing.

R/utils_getSubnetworkFromIndra.R (1)

134-137: LGTM! Evidence count filter correctly repositioned.

Moving the evidence_count filter to after the curation adjustment is the correct approach, ensuring that filtering is applied to the adjusted counts.

@tonywu1999 tonywu1999 merged commit de9ed82 into devel Nov 4, 2025
4 checks passed
@tonywu1999 tonywu1999 deleted the feature-curation branch November 4, 2025 23:03
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