Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

sphuber
Copy link
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 nmounet and giovannipizzi 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