Commit efc50815 authored by David Sikter's avatar David Sikter
Browse files

Changing Calc.external_id to a list and rename it to external_ids

parent cb9e9ff1
Pipeline #112982 passed with stages
in 26 minutes and 38 seconds
......@@ -122,7 +122,7 @@ export const EntryIds = React.memo(({data}) => {
{/* <Quantity quantity="pid" label='PID' placeholder="not yet assigned" noWrap data={data} withClipboard /> */}
<Quantity quantity="calc_id" label="entry id" noWrap withClipboard data={data} />
<Quantity quantity="raw_id" label="raw id" noWrap withClipboard data={data} />
<Quantity quantity="external_id" label="external id" noWrap withClipboard data={data} />
<Quantity quantity="external_ids" label="external ids" noWrap withClipboard data={data} />
<Quantity quantity="mainfile" noWrap ellipsisFront data={data} withClipboard />
<Quantity quantity="upload_id" label="upload id" data={data} noWrap withClipboard>
<Typography style={{flexGrow: 1}}>
......@@ -272,7 +272,7 @@ export const EntryDetails = React.memo(({data}) => {
{/* <Quantity quantity="pid" label='PID' placeholder="not yet assigned" noWrap data={data} withClipboard /> */}
<Quantity quantity="calc_id" label="entry id" noWrap withClipboard data={data} />
<Quantity quantity="raw_id" label="raw id" noWrap withClipboard data={data} />
<Quantity quantity="external_id" label="external id" noWrap withClipboard data={data} />
<Quantity quantity="external_ids" label="external ids" noWrap withClipboard data={data} />
<Quantity quantity="mainfile" noWrap ellipsisFront data={data} withClipboard />
<Quantity quantity="upload_id" label="upload id" data={data} noWrap withClipboard>
<Typography style={{flexGrow: 1}}>
......
......@@ -56,10 +56,10 @@ export default function EntryQuery(props) {
let message = 'loading ...'
if (doesNotExist) {
if (queryParams && queryParams['external_id'] && queryParams['external_id'].startsWith('mp-')) {
if (queryParams && queryParams['external_ids'] && queryParams['external_ids'][0].startsWith('mp-')) {
message = <React.Fragment>
This particular calculation <Link href={`https://materialsproject.org/tasks/${queryParams['external_id']}#`}>
{queryParams['external_id']}
This particular calculation <Link href={`https://materialsproject.org/tasks/${queryParams['external_ids'][0]}#`}>
{queryParams['external_ids'][0]}
</Link> has not yet been provided to NOMAD by the Materials Project.
</React.Fragment>
} else if (api.isLoggedIn) {
......
......@@ -180,7 +180,7 @@ const OverviewView = React.memo(function OverviewView({entryId, ...moreProps}) {
</Typography>
</Quantity>
<Quantity quantity="raw_id" label='raw id' noWrap hideIfUnavailable withClipboard data={entry}/>
<Quantity quantity="external_id" label='external id' hideIfUnavailable noWrap withClipboard data={entry}/>
<Quantity quantity="external_ids" label='external ids' hideIfUnavailable noWrap withClipboard data={entry}/>
<Quantity quantity="last_processing_time" label='last processing time' placeholder="not processed" noWrap data={entry}>
<Typography noWrap>
{new Date(entry.last_processing_time).toLocaleString()}
......
......@@ -368,8 +368,8 @@ class EntryMetadata(metainfo.MSection):
NOMAD CoE. It allows to resolve URLs of the old NOMAD CoE Repository.
raw_id: The code specific identifier extracted from the entry's raw files by the parser,
if supported.
external_id: A user provided external id. Usually the id for an entry in an external
database where the data was imported from.
external_ids: A list of user provided external ids. Usually the ids for an entry in
external databases where the data was imported from.
published: Indicates if the entry is published.
publish_time: The time when the upload was published.
with_embargo: Indicated if this entry is under an embargo. Entries with embargo are
......@@ -474,11 +474,11 @@ class EntryMetadata(metainfo.MSection):
categories=[UserProvidableMetadata],
a_elasticsearch=Elasticsearch(entry_type))
external_id = metainfo.Quantity(
type=str, categories=[MongoEntryMetadata, UserProvidableMetadata],
external_ids = metainfo.Quantity(
type=str, shape=['0..*'], categories=[MongoEntryMetadata, UserProvidableMetadata],
description='''
A user provided external id. Usually the id for an entry in an external database
where the data was imported from.
A list of user provided external ids. Usually the ids for an entry in external
databases where the data was imported from.
''',
a_elasticsearch=Elasticsearch())
......
......@@ -154,8 +154,8 @@ class Calc(Proc):
mainfile: the mainfile (including path in upload) that was used to create this calc
parser_name: the name of the parser used to process this calc
pid: the legacy NOMAD pid of the entry
external_id: a user provided external id. Usually the id for an entry in an
external database where the data was imported from
external_ids: a user provided list of external ids. Usually the id for an entry in
an external database where the data was imported from
external_db: the repository or external database where the original data resides
nomad_version: the NOMAD version used for the last processing
nomad_commit: the NOMAD commit used for the last processing
......@@ -174,7 +174,7 @@ class Calc(Proc):
mainfile = StringField()
parser_name = StringField()
pid = StringField()
external_id = StringField()
external_ids = ListField(StringField(), default=None)
external_db = StringField()
nomad_version = StringField()
nomad_commit = StringField()
......
......@@ -611,7 +611,7 @@ There are three reasons: You want to manage data in private, you want local avai
Currently, NOMAD supports the following mechanism to organize data:
data always belongs to one upload, which has a main author, and is assigned various metadata, like upload create time, a custom, human friendly upload name, etc.
data can be assigned to multiple independent datasets
data can hold a proprietary id called “external_id”
data can hold a list of proprietary ids called “external_ids
data can be assigned multiple coauthors in addition to the main author
Data can be filtered and searched in various ways.
......
......@@ -553,7 +553,7 @@ def example_user_metadata(other_test_user, test_user) -> dict:
'references': ['http://external.ref/one', 'http://external.ref/two'],
'entry_coauthors': [other_test_user.user_id],
'_pid': '256',
'external_id': 'external_test_id'
'external_ids': ['external_test_id']
}
......
......@@ -611,13 +611,13 @@ def test_read_metadata_from_file(proc_infra, test_user, other_test_user, tmp):
comment='Calculation 1 of 3',
entry_coauthors=other_test_user.user_id,
references=['http://test'],
external_id='external_id_1')
external_ids=['external_id_1'])
with zf.open('examples/calc_1/nomad.yaml', 'w') as f: f.write(yaml.dump(calc_1).encode())
zf.write('tests/data/proc/templates/template.json', 'examples/calc_1/template.json')
calc_2 = dict(
comment='Calculation 2 of 3',
references=['http://ttest'],
external_id='external_id_2')
external_ids=['external_id_2'])
with zf.open('examples/calc_2/nomad.json', 'w') as f: f.write(json.dumps(calc_2).encode())
zf.write('tests/data/proc/templates/template.json', 'examples/calc_2/template.json')
zf.write('tests/data/proc/templates/template.json', 'examples/calc_3/template.json')
......@@ -627,7 +627,7 @@ def test_read_metadata_from_file(proc_infra, test_user, other_test_user, tmp):
'examples/calc_3/template.json': {
'comment': 'Calculation 3 of 3',
'references': ['http://ttest'],
'external_id': 'external_id_3'
'external_ids': ['external_id_3a', 'external_id_3b']
}
}
}
......@@ -639,7 +639,7 @@ def test_read_metadata_from_file(proc_infra, test_user, other_test_user, tmp):
calcs = sorted(calcs, key=lambda calc: calc.mainfile)
comment = ['Calculation 1 of 3', 'Calculation 2 of 3', 'Calculation 3 of 3', None]
external_ids = ['external_id_1', 'external_id_2', 'external_id_3', None]
external_ids = [['external_id_1'], ['external_id_2'], ['external_id_3a', 'external_id_3b'], None]
references = [['http://test'], ['http://ttest'], ['http://ttest'], None]
expected_entry_coauthors = [[other_test_user], [], [], []]
......@@ -647,7 +647,7 @@ def test_read_metadata_from_file(proc_infra, test_user, other_test_user, tmp):
entry_metadata = calcs[i].full_entry_metadata(upload)
assert entry_metadata.comment == comment[i]
assert entry_metadata.references == references[i]
assert entry_metadata.external_id == external_ids[i]
assert entry_metadata.external_ids == external_ids[i]
entry_coauthors = [a.m_proxy_resolve() for a in entry_metadata.entry_coauthors]
for j in range(len(entry_coauthors)):
assert entry_coauthors[j].user_id == expected_entry_coauthors[i][j].user_id
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment