Edge case/failure handling in /search
#349
jsstevenson
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Currently, the
/searchendpoint takes an accession ID and a start/end and returns variants contained within (overlapping or fully contained, i can't remember -- that's a separate issue).First, if
accession_iddoesn't start withga4gh:, then we try to use seqrepo to translate it to a known GA4GH accession ID (i.e. something starting withga4gh:SQ.. If the arg DOES start withga4gh:, then we just proceed with a search for all variants where the refgetAccession ID equals that value. This is frommain.pyon the storage refactor branch:anyvar/src/anyvar/restapi/main.py
Lines 606 to 626 in fb12671
Some behavior I've noticed, which varies between correct, weird, and probably wrong:
404 NOT FOUNDwith{"detail": "Unable to dereference provided accession ID"}. I think that's not quite right, it would be one thing to return 404 when a requested resource is not found, but here the 404 seemingly indicates thatGET /searchdoesn't exist, which is not true. ❌200 OKwith body{"variations": []}. ✅200 OKresponse. 🤔200 OKwith body{"variations": []}. 🤔I think there are a few distinct kinds of failure modes (or ways to handle flawed inputs) and it'd be nice to communicate them to the user or handle them appropriately:
"GRCh38383838.p1:Y")ga4gh:(e.g."SQ.8_liLu1aycC0tPQPFmUaGXJLDs5SbPZ5")"ga4gh:SQ.12345")"SQ.8_liLu1aZZZZZZZZZZZZZZZZZZZZZZZZ")All reactions