Migrate novelty/scoring TRAPI access to 1.5+ binding format - #39
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).
Claude-Session: https://claude.ai/code/session_01U5DdKXPzHKQdFQoUk1a5kY