[Cod-bugs] 'next' link does not save queried response_items

Saulius Gražulis grazulis at ibt.lt
Tue Nov 30 07:28:44 EET 2021


On 2021-11-29 17:40, Oier Arcelus wrote:
>
> am trying to use the OPTIMADE API implementation of COD, through the
> pymatgen’s OptimadeRester class. I just realized that the ‘next’ links
> that appear as responses do not conserve the queried response_fields.
>
>  
>
> For example, from this query:
>
>  
>
> https://www.crystallography.net/cod/optimade/v1/structures?filter=(elements%20HAS%20ALL%20%22Co%22,%20%22Li%22,%20%22O%22)&response_fields=lattice_vectors,cartesian_site_positions,species,species_at_sites
> <https://www.crystallography.net/cod/optimade/v1/structures?filter=(elements%20HAS%20ALL%20%22Co%22,%20%22Li%22,%20%22O%22)&response_fields=lattice_vectors,cartesian_site_positions,species,species_at_sites>
>
>  
>
> The ‘next’ link is:
>
>  
>
> https://www.crystallography.net/cod/optimade/v1.0.0/structures?page_limit=10&page_offset=10&filter=%28elements%20HAS%20ALL%20%22Co%22%2C%20%22Li%22%2C%20%22O%22%29
> <https://www.crystallography.net/cod/optimade/v1.0.0/structures?page_limit=10&page_offset=10&filter=%28elements%20HAS%20ALL%20%22Co%22%2C%20%22Li%22%2C%20%22O%22%29>
>
>  
>
> And then when the OptimadeRester class tries to find the some of the
> response_fields, it fails, as they are no longer present in the
> response from the COD.
>
>  
>
> Is this a bug? Or is it a known thing in the implementation, for me it
> makes it much harder to keep the information consistent across pagination.
>
Its a good question.... I think OPTIMADE spec. does not specify how the
server should behave regarding the 'response_fields' (but we should
double check).

If it is not in the OPTIMADE spec yet, maybe we should include it into
the spec.?

I any case, it seems that retaining 'response_fields' (and possibly
other relevant QS parameters) is a good think and should be easy to do.
I forward Andrius, maybe he can have a closer look at the implementation
and enhance it.

For now, a possible workaround will probably be to attach the
'response_fields' to every 'next' URL; this should also work in the
future if the 'next' URL will get a copy of its own 'response_fields',
since, AFAIU, duplicated QS parameter is not an error. Or you can check
of the 'response_fields' is already present, to be 200% sure.

Regards,
Saulius

-- 
Dr. Saulius Gražulis
Vilnius University, Life Science Center, Institute of Biotechnology
Saulėtekio al. 7, LT-10257 Vilnius, Lietuva (Lithuania)
phone (office): (+370-5)-2234353, mobile: (+370-684)-49802, (+370-614)-36366


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.crystallography.net/pipermail/cod-bugs/attachments/20211130/0a3541e1/attachment-0001.htm>


More information about the Cod-bugs mailing list