Let `/bulk-lookup` callers tell "not searched" apart from "no matches"

Aperta
#298 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
fastapi, python

Direzione di ricerca

Start by reading lookup() and the /bulk-lookup endpoint, then compare its response shape with /lookup and the RequestValidationError response. Decide whether to document the behavior or expose per-string diagnostics without failing the batch or breaking existing callers; the issue leaves that API design open. Done means callers can distinguish unsearched strings from searched strings with no matches, while one unsearchable string still does not fail the batch.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

/bulk-lookup returns [] for a string that was rejected without being searched and for a string that was searched and matched nothing. A caller cannot tell the two apart.

There are two ways a string gets an empty list today, both from the length check in lookup():

  • it is empty, or empty once leading/trailing whitespace is stripped;
  • it is shorter than minimum_query_length (default 2, NAMERES_MINIMUM_QUERY_LENGTH) and is not an exact query.

/lookup distinguishes these — it rejects them with an HTTP 422 carrying a RequestValidationError body. /bulk-lookup deliberately does not, because failing the whole batch over one bad string is worse than the missing diagnostic (see #279). But that leaves a caller sending a few thousand strings with no way to find out that some of them were never searched, and the natural conclusion — "NameRes has nothing for this string" — is wrong.

This matters most for the callers /bulk-lookup exists to serve: a named entity recognition pipeline feeding NameRes its extracted spans has no reason to expect that a two-character span is treated differently from a twenty-character one, and will silently record a miss.

Worth deciding:

  • whether to report it at all, or to document the behaviour more loudly and leave it;
  • if reported, where it goes. The response is Dict[str, List[LookupResult]] keyed by the input string, so there is no obvious place for per-string metadata without changing that shape — which would be a breaking change for every existing caller. A sibling key in the response body ({"results": {...}, "not_searched": [...]}), or an opt-in query parameter that switches to the richer shape, both avoid that.

Note that any fix should keep the property that one unsearchable string does not fail the batch; that part is working as intended.

Lingua principale
Python
Stelle
5
Fork
4
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NCATSTranslator/NameResolution

Tutte le issue di NCATSTranslator/NameResolution

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.