AllenInstitute / biofile-finder

An open-use web application created for easy access, collaboration, and sharing of datasets through rich metadata search, filter, sort, and direct viewing in common industry applications or in our web-based 3D Volume Viewer.
https://biofile-finder.allencell.org/
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

Feature/translate query to python snippet #98

Closed aswallace closed 6 months ago

aswallace commented 6 months ago

Context

In the Code Snippet section, provide the code that would allow the File Explorer query to be converted to Python (pandas) Should close #80

Testing

Tested manually in Python 3.8-3.10 using the Variance Paper dataset. Works as is for Pandas 1.5-2.2. I tested manually down to Python 3.7 and pandas 1.3, but the groupby method changed after 1.5 so will throw an error for older versions. It's not a huge deprecation so if we wanted we could make it more dynamic or add a dropdown option for older Python/pandas versions

To Dos:

See #99 Currently only works for external data sources & string type fields, which means it doesn't consider range filters and the sorting may not work as expected for numerical and date fields.

Screenshot

image
SeanLeRoy commented 6 months ago

Works as is down to Pandas 1.5. Was unsure if we want to enforce versioning in the code (e.g., change it to pip install pandas>=1.5). I tested manually down to Python 3.7 and pandas 1.3, but the groupby method changed after 1.5 so will throw an error for older versions. It's not a huge deprecation so if we wanted we could make it more dynamic

Lets add the version floor to pandas to make sure it works for people / is explicit. I'd also include a note at the top that says this only works for Python version 3.7+

aswallace commented 6 months ago

Lets add the version floor to pandas to make sure it works for people / is explicit. I'd also include a note at the top that says this only works for Python version 3.7+

Will do! Also since we have that dropdown and the difference isn't substantial, I could theoretically differentiate options for Python 3.8+ pandas >= 1.5 and add a separate dropdown option for pandas < 1.5

aswallace commented 6 months ago

Lets add the version floor to pandas

Added in 34b3d35

aswallace commented 6 months ago

The only comment I didn't resolve was the windows part, and it's partially because with the new data source system I don't think I have access to the file paths of the data sources anymore. Unsure how best to address this