https://github.com/aiidateam/aiida-optimade

OPTIMADE RESTful API implementation for AiiDA

https://github.com/aiidateam/aiida-optimade

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 10 committers (10.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.9%) to scientific vocabulary

Keywords from Contributors

sequencing archives action serializer interactive projection yolov5s xunit-framework xunit-test parallel
Last synced: 10 months ago · JSON representation

Repository

OPTIMADE RESTful API implementation for AiiDA

Basic Info
  • Host: GitHub
  • Owner: aiidateam
  • License: mit
  • Language: Python
  • Default Branch: develop
  • Homepage:
  • Size: 114 MB
Statistics
  • Stars: 6
  • Watchers: 1
  • Forks: 7
  • Open Issues: 32
  • Releases: 35
Created over 7 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License

README.md

OPTIMADE API implementation for AiiDA

The compatibility matrix below assumes the user always install the latest patch release of the specified minor version, which is recommended.

| Plugin | AiiDA | Python | Specification | |-|-|-|-| | v1.2 < v2.0 | Compatibility for v1.0 | PyPI pyversions | OPTIMADE API compatibility | | v1.0 < v1.2 | Compatibility for v1.0 | PyPI pyversions | OPTIMADE API compatibility | | v0.18 <= v0.20 | Compatibility for v0 | PyPI pyversions | OPTIMADE API compatibility |

| Latest release | Build status | Activity | |:--------------:|:------------:|:--------:| | AiiDA
PyPI
PyPI - Python Version
OPTIMADE | GitHub Workflow Status
Codecov | GitHub last commit |

This is a RESTful API server created with FastAPI that exposes an AiiDA database according to the OPTIMADE specification.

It is mainly used by Materials Cloud to expose access to archived AiiDA databases through the OPTIMADE API. But it may be freely implemented by any to fulfill a similar purpose.

The server is based on the test server "template" used in the optimade-python-tools package. Indeed, the filter grammar and parser and pydantic models from optimade-python-tools are used directly here.

Prerequisites

Environment where AiiDA is installed.
AiiDA database containing StructureData nodes, since these are the only AiiDA nodes that are currently exposed with this API (under the /structures endpoint).

Installation

The package is relased on PyPI, hence you can install it by:

shell $ pip install aiida-optimade

Otherwise, you can also git clone the repository from GitHub:

shell $ git clone https://github.com/aiidateam/aiida-optimade /path/to/aiida-optimade/parent/dir $ pip install -e /path/to/aiida-optimade

Development

For developers, there is a special setuptools extra dev, which can be installed by:

shell $ pip install aiida-optimade[dev]

or

shell $ pip install -e /path/to/aiida-optimade[dev]

This package uses Black for formatting. If you wish to contribute, please install the git pre-commit hook:

shell /path/to/aiida-optimade$ pre-commit install

This will automatically update the formatting when running git commit, as well as check the validity of various repository JSON and YAML files.

For testing run pytest, which will run with an AiiDA backend as standard. The tests can also be run with the MongoDB backend by setting the environment variable PYTEST_OPTIMADE_CONFIG_FILE, the value being a path to the config file to be used:

shell $ PYTEST_OPTIMADE_CONFIG_FILE=/path/to/aiida-optimade/tests/static/test_mongo_config.json pytest

However, note that the mongo_uri value will have to be updated according to your local setup.

Initialization

You should first initialize your AiiDA profile.

This can be done by using the aiida-optimade CLI:

shell $ aiida-optimade -p <PROFILE> init

Where <PROFILE> is the AiiDA profile.

Note: Currently, the default is optimade, if the -p / --profile option is not specified. This will be changed in the future to use the default AiiDA profile.

Initialization goes through your profile's StructureData nodes, adding an optimade extra, wherein all OPTIMADE-specific fields that do not have an equivalent AiiDA property are stored.

If in the future, more StructureData nodes are added to your profile's database, these will be automatically updated for the first query, filtering on any of these OPTIMADE-specific fields. However, if you do not wish a significant lag for the user or risking several GET requests coming in at the same time, trying to update your profile's database, you should re-run aiida-optimade init for your profile (in between shutting the server down and restarting it again).

Running the server

Locally

Using the aiida-optimade CLI, you can do the following:

shell $ aiida-optimade -p <PROFILE> run

Where <PROFILE> is the AiiDA profile you wish to serve.

Note: Currently, the default is optimade, if the -p / --profile option is now specified. This will be changed in the future to use the default AiiDA profile.

You also have the opportunity to specify the AiiDA profile via the environment variable AIIDA_PROFILE. Note, however, that if a profile name is passed to the CLI, it will overrule and replace the current AIIDA_PROFILE environment variable.

```shell

Specifying AiiDA profile as an environment variable

$ export AIIDA_PROFILE=optimade $ aiida-optimade run ```

Navigate to http://localhost:5000/v1/info

Tip: To see the default AiiDA profile, type verdi profile list to find the colored profile name marked with an asterisk (*), or type verdi profile show, which will show you more detailed information about the default profile.

Note: The aiida-optimade run command has more options to configure your server, run

shell $ aiida-optimade run --help

for more information.

With Docker

Adapt profiles/test_psql_dos.json and profiles/docker-compose.yml appropriately.

shell $ docker-compose -f profiles/docker-compose.yml up --build

Navigate to http://localhost:3253/v1/info

Stop by using

shell $ docker-compose -f profiles/docker-compose.yml down

Jinja templates

If you are familiar with Jinja, there are two templates to create the JSON and YAML files: profiles/config.j2 and profiles/docker-compose.j2, respectively.

Configure the server

You can configure the server with the aiida_optimade/config.json file or set certain environment variables.

To learn more about this, see the optimade-python-tools repository.

Using AiiDA group for curated data

An AiiDA Group can be used to curate data and serve only this curated data through the OPTIMADE server. Setting the query_group option in config.json will ensure only the valid (StructureData, CifData) data nodes in the given AiiDA Group will be served. Set the query_group parameter to null (default) to serve all structure data from the database.

Design choices

Q: Why create an individual config.json file instead of just mounting an existing .aiida directory and using that directly?
A: This, currently, wouldn't work because the REPOSITORY_URI needs to point to the right path inside the container, not on the host. Furthermore, storing all configurations in the same file can be fragile.

For maintainers

To release the new version, go to GitHub release API of the repo create a new release and update the release information.
The release action will be triggered by newly created release. Note, the tag should start with a v and be followed by a full semantic version (see SemVer). For example: v2.3.12.

Owner

  • Name: AiiDA team
  • Login: aiidateam
  • Kind: organization

The development team of AiiDA

GitHub Events

Total
  • Delete event: 1
  • Issue comment event: 1
  • Pull request event: 2
  • Create event: 1
Last Year
  • Delete event: 1
  • Issue comment event: 1
  • Pull request event: 2
  • Create event: 1

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 410
  • Total Committers: 10
  • Avg Commits per committer: 41.0
  • Development Distribution Score (DDS): 0.129
Past Year
  • Commits: 8
  • Committers: 1
  • Avg Commits per committer: 8.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Casper Welzel Andersen c****n@e****h 357
dependabot[bot] 4****] 25
The AiiDA Team d****s@a****t 7
Jusong Yu j****u@g****m 6
Leopold Talirz l****z@g****m 5
Kristjan Eimre e****k 5
Carl Simon Adorf c****f@g****m 2
dependabot-preview[bot] 2****] 1
Tim Hatch t****m@t****m 1
Giovanni Pizzi g****z@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 12 months ago

All Time
  • Total issues: 16
  • Total pull requests: 204
  • Average time to close issues: 3 months
  • Average time to close pull requests: 10 days
  • Total issue authors: 3
  • Total pull request authors: 4
  • Average comments per issue: 0.5
  • Average comments per pull request: 1.26
  • Merged pull requests: 167
  • Bot issues: 0
  • Bot pull requests: 129
Past Year
  • Issues: 0
  • Pull requests: 15
  • Average time to close issues: N/A
  • Average time to close pull requests: 18 days
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.6
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 13
Top Authors
Issue Authors
  • CasperWA (12)
  • unkcpz (2)
  • eimrek (2)
Pull Request Authors
  • dependabot[bot] (152)
  • CasperWA (80)
  • unkcpz (6)
  • eimrek (4)
Top Labels
Issue Labels
CI (9) bug (7) dependencies (4) enhancement (4) github_actions (2) Tests (1) python (1)
Pull Request Labels
dependencies (208) CI (92)

Dependencies

requirements_dev.txt pypi
  • invoke * development
  • pre-commit * development
  • pylint * development
requirements_testing.txt pypi
  • codecov * test
  • pgtest * test
  • pytest * test
  • pytest-cov * test
.github/workflows/cd_release.yml actions
  • CasperWA/push-protected v2 composite
  • CharMixer/auto-changelog-action v1 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • ad-m/github-push-action master composite
  • pypa/gh-action-pypi-publish master composite
.github/workflows/ci_automerge_dependabot.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • ad-m/github-push-action master composite
.github/workflows/ci_dependabot.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • chuhlomin/render-template v1.6 composite
  • peter-evans/create-pull-request v4 composite
.github/workflows/ci_tests.yml actions
  • CasperWA/check-sdist-action v1 composite
  • Materials-Consortia/optimade-validator-action v2 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite
  • mongo 4 docker
  • postgres 12 docker
.github/workflows/ci_updated_default_branch.yml actions
  • CasperWA/push-protected v2 composite
  • actions/checkout v3 composite
Dockerfile docker
  • python 3.9 build
profiles/docker-compose-mongo.yml docker
  • mongo 4
requirements.txt pypi
  • aiida-core *
  • fastapi ==0.86.0
  • optimade *
  • pymatgen >=2019.7.2,<=2022.1.9,
  • uvicorn *
profiles/docker-compose.yml docker
setup.py pypi