Skip to content

Migrate novelty/scoring TRAPI access to 1.5+ binding format - #39

Merged
maximusunc merged 6 commits into
mainfrom
claude/focused-brahmagupta-e1iltd
Jul 13, 2026
Merged

Migrate novelty/scoring TRAPI access to 1.5+ binding format#39
maximusunc merged 6 commits into
mainfrom
claude/focused-brahmagupta-e1iltd

Conversation

@maximusunc

Copy link
Copy Markdown
Collaborator

The novelty and clinical-evidence scoring read node/edge bindings using the pre-1.5 TRAPI shape (a list of {"id": ...} per query-graph key), but the service advertises TRAPI 1.6.0. In TRAPI 1.5.0 each binding value became a single object with an "ids" array, and knowledge_level became a first-class required Edge property instead of an EPC attribute. Under a real 1.5+ message the novelty computation threw on the first result and silently returned the all-zeros fallback (novelty 0.0 for every result).

  • Add app/binding_utils.binding_ids(), tolerant of both the <=1.4 (list of {"id": ...}) and >=1.5 ({"ids": [...]}) binding formats.
  • Route all node/edge binding access in compute_novelty (including the recency publication extraction), compute_clinical_evidence, and ordering_components through the helper; add a result_node_id() helper for the non-query node.
  • Read Edge.knowledge_level as a top-level property, falling back to the pre-1.5 biolink:knowledge_level attribute when absent.
  • Fix ordering_components so novelty only overwrites the default when a bound id actually has a score (avoids the query node clobbering it with 0.0).
  • Update the example message in server.py to TRAPI 1.6 (ids bindings plus the now-required knowledge_level/agent_type edge fields).

Claude-Session: https://claude.ai/code/session_01U5DdKXPzHKQdFQoUk1a5kY

claude and others added 6 commits June 24, 2026 20:14
The novelty and clinical-evidence scoring read node/edge bindings using the
pre-1.5 TRAPI shape (a list of {"id": ...} per query-graph key), but the
service advertises TRAPI 1.6.0. In TRAPI 1.5.0 each binding value became a
single object with an "ids" array, and knowledge_level became a first-class
required Edge property instead of an EPC attribute. Under a real 1.5+ message
the novelty computation threw on the first result and silently returned the
all-zeros fallback (novelty 0.0 for every result).

- Add app/binding_utils.binding_ids(), tolerant of both the <=1.4 (list of
  {"id": ...}) and >=1.5 ({"ids": [...]}) binding formats.
- Route all node/edge binding access in compute_novelty (including the recency
  publication extraction), compute_clinical_evidence, and ordering_components
  through the helper; add a result_node_id() helper for the non-query node.
- Read Edge.knowledge_level as a top-level property, falling back to the
  pre-1.5 biolink:knowledge_level attribute when absent.
- Fix ordering_components so novelty only overwrites the default when a bound
  id actually has a score (avoids the query node clobbering it with 0.0).
- Update the example message in server.py to TRAPI 1.6 (ids bindings plus the
  now-required knowledge_level/agent_type edge fields).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5DdKXPzHKQdFQoUk1a5kY
Support only current TRAPI (>=1.5). Remove the dual-format binding shim and
the pre-1.5 knowledge_level handling now that node/edge bindings are always
{"ids": [...]} and Edge.knowledge_level is a required first-class property.

- Delete app/binding_utils.py; read binding ids directly via ["ids"] in
  compute_novelty, compute_clinical_evidence, and ordering_components.
- Determine curation solely from Edge.knowledge_level; drop the attribute-scan
  fallback and the now-unreachable primary_knowledge_source heuristic (both
  only ran when knowledge_level was absent, which cannot happen in >=1.5).
- Update the clinical-evidence test fixture to the current binding format.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5DdKXPzHKQdFQoUk1a5kY
@maximusunc
maximusunc merged commit b566da5 into main Jul 13, 2026
2 checks passed
@maximusunc
maximusunc deleted the claude/focused-brahmagupta-e1iltd branch July 13, 2026 20:28
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