tilde-lab / optimade.science

A "sky-scanner" Optimade browser-only GUI
https://optimade.science/
MIT License
8 stars 3 forks source link

A question regarding how to query underlying data sources #41

Closed huanyu-li closed 2 years ago

huanyu-li commented 2 years ago

Hi,

May I just ask you a question regarding how you get the data from Materials Project for instance? Do you use any python library? I'm not familiar with Svelte and TypeScript so that it's a bit difficult for me to find out in the code.

I'm trying to query chemical formula anonymous is "A" by using OPTIMADE API for Materials Project, with following request. But I did not get correct result. https://optimade.materialsproject.org/v1/structures?chemical_formula_anonymous=%22A%22

Best, Huanyu

blokhin commented 2 years ago

@huanyu-li this is different from Python and uses completely other way of querying based on the web-browser. As you visit https://optimade.science, basically no server code is executed, and everything runs just in your Firefox or Chrome.

See also this example: https://github.com/tilde-lab/optimade-client/blob/main/examples/search.html (but you need to install the optimade library from NPM before running it).

blokhin commented 2 years ago

@huanyu-li in general, if you just need to get some materials data from the online databases, I'd recommend you to use Python, namely optimade library from PyPI. The browser-based client-side libraries (like NPM's optimade) have other aims, namely, assisting you in creating the GUIs.

huanyu-li commented 2 years ago

Thank you so much, Evgeny. It makes sense to me now.

blokhin commented 2 years ago

@huanyu-li you are very welcome, feel free to re-open, if anything else becomes unclear