Skip to content

Tighten and prune BTE lookup query templates - #133

Open
maximusunc wants to merge 1 commit into
mainfrom
claude/bte-lookup-query-templates-ww6vn4
Open

Tighten and prune BTE lookup query templates#133
maximusunc wants to merge 1 commit into
mainfrom
claude/bte-lookup-query-templates-ww6vn4

Conversation

@maximusunc

Copy link
Copy Markdown
Collaborator

Several active multi-hop templates under-constrained their edges, causing the BTE lookup worker to return excessive results. Tighten the four over-broad Drug-treats-Disease templates:

  • Chem-affects-Gene-has_phenotype-DoP: constrain the bare affects first hop with an activity_or_abundance aspect qualifier (direction-agnostic).
  • Chem-affects_increases-Gene-loss_function-Disease and its _decreases mirror: the gene->disease edge had no predicate at all; give it associated_with + a contributes_to qualified predicate (following the existing associated_variant template pattern), and add an activity_or_abundance aspect to the first hop.
  • Chem-treats-PhenoOfDisease: narrow the catch-all treats_or_applied_or_studied_to_treat predicate to treats/ameliorates.

Also remove 14 template files that no group in template_groups.json references (the old_ideas/ and NonChem-treats-Disease/ directories plus several loose correlation/interaction one-hops), so they no longer sit as unreachable dead weight. The 10 referenced templates are unaffected.

After making these changes, I ran the Test Harness against my local BTE and here are the results:

Local, BTE ran all 85 queries in 4:38:

{
  "bte": {
    "TopAnswer": {
      "PASSED": 59,
      "FAILED": 41,
      "NO_RESULTS": 2,
      "SKIPPED": 0,
      "ERROR": 0
    },
    "Acceptable": {
      "PASSED": 38,
      "FAILED": 50,
      "NO_RESULTS": 9,
      "SKIPPED": 2,
      "ERROR": 0
    },
    "BadButForgivable": {
      "PASSED": 12,
      "FAILED": 1,
      "NO_RESULTS": 4,
      "SKIPPED": 0,
      "ERROR": 0
    },
    "NeverShow": {
      "PASSED": 379,
      "FAILED": 21,
      "NO_RESULTS": 35,
      "SKIPPED": 0,
      "ERROR": 0
    }
  }
}

vs CI (and I ran the same locally to check parity and it's spot on, and to check timing and it took 17:24):

{
  "shepherd-bte": {
    "TopAnswer": {
      "PASSED": 56,
      "FAILED": 44,
      "NO_RESULTS": 2,
      "SKIPPED": 0,
      "ERROR": 0
    },
    "Acceptable": {
      "PASSED": 40,
      "FAILED": 48,
      "NO_RESULTS": 9,
      "SKIPPED": 2,
      "ERROR": 0
    },
    "BadButForgivable": {
      "PASSED": 10,
      "FAILED": 3,
      "NO_RESULTS": 4,
      "SKIPPED": 0,
      "ERROR": 0
    },
    "NeverShow": {
      "PASSED": 353,
      "FAILED": 47,
      "NO_RESULTS": 35,
      "SKIPPED": 0,
      "ERROR": 0
    }
  }
}

Several active multi-hop templates under-constrained their edges, causing
the BTE lookup worker to return excessive results. Tighten the four
over-broad Drug-treats-Disease templates:

- Chem-affects-Gene-has_phenotype-DoP: constrain the bare `affects` first
  hop with an activity_or_abundance aspect qualifier (direction-agnostic).
- Chem-affects_increases-Gene-loss_function-Disease and its _decreases
  mirror: the gene->disease edge had no predicate at all; give it
  `associated_with` + a `contributes_to` qualified predicate (following the
  existing associated_variant template pattern), and add an
  activity_or_abundance aspect to the first hop.
- Chem-treats-PhenoOfDisease: narrow the catch-all
  `treats_or_applied_or_studied_to_treat` predicate to `treats`/`ameliorates`.

Also remove 14 template files that no group in template_groups.json
references (the old_ideas/ and NonChem-treats-Disease/ directories plus
several loose correlation/interaction one-hops), so they no longer sit as
unreachable dead weight. The 10 referenced templates are unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bj6iRrjjvnZSYApZMZd82p
@maximusunc
maximusunc requested a review from colleenXu July 24, 2026 11:38
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.08%. Comparing base (e39a05f) to head (51ef722).
⚠️ Report is 7 commits behind head on main.
see 4 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c0afa53...51ef722. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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