diff --git a/biblio-tools/examples.http b/biblio-tools/examples.http index ec8a313..50636d6 100644 --- a/biblio-tools/examples.http +++ b/biblio-tools/examples.http @@ -1,6 +1,6 @@ # To test locally, replace with -# @baseUrl = http://localhost:31976 -@baseUrl = https://biblio-tools.services.inist.fr +@baseUrl = http://localhost:31976 +#@baseUrl = https://biblio-tools.services.inist.fr # unpaywall/is_oa POST {{baseUrl}}/v1/unpaywall/is_oa?indent=true HTTP/1.1 @@ -11,6 +11,8 @@ { "value": "10.1007/s10980-018-0699-8" }, { "value": "10.1159/000490004" }, { "value": "10.1016/j.memsci.2018.08.024"}, + { "value": "10.1029/2018jd029272"}, + { "value": "10.4000/edc.9014"}, { "value": "unknown"} ] ### @@ -27,6 +29,7 @@ { "value": "10.1159/000490004" }, { "value": "10.1016/j.memsci.2018.08.024"}, { "value": "10.1029/2018jd029272"}, + { "value": "10.4000/edc.9014"}, { "value": "unknown"} ] ### diff --git a/biblio-tools/v1/crossref/works/expand.ini b/biblio-tools/v1/crossref/works/expand.ini index 6d873d9..d696ee7 100644 --- a/biblio-tools/v1/crossref/works/expand.ini +++ b/biblio-tools/v1/crossref/works/expand.ini @@ -18,69 +18,81 @@ post.parameters.0.name = indent post.parameters.0.schema.type = boolean - # Necessary plugins [use] plugin = basics -plugin = analytics -plugin = storage # Flow configuration [JSONParse] separator = * -[expand] -path = value -size = 10 -cacheName = post-v1-crossref-works-expand +# Quelques paramètres modifiables si besoin +[env] +path = size +value = 10 -[expand/bufferize] +path = indent +value = true -[expand/combine] -path = env('path', 'value') -primer = get('bufferID') -prepend = buffers -append = transit +# Début du traitement par lot +[group] +size = env('size') -[expand/combine/exchange] -value = get('value') - -[expand/combine/group] -size = 100 - -[expand/combine/replace] -path = rows +# Création d'une requete avec une liste d'identifiants +[replace] +path = output.0.rows value = fix(self.length) -path = filter -value = self().filter(x => x.match(/^10.\d{4,9}\/[^\s]+$/i)).map(x => 'doi:'.concat(x)).join(',') -# see https://github.com/CrossRef/rest-api-doc#api-overview -[expand/combine/URLStream] -url = https://api.crossref.org/works -path = .items.* -timeout = 30000 +path = output.0.filter +value = self().map('value').filter(x => x.match(/^10.\d{4,9}\/[^\s]+$/i)).map(x => 'doi:'.concat(x)).join(',') -; Simplification de la structure à postriori (le faire à priori était également possible) -[expand/combine/exchange] -value = self().omit(['indexed', 'reference']) - - -[expand/combine/OBJFlatten] - - -[expand/combine/replace] -path = id -value = get('DOI') -path = value +path = input value = self() -# On nettoie l'objet en supprimant les champs temporaires -[expand/exchange] -value = self().omit('bufferID') +[map] +path = output -[assign] +# Envoi de la requete +[map/URLStream] +# see https://github.com/CrossRef/rest-api-doc#api-overview +url = https://api.crossref.org/works +path = .items.* +json = true +timeout = 30000 +retries = 3 +noerror = false + +[map/OBJFlatten] + +# Création d'un objet similaire à l'objet reponse +[map/replace] +path = __id +value = get('doi.0') + path = value -value = get('value.value', 'n/a') +value = self().omit(['indexed', 'reference']) + +# Reformatage des DOIS (input) +[map] +path = input + +[map/replace] +path = __id +value = get('value') + +path = value +value = get('value') + +# Croissements des resultats et des dois (avec le champ __id comme clé) +[exchange] +value = get('output').unionBy(self.input, '__id') + +# Fin du traitement par lot +[ungroup] + +# Suppression des champs ajoutés +[exchange] +value = self().omit('__id') # On marque les réponses qui n'ont pas abouties [swing] @@ -91,6 +103,6 @@ path = value value = fix('n/a') - [dump] indent = env('indent', false) + diff --git a/biblio-tools/v1/istex/works/expand.ini b/biblio-tools/v1/istex/works/expand.ini index 808fe5a..9f6a60c 100644 --- a/biblio-tools/v1/istex/works/expand.ini +++ b/biblio-tools/v1/istex/works/expand.ini @@ -18,82 +18,102 @@ post.parameters.0.name = indent post.parameters.0.schema.type = boolean - # Necessary plugins [use] plugin = basics -plugin = analytics -plugin = storage # Flow configuration [JSONParse] separator = * -[bufferize] - -[combine] -path = env('path', 'value') -primer = get('bufferID') -prepend = buffers -append = transit -cacheName = post-v1-crossref-works-expand - -[combine/exchange] -value = get('value') - -[combine/group] -size = 2 - -[combine/replace] +# Quelques paramètres modifiables si besoin +[env] path = size -value = fix(self.length) +value = 10 -path = q -value = self().map(doi => `"${doi}"`).join(' ').prepend('doi.raw:(').append(')') +path = indent +value = true -path = rankBy +# Début du traitement par lot +[group] +size = env('size') + +# Création d'une requete avec une liste d'identifiants +[replace] +path = output.0.q +value = self().map('value').filter(Boolean).map(JSON.stringify).join(' ').thru(allIdentifiers => `doi.raw:(${allIdentifiers})`) + +path = output.0.rankBy value = qualityOverRelevance -path = sid +path = output.0.sid value = bibilo-tools -path = total +path = output.0.total value = 0 -path = queryType +path = output.0queryType value = querywithARK -path = output +path = output.0.output value = * -[combine/URLStream] -url = https://api.istex.fr/document/ +path = input +value = self() + +[map] +path = output + +# Envoi de la requete +[map/URLStream] +url = https://api.istex.fr/document/ +json = true path = .hits.* timeout = 30000 -noerrors = true +retries = 3 +noerror = false -; Simplification de la structure à postriori (le faire à priori était également possible) -[combine/exchange] +[map/OBJFlatten] + +# Création d'un objet similaire à l'objet reponse +[map/replace] +path = __id +value = get('doi.0') + +path = value value = self().omit(['refBibs', 'enrichments', 'metadata', 'fulltext', 'annexes', 'covers']) +# Reformatage des DOIS (input) +[map] +path = input -[combine/OBJFlatten] +[map/replace] +path = __id +value = get('value') -[combine/replace] -path = id -value = get('doi.0') path = value -value = self().omit('refBibs') +value = get('value') -# On nettoie l'objet en supprimant les champs temporaires +# Croissements des resultats et des dois (avec le champ __id comme clé) [exchange] -value = self().omit('bufferID') +value = get('output').unionBy(self.input, '__id') -[assign] +# Fin du traitement par lot +[ungroup] + + +# Suppression des champs ajoutés +[exchange] +value = self().omit('__id') + +# On marque les réponses qui n'ont pas abouti +[swing] +test = has('value.arkIstex') +reverse = true + +[swing/assign] path = value -value = get('value.value', 'n/a') - - +value = fix('n/a') # On marque les réponses qui n'ont pas abouties [swing] test = has('value.doi') diff --git a/biblio-tools/v1/unpaywall/corhal.ini b/biblio-tools/v1/unpaywall/corhal.ini index 549928b..0bebe13 100644 --- a/biblio-tools/v1/unpaywall/corhal.ini +++ b/biblio-tools/v1/unpaywall/corhal.ini @@ -18,16 +18,18 @@ post.parameters.0.name = indent post.parameters.0.schema.type = boolean +# Rétablissons la coloration syntaxique (une ou deux apostrophes selon les besoins): ' +value = fix('').join('') + # Necessary plugins [use] plugin = basics -plugin = analytics -plugin = storage # Flow configuration [JSONParse] separator = * +# Quelques paramètres modifiables si besoin [env] path = size value = 10 @@ -38,80 +40,72 @@ path = token value = env('UNPAYWALL_API_KEY') +# Passage des doi en minuscule pour être compatible unpaywall [assign] path = value value = get('value').toLower() -# Pour traiter par lot on groupe puis on utilise spawn qui crée un buffer par lot +# Début du traitement par lot [group] size = env('size') -[spawn] -[spawn/ungroup] -[spawn/bufferize] +# Création d'une requete graphql avec une liste de DOI +[replace] +path = output.0.query +value = self().map('value').map(x => JSON.stringify(x)).join(',').thru(allIdentifiers => `{GetByDOI(dois:[${allIdentifiers}]){doi,is_oa,oa_status,has_repository_copy,oa_locations{host_type,is_best,license,url,url_for_landing_page,url_for_pdf,version}}}`) -# On réalise un mapping dynamique sur le champ value (et on sauvegarde les correspondances trouvées) -[spawn/combine] -path = value -default = n/a -primer = get('bufferID') -prepend = buffers -append = transit -#cacheName = post-v1-unpaywall-corhal +path = input +value = self() -[spawn/combine/group] -size = env('size') +[map] +path = output -[spawn/combine/replace] -path = dois -value = self().map('value').map(x => JSON.stringify(x)).join(',') - -# On crée un objet contenant tous les valeurs nécessaire pour créer une requete -[spawn/combine/replace] -path = query -value = fix('{GetByDOI(dois:[', self.dois, ']){doi,is_oa,oa_status,has_repository_copy,oa_locations{host_type,is_best,license,url,url_for_landing_page,url_for_pdf,version}}}').join('') - -text = graphql.input -[spawn/combine/URLStream] -;url = https://unpaywall.inist.fr/api/graphql +# Envoi de la requete +[map/URLStream] url = http://vpunpaywallmir.intra.inist.fr:59700/api/graphql header = env('token').prepend('x-api-key:') path = data.GetByDOI.* timeout = 30000 +retries = 3 noerror = false -# On supprime les réponses qui n'ont pas abouties -[spawn/combine/drop] -path = is_oa +# Suppression des réponses qui n'ont pas abouties +[map/remove] +test = has('is_oa') +reverse = true -# On créé l'object attendu par combine { id, value } pour faire le mapping -[spawn/combine/replace] -path = id +# Création d'un objet réponse +[map/replace] +path = __id value = get('doi').toLower() -path = value.is_oa -value = get('is_oa') - -path = value.oa_status -value = get('oa_status') - -path = value.has_repository_copy -value = get('has_repository_copy') - -path = value.oa_locations -value = get('oa_locations') - - -# On nettoie l'objet en supprimant les champs temporaires -[spawn/exchange] -value = self().omit('bufferID') - -# On simplifie la structure -[assign] path = value -value = get('value.value', self.value) +value = self() -# On marque les réponses qui n'ont pas abouties +# Reformatage des DOIS (input) +[map] +path = input + +# Création d'un objet similaire à l'objet reponse +[map/replace] +path = __id +value = get('value') + +path = value +value = self() + +# Croissements des resultats et des dois (avec le champ __id comme clé) +[exchange] +value = get('output').unionBy(self.input, '__id') + +# Fin du traitement par lot +[ungroup] + +# Suppression des champs ajoutés +[exchange] +value = self().omit('__id') + +# On marque les réponses qui n'ont pas abouti [swing] test = has('value.is_oa') reverse = true diff --git a/biblio-tools/v1/unpaywall/expand.ini b/biblio-tools/v1/unpaywall/expand.ini index 6ef6d5d..8ed8fb7 100644 --- a/biblio-tools/v1/unpaywall/expand.ini +++ b/biblio-tools/v1/unpaywall/expand.ini @@ -18,16 +18,18 @@ post.parameters.0.name = indent post.parameters.0.schema.type = boolean +# Rétablissons la coloration syntaxique (une ou deux apostrophes selon les besoins): ' +value = fix('').join('') + # Necessary plugins [use] plugin = basics -plugin = analytics -plugin = storage # Flow configuration [JSONParse] separator = * +# Quelques paramètres modifiables si besoin [env] path = size value = 10 @@ -38,54 +40,43 @@ path = token value = env('UNPAYWALL_API_KEY') +# Passage des doi en minuscule pour être compatible unpaywall [assign] path = value value = get('value').toLower() -# Pour traiter par lot on groupe puis on utilise spawn qui crée un buffer par lot +# Début du traitement par lot [group] size = env('size') -[spawn] -[spawn/ungroup] -[spawn/bufferize] +# Création d'une requete graphql avec une liste de DOI +[replace] +path = output.0.query +value = self().map('value').map(x => JSON.stringify(x)).join(',').thru(allIdentifiers => `{GetByDOI(dois:[${allIdentifiers}]){doi, is_oa, oa_status, has_repository_copy, best_oa_location { host_type }}}`) -# On réalise un mapping dynamique sur le champ value (et on sauvegarde les correspondances trouvées) -[spawn/combine] -path = value -default = n/a -primer = get('bufferID') -prepend = buffers -append = transit -#cacheName = post-v1-unpaywall-expand +path = input +value = self() -[spawn/combine/group] -size = env('size') +[map] +path = output -[spawn/combine/replace] -path = dois -value = self().map('value').map(x => JSON.stringify(x)).join(',') - -# On crée un objet contenant tous les valeurs nécessaire pour créer une requete -[spawn/combine/replace] -path = query -value = fix('{GetByDOI(dois:[', self.dois, ']){doi, is_oa, oa_status, has_repository_copy, best_oa_location { host_type }}}').join('') - -[spawn/combine/URLStream] -;url = https://unpaywall.inist.fr/api/graphql +# Envoi de la requete +[map/URLStream] url = http://vpunpaywallmir.intra.inist.fr:59700/api/graphql header = env('token').prepend('x-api-key:') path = data.GetByDOI.* -timeout = 5000 +timeout = 30000 +retries = 3 noerror = false -# On supprime les réponses qui n'ont pas abouties ( -[spawn/combine/drop] -path = is_oa +# Suppression des réponses qui n'ont pas abouties +[map/remove] +test = has('is_oa') +reverse = true -# On créé l'object attendu par combine { id, value } pour faire le mapping -[spawn/combine/replace] -path = id +# Création d'un objet réponse +[map/replace] +path = __id value = get('doi').toLower() path = value.is_oa @@ -100,15 +91,30 @@ path = value.has_repository_copy value = get('has_repository_copy', 'n/a') -# On nettoie l'objet en supprimant les champs temporaires -[spawn/exchange] -value = self().omit('bufferID') +# Reformatage des DOIS (input) +[map] +path = input -# On simplifie la structure -[assign] +# Création d'un objet similaire à l'objet reponse +[map/replace] +path = __id +value = get('value') + path = value -value = get('value.value', self.value) -# On marque les réponses qui n'ont pas abouties +value = self() + +# Croissements des resultats et des dois (avec le champ __id comme clé) +[exchange] +value = get('output').unionBy(self.input, '__id') + +# Fin du traitement par lot +[ungroup] + +# Suppression des champs ajoutés +[exchange] +value = self().omit('__id') + +# On marque les réponses qui n'ont pas abouti [swing] test = has('value.is_oa') reverse = true diff --git a/biblio-tools/v1/unpaywall/is_oa.ini b/biblio-tools/v1/unpaywall/is_oa.ini index dbbaa77..972fc4c 100644 --- a/biblio-tools/v1/unpaywall/is_oa.ini +++ b/biblio-tools/v1/unpaywall/is_oa.ini @@ -18,16 +18,18 @@ post.parameters.0.name = indent post.parameters.0.schema.type = boolean +# Rétablissons la coloration syntaxique (une ou deux apostrophes selon les besoins): ' +value = fix('').join('') + # Necessary plugins [use] plugin = basics -plugin = analytics -plugin = storage # Flow configuration [JSONParse] separator = * +# Quelques paramètres modifiables si besoin [env] path = size value = 10 @@ -38,67 +40,79 @@ path = token value = env('UNPAYWALL_API_KEY') +# Passage des doi en minuscule pour être compatible unpaywall [assign] path = value value = get('value').toLower() -# Pour traiter par lot on groupe puis on utilise spawn qui crée un buffer par lot +# Début du traitement par lot [group] size = env('size') -[spawn] -[spawn/ungroup] -[spawn/bufferize] +# Création d'une requete graphql avec une liste de DOI +[replace] +path = output.0.query +value = self().map('value').map(x => JSON.stringify(x)).join(',').thru(allIdentifiers => `{GetByDOI(dois:[${allIdentifiers}]){doi, is_oa}}`) -# On réalise un mapping dynamique sur le champ value (et on sauvegarde les correspondances trouvées) -[spawn/combine] -path = value -default = n/a -primer = get('bufferID') -prepend = buffers -append = transit -#cacheName = post-v1-unpaywall-is_oa +path = input +value = self() -[spawn/combine/group] -size = env('size') +[map] +path = output -[spawn/combine/replace] -path = dois -value = self().map('value').map(x => JSON.stringify(x)).join(',') - -# On crée un objet contenant tous les valeurs nécessaire pour créer une requete -[spawn/combine/replace] -path = query -value = fix('{GetByDOI(dois:[', self.dois, ']){doi, is_oa}}').join('') - -[spawn/combine/URLStream] -;url = https://unpaywall.inist.fr/api/graphql +# Envoi de la requete +[map/URLStream] url = http://vpunpaywallmir.intra.inist.fr:59700/api/graphql header = env('token').prepend('x-api-key:') path = data.GetByDOI.* -timeout = 5000 +timeout = 30000 +retries = 3 noerror = false -# On supprime les réponses qui n'ont pas abouties ( -[spawn/combine/drop] -path = is_oa +# Suppression des réponses qui n'ont pas abouties +[map/remove] +test = has('is_oa') +reverse = true -# On créé l'object attendu par combine { id, value } pour faire le mapping -[spawn/combine/replace] -path = id +# Création d'un objet réponse +[map/replace] +path = __id value = get('doi').toLower() path = value -value = get('is_oa', 'n/a') +value = get('is_oa') -# On nettoie l'objet en supprimant les champs temporaires -[spawn/exchange] -value = self().omit('bufferID') +# Reformatage des DOIS (input) +[map] +path = input -# On simplifie la structure -[assign] +# Création d'un objet similaire à l'objet reponse +[map/replace] +path = __id +value = get('value') + path = value -value = get('value.value', self.value) +value = self() + +# Croissements des resultats et des dois (avec le champ __id comme clé) +[exchange] +value = get('output').unionBy(self.input, '__id') + +# Fin du traitement par lot +[ungroup] + +# Suppression des champs ajoutés +[exchange] +value = self().omit('__id') + +# On marque les réponses qui n'ont pas abouti +[swing] +test = get('value').isBoolean() +reverse = true + +[swing/assign] +path = value +value = fix('n/a') [dump] indent = env('indent') diff --git a/biblio-tools/v1/unpaywall/works/expand.ini b/biblio-tools/v1/unpaywall/works/expand.ini index a6b2ada..3ed9c8c 100644 --- a/biblio-tools/v1/unpaywall/works/expand.ini +++ b/biblio-tools/v1/unpaywall/works/expand.ini @@ -19,17 +19,17 @@ post.parameters.0.schema.type = boolean # Rétablissons la coloration syntaxique (une ou deux apostrophes selon les besoins): ' +value = fix('').join('') # Necessary plugins [use] plugin = basics -plugin = analytics -plugin = storage # Flow configuration [JSONParse] separator = * +# Quelques paramètres modifiables si besoin [env] path = size value = 10 @@ -40,65 +40,71 @@ path = token value = env('UNPAYWALL_API_KEY') +# Passage des doi en minuscule pour être compatible unpaywall [assign] path = value value = get('value').toLower() -# Pour traiter par lot on groupe puis on utilise spawn qui crée un buffer par lot +# Début du traitement par lot [group] size = env('size') -[spawn] -[spawn/ungroup] -[spawn/bufferize] +# Création d'une requete graphql avec une liste de DOI +[replace] +path = output.0.query +value = self().map('value').map(x => JSON.stringify(x)).join(',').thru(allIdentifiers => `{GetByDOI(dois:[${allIdentifiers}]){doi,data_standard,genre,is_paratext,is_oa,journal_is_in_doaj,journal_is_oa,journal_issns,journal_issn_l,journal_name,oa_status,has_repository_copy,published_date,publisher,title,updated,year,oa_locations{host_type,is_best,license,url,url_for_landing_page,url_for_pdf},first_oa_location{host_type,is_best,license,pmh_id,updated,url,url_for_landing_page,url_for_pdf,version}}}`) -# On réalise un mapping dynamique sur le champ value (et on sauvegarde les correspondances trouvées) -[spawn/combine] -path = value -default = n/a -primer = get('bufferID') -prepend = buffers -append = transit -#cacheName = post-v1-unpaywall-works-expand +path = input +value = self() -[spawn/combine/group] -size = env('size') +[map] +path = output -[spawn/combine/replace] -path = dois -value = self().map('value').map(x => JSON.stringify(x)).join(',') - -# On crée un objet contenant toutes les valeurs nécessaires pour créer une requête -[spawn/combine/replace] -path = query -; value = fix('{GetByDOI(dois:[', self.dois, ']){doi, is_oa, oa_status, has_repository_copy, best_oa_location { host_type }}}').join('') -value = fix('{GetByDOI(dois:[', self.dois, ']){doi,data_standard,genre,is_paratext,is_oa,journal_is_in_doaj,journal_is_oa,journal_issns,journal_issn_l,journal_name,oa_status,has_repository_copy,published_date,publisher,title,updated,year,oa_locations{host_type,is_best,license,url,url_for_landing_page,url_for_pdf},first_oa_location{host_type,is_best,license,pmh_id,updated,url,url_for_landing_page,url_for_pdf,version}}}').join('') - -[spawn/combine/URLStream] -;url = https://unpaywall.inist.fr/api/graphql +# Envoi de la requete +[map/URLStream] url = http://vpunpaywallmir.intra.inist.fr:59700/api/graphql header = env('token').prepend('x-api-key:') path = data.GetByDOI.* -timeout = 5000 +timeout = 30000 +retries = 3 noerror = false -# On supprime les réponses qui n'ont pas abouti -[spawn/combine/drop] -path = is_oa +# Suppression des réponses qui n'ont pas abouties +[map/remove] +test = has('is_oa') +reverse = true -# On crée l'object attendu par combine { id, value } pour faire le mapping -[spawn/combine/assign] -path = id +# Création d'un objet réponse +[map/replace] +path = __id value = get('doi').toLower() -# On nettoie l'objet en supprimant les champs temporaires -[spawn/exchange] -value = self().omit('bufferID') - -# On simplifie la structure -[assign] path = value -value = get('value.value', self.value) +value = self() + +# Reformatage des DOIS (input) +[map] +path = input + +# Création d'un objet similaire à l'objet reponse +[map/replace] +path = __id +value = get('value') + +path = value +value = self() + +# Croissements des resultats et des dois (avec le champ __id comme clé) +[exchange] +value = get('output').unionBy(self.input, '__id') + +# Fin du traitement par lot +[ungroup] + +# Suppression des champs ajoutés +[exchange] +value = self().omit('__id') + # On marque les réponses qui n'ont pas abouti [swing] test = has('value.is_oa') diff --git a/biblio-tools/v1/wos/works/expand.ini b/biblio-tools/v1/wos/works/expand.ini index 62b3f74..1d542e0 100644 --- a/biblio-tools/v1/wos/works/expand.ini +++ b/biblio-tools/v1/wos/works/expand.ini @@ -18,16 +18,16 @@ post.parameters.0.name = indent post.parameters.0.schema.type = boolean + # Necessary plugins [use] -plugin = @ezs/basics -plugin = @ezs/analytics -plugin = @ezs/storage +plugin = basics # Flow configuration [JSONParse] separator = * +# Quelques paramètres modifiables si besoin [env] path = size value = 10 @@ -42,82 +42,85 @@ path = value value = get('value').toLower() -[expand] -path = value -size = env('size') -cacheName = post-v1-wos-expand -[expand/bufferize] - -# On réalise un mapping dynamique sur le champ value (et on sauvegarde les correspondances trouvées) -[expand/combine] -path = value -default = n/a -primer = get('bufferID') -prepend = buffers -append = transit - -[expand/combine/group] +# Début du traitement par lot +[group] size = env('size') -[expand/combine/replace] -path = dois -value = self().map('value').filter(Boolean).map(x => JSON.stringify(x)).join(' OR ') +# Création d'une requete avec une liste d'identifiants +[replace] +path = output.0.usrQuery +value = self().map('value').filter(Boolean).map(x => JSON.stringify(x)).join(' OR ').thru(allIdentifiers => `DO=(${allIdentifiers})`) -# On crée un objet contenant tous les valeurs nécessaire pour créer une requete -[expand/combine/replace] -path = usrQuery -value = fix('DO=(', self.dois ,')').join('') -path = databaseId +path = output.0.databaseId value = WOK -path = count + +path = output.0.count value = env('size') -path = firstRecord + +path = output.0.firstRecord value = 1 -[expand/combine/URLStream] +path = input +value = self() + +[map] +path = output + +# Envoi de la requete +[map/URLStream] url = https://wos-api.clarivate.com/api/wos/ header = env('token').prepend('X-ApiKey:') path = Data.Records.records.REC.* -timeout = 5000 -noerror = true +json = true +timeout = 30000 +retries = 3 +noerror = false -[expand/combine/OBJFlatten] +# On supprime les réponses qui n'ont pas abouties +[map/remove] +test = get('UID').isEmpty() -[expand/combine/replace] -path = id +[map/OBJFlatten] + +# Création d'un objet similaire à l'objet reponse +[map/replace] +path = __id value = get('dynamic_data/cluster_related/identifiers/identifier').find({ type: 'xref_doi'}).get('value').toLower() path = value value = self() -# On supprime de la table de mapping, les réponses qui n'ont pas abouties -[expand/combine/remove] -test = get('id').isEmpty() +# Reformatage des DOIS (input) +[map] +path = input -# On nettoie l'objet en supprimant les champs temporaires -[expand/exchange] -value = self().omit('bufferID') +[map/replace] +path = __id +value = get('value') -[expand/assign] path = value -value = get('value.value') +value = get('value') -; On supprime uniqument le résulat des documents non trouvés pour -; pour les conserver sans les mettre dans le cache -[expand/swing] -test = get('value.UID').isEmpty() -[expand/swing/exchange] -value = self().omit('value') +# Croissements des resultats et des dois (avec le champ __id comme clé) +[exchange] +value = get('output').unionBy(self.input, '__id') + +# Fin du traitement par lot +[ungroup] -; Pour les documents sans résulat -; On donne une valeur par défaut +# Suppression des champs ajoutés +[exchange] +value = self().omit('__id') + +# On marque les réponses qui n'ont pas abouties [swing] test = get('value.UID').isEmpty() + [swing/assign] path = value value = fix('n/a') - [dump] -indent = env('indent') +indent = env('indent', false) +