Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nomad-FAIR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nomad-lab
nomad-FAIR
Commits
a2cef69a
Commit
a2cef69a
authored
3 years ago
by
Markus Scheidgen
Browse files
Options
Downloads
Patches
Plain Diff
Clean API user metadata.
parent
df4515a1
Branches
Branches containing commit
Tags
Tags containing commit
3 merge requests
!530
Draft: Resolve "Workflow search"
,
!497
Merge for release v0.10.11
,
!493
Clean API user metadata.
Pipeline
#118132
passed
3 years ago
Stage: build
Stage: test
Stage: release
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
nomad/datamodel/__init__.py
+1
-1
1 addition, 1 deletion
nomad/datamodel/__init__.py
nomad/search.py
+15
-0
15 additions, 0 deletions
nomad/search.py
tests/app/v1/routers/test_entries.py
+3
-0
3 additions, 0 deletions
tests/app/v1/routers/test_entries.py
with
19 additions
and
1 deletion
nomad/datamodel/__init__.py
+
1
−
1
View file @
a2cef69a
...
...
@@ -92,7 +92,7 @@ from .ems import EMSMetadata
from
.qcms
import
QCMSMetadata
from
.datamodel
import
(
Dataset
,
User
,
Author
,
EditableUserMetadata
,
UserProvidableMetadata
,
OasisMetadata
,
MongoMetadata
,
EntryMetadata
,
EntryArchive
)
MongoMetadata
,
EntryMetadata
,
EntryArchive
,
user_reference
,
author_reference
)
from
.optimade
import
OptimadeEntry
,
Species
from
.metainfo
import
m_env
...
...
This diff is collapsed.
Click to expand it.
nomad/search.py
+
15
−
0
View file @
a2cef69a
...
...
@@ -43,6 +43,11 @@ _entry_metadata_defaults = {
if
quantity
.
default
not
in
[
None
,
[],
False
,
0
]
}
_all_author_quantities
=
[
quantity
.
name
for
quantity
in
datamodel
.
EntryMetadata
.
m_def
.
all_quantities
.
values
()
if
quantity
.
type
in
[
datamodel
.
user_reference
,
datamodel
.
author_reference
]]
def
_es_to_entry_dict
(
hit
,
required
:
MetadataRequired
)
->
Dict
[
str
,
Any
]:
'''
...
...
@@ -61,6 +66,16 @@ def _es_to_entry_dict(hit, required: MetadataRequired) -> Dict[str, Any]:
entry_dict
[
key
]
=
value
for
author_quantity
in
_all_author_quantities
:
authors
=
entry_dict
.
get
(
author_quantity
)
if
authors
is
None
:
continue
if
isinstance
(
authors
,
dict
):
authors
=
[
authors
]
for
author
in
authors
:
if
'
email
'
in
author
:
del
(
author
[
'
email
'
])
return
entry_dict
...
...
This diff is collapsed.
Click to expand it.
tests/app/v1/routers/test_entries.py
+
3
−
0
View file @
a2cef69a
...
...
@@ -227,6 +227,9 @@ def assert_entry_metadata(response_json):
if
'
required
'
not
in
response_json
:
assert
'
license
'
in
entry
if
'
uploader
'
in
entry
:
assert
'
email
'
not
in
entry
[
'
uploader
'
]
def
assert_entries_metadata_response
(
response
,
status_code
=
None
):
response_json
=
assert_entries_raw_metadata_response
(
response
,
status_code
=
status_code
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment