-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement workaround for single output format limitation of MPDS API
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
- Loading branch information
Showing
2 changed files
with
117 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters