Materials-Consortia / optimade-python-tools

Tools for implementing and consuming OPTIMADE APIs in Python
https://www.optimade.org/optimade-python-tools/
MIT License
65 stars 42 forks source link

Support for enhanced list comparisons #1467

Open ml-evs opened 1 year ago

ml-evs commented 1 year ago

At some point we should try to support the grammar constructs listed in comparisons of list properties, e.g., list HAS ANY < 3, > 2.

One such correlated list query will come up in the CCPNC-DB implementation (tagging @jkshenton), where the following case might occur: if you have a flat list of chemical shifts of all species in a simulation, you will want to be able to do:

species_at_sites HAS Si:_ccpncdb_chemical_shifts HAS <= 3, >= 2

to request all Si chemical shifts between 2 and 3 inclusive. Of course it would be easier to keep the shifts in a dictionary keyed by element, at which case the query would be simplified to

_ccpnc_chemical_shifts.Si HAS <=3, >=2

but it would be great if we could support both.

jkshenton commented 1 year ago

Thanks @ml-evs! Yes, supporting that sort of query would be essential for the CCPNC-DB!