biothings / biothings.api

BioThings API framework - Making high-performance API for biological annotation data
https://biothings.io
Apache License 2.0
45 stars 25 forks source link

jmespath: 500 error #324

Open colleenXu opened 5 months ago

colleenXu commented 5 months ago

I get 500 errors when trying to use jmespath for the following queries.

MyChem Query for specific chembl.drug_mechanism gene, trying to keep only matching chembl.drug_mechanism info

[GET version](https://mychem.info/v1/query?size=1000&fields=chembl.molecule_chembl_id,chembl.drug_mechanisms&filter=chembl.drug_mechanisms.target_components.uniprot:Q16602&jmespath=chembl.drug_mechanisms.target_components%7C%5B?uniprot==%27Q16602%27%5D) POST version: ``` curl --location --globoff 'https://mychem.info/v1/query?size=1000&fields=chembl.molecule_chembl_id,chembl.drug_mechanisms&jmespath=chembl.drug_mechanisms.target_components|[?uniprot=='Q16602']' \ --header 'Content-Type: application/json' \ --data '{ "q": ["Q16602"], "scopes": ["chembl.drug_mechanisms.target_components.uniprot"] }' ```

Query for specific civic.evidence_items.disease, trying to keep only matching civic.evidence_items info

[GET version](https://myvariant.info/v1/query?size=1000&fields=civic.entrez_id,civic.evidence_items&jmespath=civic.evidence_items.disease%7C%5B?doid==%27DOID:9256%27%5D&filter=civic.evidence_items.disease.doid:%22DOID:9256%22) POST version: ``` curl --location --globoff 'https://myvariant.info/v1/query?size=1000&fields=civic.entrez_id,civic.evidence_items&jmespath=civic.evidence_items.disease|[?doid=='DOID:9256']' \ --header 'Content-Type: application/json' \ --data '{ "q": "DOID:9256", "scopes": "civic.evidence_items.disease.doid" }' ```

My guess is that this error has to do with how these fields are nested (two layers with arrays of objects?)

colleenXu commented 1 month ago

Assigning to myself to review and see if this is fixed.