FAIRmat-NFDI / nomad-analysis

This repo contains the standard NOMAD plugin for analysis.
https://fairmat-nfdi.github.io/nomad-analysis/
Apache License 2.0
1 stars 0 forks source link

Test if `search` from `nomad.search` can be used to query data #9

Closed JosePizarro3 closed 6 days ago

JosePizarro3 commented 7 months ago

Right now, there is a function get_input_data which does the query for the referenced input entries. I wonder whether we could simplify this by using the function search as defined in nomad/nomad/search.

ka-sarthak commented 6 months ago

Thanks for bringing this up. I tried using nomad.search today but ran into some issues.

The functions defined in analysis_source.py will also be available in Jupyter notebooks. So, it's important that they can be used in that environment. Keeping this in mind, I tested nomad.search on NOMAD's JupyterHub, but it seems that it has some dependency on infrastructure packages (defined in nomad-lab pyproject.toml), which are not available by default in the Python kernel running in JupyterHub.

!pip install mongoengine
!pip install unidecode
!pip install structlog
!pip install python-logstash
!pip install fastapi
!pip install typing-extensions>4.7.1 --upgrade
!pip install zipstream

only after installing these packages, I was able to import nomad.search. We'll have to figure out a better way of doing it. Maybe we already have infrastructure dependencies in the Jupyter environment.

Still, I couldn't make the search work due to the missing user_id hash in Jupyter Notebook, but I am working on it.

ka-sarthak commented 6 days ago

We can use ArchiveQuery for this. Works nicely!