diff --git a/biblio-tools/examples.http b/biblio-tools/examples.http index 38fbefc..f22340a 100644 --- a/biblio-tools/examples.http +++ b/biblio-tools/examples.http @@ -146,3 +146,15 @@ } ] ### + +# wos/works/expand +POST http://localhost:31976/v1/wos/works/expand?indent=true HTTP/1.1 +Content-Type: application/json + +[ + { "value": "10.1016/S0047-6374(98)00099-2"}, + { "value": "10.1016/S0167-4943(01)00186-8"}, + { "value": "10.1093/ageing/afm016"}, + { "value": ""} +] +### diff --git a/biblio-tools/v1/wos/works/expand.ini b/biblio-tools/v1/wos/works/expand.ini new file mode 100644 index 0000000..f6bf87d --- /dev/null +++ b/biblio-tools/v1/wos/works/expand.ini @@ -0,0 +1,110 @@ +# OpenAPI Documentation - JSON format (dot notation) +mimeType = application/json + +post.operationId = post-v1-wos-expand +post.description = Récupération des informations associées à DOI dans la base Web of Science +post.summary = Récupération à partir d'un tableau d'objets avec à minima un champ value contenant le DOI +post.tags.0 = biblio-tools +post.requestBody.content.application/json.example.0.id = 1 +post.requestBody.content.application/json.example.0.value = 10.4000/edc.9014 +post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream +post.requestBody.required = true +post.responses.default.content.application/json.example.0.id = 1 +post.responses.default.content.application/json.example.0.value = { ... } +post.responses.default.content.application/json.schema.$ref = #/components/schemas/JSONStream +post.responses.default.description = une réponse sous forme d'un objet ou n/a pour chaque DOI +post.parameters.0.description = Indenter le JSON résultant +post.parameters.0.in = query +post.parameters.0.name = indent +post.parameters.0.schema.type = boolean + +# Necessary plugins +[use] +plugin = @ezs/basics +plugin = @ezs/analytics +plugin = @ezs/storage + +# Flow configuration +[JSONParse] +legacy = false +separator = $ + +[env] +path = size +value = 10 + +path = indent +value = true + +path = token +value = env('WOS_API_KEY') + +[assign] +path = value +value = get('value').toLower() + +# 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').filter(Boolean).map(x => JSON.stringify(x)).join(' OR ') + +# On crée un objet contenant tous les valeurs nécessaire pour créer une requete +[spawn/combine/replace] +path = usrQuery +value = fix('DO=(', self.dois ,')').join('') +path = databaseId +value = WOK +path = count +value = env('size') +path = firstRecord +value = 1 + +[spawn/combine/URLStream] +url = https://wos-api.clarivate.com/api/wos/ +header = env('token').prepend('X-ApiKey:') +path = Data.Records.records.REC.* +timeout = 5000 +noerror = true + +[spawn/combine/OBJFlatten] + +[spawn/combine/replace] +path = id +value = get('dynamic_data/cluster_related/identifiers/identifier').find({ type: 'xref_doi'}).get('value').toLower() + +path = value +value = self() + +# On supprime les réponses qui n'ont pas abouties ( +[spawn/combine/drop] +path = id + +# On nettoie l'objet en supprimant les champs temporaires +[spawn/exchange] +value = self().omit('bufferID') + +[assign] +path = value +value = get('value.value', 'n/a') + +[dump] +indent = env('indent')