Skip to content

Look up NCIT codes by obo_id, as NCIT.m does - #15

Merged
stevevanhooser merged 1 commit into
mainfrom
claude/ncit-obo-id-lookup
Oct 21, 2026
Merged

stevevanhooser merged 1 commit into
mainfrom
claude/ncit-obo-id-lookup

Conversation

@stevevanhooser

@stevevanhooser stevevanhooser commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #13.

Change

NCITProvider inherited OLSProvider.lookup_term, which sends any term that isn't all digits to a label search. NCIT codes such as C3262 aren't all digits, so a lookup by code never resolved, while a lookup by name did. MATLAB does the reverse. NCIT.m (8e109b0) runs preprocessLookupInput and then always calls searchOLSAndPerformIRILookup(['NCIT:',search_query], 'obo_id', ...).

NCITProvider.lookup_term now builds the query the way preprocessLookupInput does and sends NCIT:<query> as an exact obo_id search:

  • C3262 resolves to NCIT:C3262 / Neoplasm.
  • A name such as Neoplasm is searched as the obo_id NCIT:Neoplasm and is not found, matching MATLAB. NCIT name lookup should be added to NCIT.m first if it's wanted.
  • A purely numeric id is kept as MATLAB sends it (NCIT:NCIT:<digits>).

The bridge entry for NCIT records the re-examination at 8e109b0.

known_gaps

Waltham-Data-Science/ndi-ontology-matlab#13 has merged (36d7814). It added SNOMED, EFO and NCIT cases to the shared table, so the second commit here empties known_gaps in test_case_table_covers_every_ported_provider. Every ported provider now has a case.

Tests

  • Two new mocked unit tests in TestOLSProvider check that a code goes to an exact obo_id search for NCIT:C3262, and that a name goes to the obo_id search rather than a label search.
  • Local results: black --check, ruff check and pytest -m "not live" all pass. test_case_table_covers_every_ported_provider passes against ndi-ontology-matlab 36d7814.
  • The live shared-case job couldn't be run locally because the sandbox can't reach EBI OLS. This PR's CI runs it against ndi-ontology-matlab main, which now includes the NCIT:C3262 and NCIT:C12434 rows, so that job is the live check of this fix.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CgkxUSKbSBq9Js9q871BNE

NCITProvider inherited OLSProvider.lookup_term, which sends any
non-numeric term to a label search. NCIT codes (C3262) are not numeric,
so a lookup by code never resolved, while a lookup by name did, the
reverse of MATLAB: NCIT.m always searches obo_id for
['NCIT:', search_query]. Override lookup_term to send the same query.

Fixes #13.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CgkxUSKbSBq9Js9q871BNE
@stevevanhooser
stevevanhooser merged commit da61c2b into main Oct 21, 2026
6 checks passed
@stevevanhooser
stevevanhooser deleted the claude/ncit-obo-id-lookup branch October 21, 2026 17:04
stevevanhooser pushed a commit that referenced this pull request Oct 21, 2026
…ed helpers

main brought #14 (EMPTY), #15 (NCIT codes by obo_id), #17 (lookup
trimming, the same fix as this branch's) and #18 (known_gaps).

#15's NCITProvider.lookup_term called OLSProvider._search_ols, which this
branch replaces; git merged it cleanly, and every NCIT lookup would have
raised AttributeError. It now does what NCIT.m does on the ported
helpers: preprocessLookupInput, then searchOLSAndPerformIRILookup on
obo_id for ['NCIT:', search_query]. Its tests move to FakeOLS, plus one
for the prefixed and numeric forms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017iFBFMQmEZaz21d9ZFJbiH
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.

NCITProvider looks up NCIT codes by label instead of obo_id, diverging from NCIT.m

2 participants