Newer
Older
web-services / bibliographic-enrichment / v1 / unpaywall / is_oa.ini
@Nicolas Thouvenin Nicolas Thouvenin on 14 Jun 2021 1 KB import legacy ws
# Necessary plugins
[use]
plugin = basics
plugin = analytics
plugin = storage

# Flow configuration
[JSONParse]
separator = *

[env]
path = size
value = 10

path = indent
value = true


# Pour traiter par lot on groupe puis on utilise spawn qui crée un buffer par lot
[group]
size = env('size')

[spawn]
[spawn/ungroup]
[spawn/bufferize]

# 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
persistent = true

[spawn/combine/group]
size = env('size')

[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('{getDataUPW(dois:[', self.dois, ']){doi, is_oa}}').join('')

[spawn/combine/URLStream]
url = https://unpaywall.inist.fr/graphql
path = data.getDataUPW.*
timeout = 5000
noerror = true

# On supprime les réponses qui n'ont pas abouties (
[spawn/combine/drop]
path = is_oa

# On créé l'object attendu par combine { id, value } pour faire le mapping
[spawn/combine/replace]
path = id
value = get('doi')

path = value
value = get('is_oa', 'n/a')

# 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)

[dump]
indent = env('indent')