Skip to content

Implement the DbImporter for the MPDS API (Pauling file)#1238

Merged
sphuber merged 2 commits into
aiidateam:workflowsfrom
sphuber:fix_1237_implement_mpds_dbimporter
Mar 7, 2018
Merged

Implement the DbImporter for the MPDS API (Pauling file)#1238
sphuber merged 2 commits into
aiidateam:workflowsfrom
sphuber:fix_1237_implement_mpds_dbimporter

Conversation

@sphuber
Copy link
Copy Markdown
Contributor

@sphuber sphuber commented Mar 7, 2018

Fixes #1237

The MPDS API only supports a single output format for a query. Either
the result of the query is returned as a 'json' object or the result
is a concatenation of string formatted cif files. To import CifData
nodes, however, we need both the json object to retrieve the required
source information, but we also need the raw cif file, as we do not
want to reconstruct the structure or cif ourselves from the basic
structural data that is provided in the json. As a workaround, we
fire the exact same query twice, once asking the result in the json
format and the other in the cif format. We add the cif string to the
json result entries by cross referencing the source id that is present
in both the json entry and the raw cif string. A special MpdsCifEntry
will then use that cif string to directly set the contents attribute.
This will then prevent a separate HTTP request to the source uri to
retrieve the cif content, which would also result in a 429 HTTP error
due to too many requests being fired

@sphuber sphuber requested review from giovannipizzi and nmounet March 7, 2018 15:37
nmounet
nmounet previously approved these changes Mar 7, 2018
@sphuber sphuber force-pushed the fix_1237_implement_mpds_dbimporter branch from 2c4fd55 to 67c9a12 Compare March 7, 2018 16:17
sphuber added 2 commits March 7, 2018 17:50
The MPDS API only supports a single output format for a query. Either
the result of the query is returned as a 'json' object or the result
is a concatenation of string formatted cif files. To import CifData
nodes, however, we need both the json object to retrieve the required
source information, but we also need the raw cif file, as we do not
want to reconstruct the structure or cif ourselves from the basic
structural data that is provided in the json. As a workaround, we
fire the exact same query twice, once asking the result in the json
format and the other in the cif format. We add the cif string to the
json result entries by cross referencing the source id that is present
in both the json entry and the raw cif string. A special MpdsCifEntry
will then use that cif string to directly set the contents attribute.
This will then prevent a separate HTTP request to the source uri to
retrieve the cif content, which would also result in a 429 HTTP error
due to too many requests being fired
@sphuber sphuber force-pushed the fix_1237_implement_mpds_dbimporter branch from 67c9a12 to fd2034b Compare March 7, 2018 16:50
@sphuber sphuber merged commit 57c117f into aiidateam:workflows Mar 7, 2018
@sphuber sphuber deleted the fix_1237_implement_mpds_dbimporter branch March 7, 2018 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants