<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 2021-11-29 17:40, Oier Arcelus
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:DB7PR08MB3529D10C074EE0C9D9C06F80C7669@DB7PR08MB3529.eurprd08.prod.outlook.com">
<p class="MsoNormal"><span lang="EN-US"> 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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">For example, from this
query:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><a
href="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"
moz-do-not-send="true">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</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The ‘next’ link is:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New",serif;color:black;mso-fareast-language:ES"><a
href="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"
moz-do-not-send="true"><span lang="EN-US">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</span></a></span><span
style="font-size:10.0pt;font-family:"Courier
New",serif;color:black;mso-fareast-language:ES"
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p></o:p></span></p>
</blockquote>
<p>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).</p>
<p>If it is not in the OPTIMADE spec yet, maybe we should include it
into the spec.?</p>
<p>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.</p>
<p>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.<br>
</p>
<p>Regards,<br>
Saulius<br>
</p>
<pre class="moz-signature" cols="72">--
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
</pre>
<br />--
<br />This message has been scanned for viruses and
<br />dangerous content by
<a href="http://www.mailscanner.info/"><b>MailScanner</b></a>, and is
<br />believed to be clean.
</body>
</html>