Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
On Thursday, 7th July from 1 to 3 pm there will be a maintenance with a short downtime of GitLab.
Open sidebar
nomad-lab
nomad-FAIR
Commits
3b9df414
Commit
3b9df414
authored
Jun 22, 2020
by
Lauri Himanen
Browse files
Cleaned up the material API route.
parent
09f99fc7
Pipeline
#77040
passed with stages
in 51 minutes and 11 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nomad/app/api/encyclopedia.py
View file @
3b9df414
...
...
@@ -122,7 +122,8 @@ class EncMaterialResource(Resource):
@
api
.
expect
(
material_query
)
@
api
.
marshal_with
(
material_result
,
skip_none
=
True
)
def
get
(
self
,
material_id
):
"""Used to retrive basic information related to the specified material.
"""Used to retrieve basic information related to the specified
material.
"""
# Parse request arguments
args
=
material_query
.
parse_args
()
...
...
@@ -138,10 +139,6 @@ class EncMaterialResource(Resource):
# information from there. In principle all other entries should have
# the same information.
s
=
Search
(
index
=
config
.
elastic
.
index_name
)
# Since we are looking for an exact match, we use filtek context
# together with term search for speed (instead of query context and
# match search)
query
=
Q
(
"bool"
,
filter
=
enc_filter
+
[
...
...
@@ -150,14 +147,14 @@ class EncMaterialResource(Resource):
)
s
=
s
.
query
(
query
)
# If a representative calculation is requested, all calculations are
# returned in order to perform the scoring with a custom loop.
# Otherwise, only one representative entry is returned.
# Only one representative entry is returned by collapsing the results.
s
=
s
.
extra
(
**
{
"_source"
:
{
"includes"
:
es_keys
},
"size"
:
1
0000
,
"size"
:
1
,
"collapse"
:
{
"field"
:
"encyclopedia.material.material_id"
},
})
print
(
"================= M QUERY =================="
)
print
(
s
.
to_dict
())
response
=
s
.
execute
()
# No such material
...
...
nomad/datamodel/encyclopedia.py
View file @
3b9df414
...
...
@@ -629,8 +629,8 @@ class EncyclopediaMetadata(MSection):
| Status | Description |
| -------------------------------- | ----------------------------------------------------------------------------- |
| `"success"` | Processed successfully |
| `"unsupported_material_type"` | The detected material type is curren
l
ty not supported by the Encyclopedia. |
| `"unsupported_calculation_type"` | The detected calculation type is curren
l
ty not supported by the Encyclopedia. |
| `"unsupported_material_type"` | The detected material type is current
l
y not supported by the Encyclopedia. |
| `"unsupported_calculation_type"` | The detected calculation type is current
l
y not supported by the Encyclopedia. |
| `"invalid_metainfo"` | The entry could not be processed due to missing or invalid metainfo. |
| `"failure"` | The entry could not be processed due to an unexpected exception. |
"""
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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