biothings / biothings_explorer

TRAPI service for BioThings Explorer
https://api.bte.ncats.io
Apache License 2.0
8 stars 9 forks source link

x-bte operations: replace BioThings `list_filter` with `jmespath` #733

Open colleenXu opened 9 months ago

colleenXu commented 9 months ago

I've heard that jmespath should be used in replacement of list_filter for BioThings API querying (internal lab Slack thread). At the moment, list_filter behavior is still working and @newgene said a switch-over was not urgent.

However, to do this replacement / use jmespath moving forward, I'd need to review the documentation. I have some links here (some are internal lab slack threads):

I'm not sure if there is other documentation / info out there, or other info I'd need to adjust existing x-bte annotation and use this going forward...


list_filter was used for https://github.com/biothings/pending.api/issues/101, and was considered part of https://github.com/biothings/pending.api/issues/100 and https://github.com/biothings/mychem.info/issues/153.

I had asked about an enhancement / update to list_filter: https://github.com/biothings/pending.api/issues/101#issuecomment-1450688489 and this internal lab slack thread and was told that jmespath could potentially address this...

colleenXu commented 9 months ago

Note: saw post on jmespath design in the JQ stuff, the info may be helpful here. In particular, there's a link to a function's doc string (which may be helpful for understanding what to do for jmespath): https://github.com/biothings/biothings.api/blob/7b83617c40c2f12513a7db6842e5d14adf694039/biothings/web/query/formatter.py#L400

colleenXu commented 9 months ago

Rohan mentioned in this post (a reply to this comment) and starting here that JQ may be able to do similar behavior.

My impression is that:

But we'd need more discussion before deciding how to proceed + what we want to cover with this issue

newgene commented 9 months ago

@colleenXu that sounds like a good plan to proceed.

colleenXu commented 8 months ago

Narrowing the scope of this issue to just replacing list_filter. Using jmespath to write new issues can be >=1 new issues. Same with using JQ to write new operations.

colleenXu commented 8 months ago

Note: jmespath seems to be like list_filter, where the fields being acted upon must be included in the initial response (using the parameters.fields). See internal Slack discussion here

because list_filter is a post-query action, the field we filter on MUST be in the response. So yes, this is required