nci-hcmi-catalog / portal

HCMI Searchable Catalog Portal
https://hcmi-searchable-catalog.nci.nih.gov/
BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

🐛 Fix Exports With "Age at Diagnosis" Filter (#1050) #1051

Closed mistryrn closed 1 year ago

mistryrn commented 1 year ago

Context

Eva reported an issue (#1050) where she was unable to download the “Export” TSV from the models table. Turns out it’s an issue with the “Age of Diagnosis” filter sqon.

“Age of Diagnosis” is a numeric facet, so it adds >= and/or <= operators to the sqon based on user input.

A couple years ago we started sanitizing the request params (req.sanitize(req.body.params)) to the api endpoint for triggering the TSV download. So it’s going from <= to &lt;= in the sqon string before being parsed into JSON and sent to arranger to get the data for download. Arranger is strictly expecting <=, not the sanitized version, so it throws an Unknown op error and the download fails.

This fix uses a regex to decode the sanitized &gt; and &lt; back to > and < for Arranger.

Deploy Instructions

  1. Restart api