append = pack [use] # URLConnect plugin = basics [unpack] # Prépare la structure à envoyer au web service v1/rnsr/info [assign] path = ws.rnsr value = get("authors") \ .flatMap("affiliations") \ .map("address").uniq() \ .map((address, id) => ({ \ id, \ value: { \ year: _.get(self,"ApilPublicationDate"), \ address \ } \ })) [map] path = ws.rnsr [map/expand] path = value size = 100 [map/expand/URLConnect] url = https://affiliations-tools.services.inist.fr/v1/rnsr/info timeout = 20001 noerror = true # Récupère les informations [assign] path = ApilWsIsCnrs value = get("ws.rnsr").map("value").flatten() \ .map("etabAssoc").flatten() \ .map("etab.sigle") \ .filter(sigle => sigle === "CNRS") \ .thru(arr => Boolean(arr.length)) path = ApilWsLaboSigle value = get("ws.rnsr").map("value").flatten().map("sigle") path = ApilWsLaboIntitule value = get("ws.rnsr").map("value").flatten().map("intitule") path = tmp.Rnsr1 value = get("ws.rnsr").map("value").flatten().map("num_nat_struct") path = tmp.Rnsr2 value = get("authors").flatMap("affiliations").flatMap("rnsr") [assign] # Concatène les deux champs RNSR path = ApilWsRnsr value = get("tmp.Rnsr1").concat(_.get(self,"tmp.Rnsr2")).uniq() # Supprime les accents et met en majuscules path = tmp.ApilWsLaboIntitule value = get("ApilWsLaboIntitule") \ .map(str => str \ .normalize("NFKD").replace(/[\u0300-\u036f]/g, "") \ .toUpperCase() \ ) [assign] path = ApilWsSigleLaboIntitule value = get("ApilWsLaboSigle") \ .map((sigle,i) => [ \ sigle, \ _.get(self,"tmp.ApilWsLaboIntitule")[i] \ ] \ .filter(Boolean) \ .join(" - ")) # Récupère les instituts du CNRS à partir des RNSR [assign] path = ApilWsInstitutCnrs value = get("ApilWsRnsr").map((value, id) => ({id, value})) [map] path = ApilWsInstitutCnrs [map/expand] path = value size = 100 cacheName = 04-rnsr-instituts-cnrs-json [map/expand/URLConnect] url = https://mapping-tools.services.inist.fr/v1/rnsr/instituts-cnrs/json timeout = 10002 noerror = true [assign] path = ApilWsInstitutCnrs value = get("ApilWsInstitutCnrs").map("value") # Homogénéise les types de document [assign] path = ApilWsTypeDoc value = get("originalGenre") [expand] path = ApilWsTypeDoc size = 100 [expand/URLConnect] url = https://mapping-tools.services.inist.fr/v1/homogenize/documentType/json timeout = 20003 noerror = true # Homogénéise les sources [swing] test = has("host.title") [swing/assign] path = ApilWsSource value = get("host.title") [swing/expand] path = ApilWsSource size = 100 [swing/expand/URLConnect] url = https://mapping-tools.services.inist.fr/v1/homogenize/source/json timeout = 20004 noerror = true # Traitement des éditeurs # Si le champ host.publisher est vide [swing] test = has("host.publisher") reverse = true [swing/assign] path = ws.ApilRacineDoiPublisher value = get("doi") [swing/expand] path = ws.ApilRacineDoiPublisher size = 100 cacheName = 04-crossref-prefixes-expand [swing/expand/URLConnect] url = https://biblio-tools.services.inist.fr/v1/crossref/prefixes/expand timeout = 60005 noerror = true retries = 1 # Dans un champ temporaire, récupérer la valeur host.publisher si elle est présente, sinon récupérer celle du WS DOI. [assign] path = tmp.ApilWsPublisher value = get("host.publisher",_.get(self,"ws.ApilRacineDoiPublisher")) # Homogénéise l'éditeur [assign] path = ApilWsPublisher value = get("tmp.ApilWsPublisher") [expand] path = ApilWsPublisher size = 100 [expand/URLConnect] url = https://mapping-tools.services.inist.fr/v1/homogenize/publisher/json timeout = 20006 noerror = true # Suppression des champs non voulus [exchange] value = omit(['business','origins','technical','tmp','ws'])