Look up PubMed IDs in batches of 200
https://forums.zotero.org/discussion/comment/440245/#Comment_440245
This commit is contained in:
parent
fcc68d6d80
commit
af91173734
1 changed files with 17 additions and 0 deletions
|
@ -81,6 +81,23 @@ var Zotero_Lookup = new function () {
|
|||
|
||||
toggleProgress(true);
|
||||
|
||||
// Group PubMed IDs into batches of 200
|
||||
//
|
||||
// Up to 10,000 ids can apparently be passed in a single request, but 200 is the recommended
|
||||
// limit for GET, which we currently use, and passing batches of 200 seems...fine.
|
||||
//
|
||||
// https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.id
|
||||
if (identifiers.length && identifiers[0].PMID) {
|
||||
let chunkSize = 200;
|
||||
let newIdentifiers = [];
|
||||
for (let i = 0; i < identifiers.length; i += chunkSize) {
|
||||
newIdentifiers.push({
|
||||
PMID: identifiers.slice(i, i + chunkSize).map(x => x.PMID)
|
||||
});
|
||||
}
|
||||
identifiers = newIdentifiers;
|
||||
}
|
||||
|
||||
let newItems = [];
|
||||
for (let identifier of identifiers) {
|
||||
let translate = new Zotero.Translate.Search();
|
||||
|
|
Loading…
Add table
Reference in a new issue