Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
5bee735e
Commit
5bee735e
authored
Apr 16, 2021
by
Markus Scheidgen
Browse files
Added support for latest optimade features.
parent
3703f744
Pipeline
#99792
passed with stages
in 25 minutes
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
=
0 → 100644
View file @
5bee735e
============================= test session starts ==============================
platform darwin -- Python 3.7.7, pytest-3.10.0, py-1.10.0, pluggy-0.13.1 -- /Users/markus/Documents/Projects/nomad-fairdi/.pyenv/bin/python
cachedir: .pytest_cache
rootdir: /Users/markus/Documents/Projects/nomad-fairdi/tests, inifile: pytest.ini
plugins: celery-4.4.7, cov-2.7.1, timeout-1.4.2
collecting ...
========================= no tests ran in 0.01 seconds =========================
nomad/app/optimade/filterparser.py
View file @
5bee735e
...
...
@@ -17,7 +17,7 @@
#
from
typing
import
Dict
from
elasticsearch_dsl
import
Q
from
elasticsearch_dsl
import
Q
,
Date
from
cachetools
import
cached
from
optimade.filterparser
import
LarkParser
...
...
@@ -49,6 +49,8 @@ def _get_transformer(nomad_properties, without_prefix):
quantities
[
'id'
]
=
Quantity
(
'id'
,
es_field
=
'calc_id'
)
quantities
[
'immutable_id'
]
=
Quantity
(
'immutable_id'
,
es_field
=
'calc_id'
)
quantities
[
'last_modified'
]
=
Quantity
(
'last_modified'
,
es_field
=
'upload_time'
,
elastic_mapping_type
=
Date
)
quantities
[
'elements'
].
length_quantity
=
quantities
[
'nelements'
]
quantities
[
'elements'
].
has_only_quantity
=
Quantity
(
name
=
'only_atoms'
)
...
...
nomad/datamodel/optimade.py
View file @
5bee735e
...
...
@@ -240,6 +240,7 @@ class OptimadeEntry(MSection):
species_at_sites
=
Quantity
(
type
=
str
,
shape
=
[
'nsites'
],
links
=
optimade_links
(
'h.6.2.12'
),
a_search
=
Search
(),
a_optimade
=
Optimade
(
query
=
False
,
entry
=
True
,
sortable
=
False
,
type
=
'list'
),
description
=
'''
Name of the species at each site (where values for sites are specified with the same
order of the cartesian_site_positions property). The properties of the species are
...
...
tests/app/flask/utils.py
View file @
5bee735e
...
...
@@ -18,6 +18,7 @@
from
typing
import
List
import
numpy
as
np
import
datetime
from
nomad
import
processing
,
files
from
nomad.datamodel
import
EntryMetadata
,
MongoMetadata
,
EntryArchive
...
...
@@ -102,7 +103,8 @@ class Upload():
entry_metadata
.
m_update
(
domain
=
'dft'
,
upload_id
=
self
.
upload_id
,
calc_id
=
'test_calc_id_%d'
%
id
,
mainfile
=
'test_mainfile'
,
published
=
True
,
processed
=
True
,
with_embargo
=
False
)
mainfile
=
'test_mainfile'
,
published
=
True
,
processed
=
True
,
with_embargo
=
False
,
upload_time
=
datetime
.
datetime
.
now
())
entry_metadata
.
apply_domain_metadata
(
archive
)
...
...
tests/app/test_optimade.py
View file @
5bee735e
...
...
@@ -60,7 +60,7 @@ def example_structures(elastic_infra, mongo_infra, raw_files_infra):
upload
.
create_test_structure
(
1
,
2
,
1
,
[],
0
)
upload
.
create_test_structure
(
2
,
2
,
1
,
[
'C'
],
0
)
upload
.
create_test_structure
(
3
,
2
,
1
,
[],
1
)
upload
.
create_test_structure
(
4
,
1
,
1
,
[],
0
)
upload
.
create_test_structure
(
4
,
1
,
1
,
[],
0
,
metadata
=
dict
(
upload_time
=
'1978-04-08T10:10:00Z'
)
)
upload
.
create_upload_files
()
search
.
refresh
()
...
...
@@ -126,7 +126,9 @@ def example_structures(elastic_infra, mongo_infra, raw_files_infra):
(
'nelements LENGTH = 1'
,
-
1
),
(
'LENGTH nelements = 1'
,
-
1
),
(
'chemical_formula_anonymous starts with "A"'
,
-
1
),
(
'elements HAS ONY "H", "O"'
,
-
1
)
(
'elements HAS ONY "H", "O"'
,
-
1
),
(
'last_modified >= "2009-02-01T20:07:00Z"'
,
3
),
(
'species_at_sites HAS "C"'
,
1
)
])
def
test_optimade_parser
(
example_structures
,
query
,
results
):
if
results
>=
0
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment