From 79ef1287340008c31b5dc624c65bb4f54ce3fc22 Mon Sep 17 00:00:00 2001 From: Nicolas Thouvenin Date: Fri, 26 Jul 2024 16:18:04 +0200 Subject: [PATCH] fix new parameter --- workers/loaders/query-openalex.ini | 44 +++++++++++++++++++----------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/workers/loaders/query-openalex.ini b/workers/loaders/query-openalex.ini index 202193ff5..6bb070ba7 100644 --- a/workers/loaders/query-openalex.ini +++ b/workers/loaders/query-openalex.ini @@ -6,26 +6,35 @@ #### Enfin l'instruction [C] permet de retirer les notices récupérées par erreur. Il est nécessaire d'annuler cette instruction dans un premier temps, afin de pouvoir tester #### la validité des regex et de connaître les mauvaises affiliations. Les champs "inist_filtered_raw_affiliation_strings" [A] et "inist_filtered_and_tested_raw_affiliation_strings" [B] #### sont ensuite supprimés. Ils peuvent être conservés en les enlevant du tableau dans l'instruction [F]. +#### +#### OpenAlex favorise les utilisations de son API qui déclare une adresse mail. +#### Renseignez votre adresse mail en ligne [G] append = pack label = query-openalex extension = json mimeType = application/json -# load some plugins to activate some statements [use] plugin = conditor plugin = basics plugin = analytics -# Toggle ezs traces (see server stderr log) [debug] -ezs = true +ezs = false -# {{{ [TXTConcat] [env] +; [G] to get more about mailto see https://docs.openalex.org/how-to-use-the-api/rate-limits-and-authentication#the-polite-pool +path = mailto +value = you@example.com + +; before change see https://docs.openalex.org/how-to-use-the-api/get-lists-of-entities/paging +path = per-page +value = 200 + +; before change see https://docs.openalex.org/api-entities/works path = url value = https://api.openalex.org/works @@ -36,13 +45,11 @@ value = self().trim() path = filter value = env('query') -; see https://docs.openalex.org/how-to-use-the-api/get-lists-of-entities/paging path = per-page -value = 200 +value = env('per-page') -; https://docs.openalex.org/how-to-use-the-api/rate-limits-and-authentication#the-polite-pool -;path = mailto -;value = you@example.com +path = mailto +value = env('mailto') path = cursor value = * @@ -61,6 +68,9 @@ value = env('query') path = cursor value = get('meta.next_cursor') +path = per-page +value = env('per-page') + [loop/URLRequest] url = env('url') timeout = 60000 @@ -88,7 +98,8 @@ value = env('query').thru(string => string.match(/i\d+/)).toUpper() # {{{ On retire les notices non pertinentes en raison d'erreurs d'affiliations d'OpenAlex. # Exemple pour le laboratoire GANIL -#[A] On récupère dans un premier temps les adresses originales qu'OpenALex a identifié comme relevant du laboratoire requêté. +# [A] On récupère dans un premier temps les adresses originales qu'OpenALex a identifié comme relevant du laboratoire requêté. +# #[assign] #path = inist_filtered_raw_affiliation_strings #value = get("authorships").filter(obj => obj.institutions.some(obj => obj.id === `https://openalex.org/${self.lodexStamp.queryIdentifier}`)).flatMap(obj => obj.raw_affiliation_strings) @@ -98,13 +109,13 @@ value = env('query').thru(string => string.match(/i\d+/)).toUpper() path = inist_filtered_and_tested_raw_affiliation_strings value = get("inist_filtered_raw_affiliation_strings").some(item => /ganil/i.test(item) || /grand acc.*national.*ions.*lourds/i.test(item) || /Large heavy ion Nat.*acc.*/i.test(item)) -#[C] Enfin on supprime les notices non pertinentes. +# [C] Enfin on supprime les notices non pertinentes. #[remove] #test = get("inist_filtered_and_tested_raw_affiliation_strings").isEqual(false) # }}} [assign] -#[D] +# [D] path = uri value = get('id').replace('https://openalex.org/', '') @@ -123,7 +134,7 @@ value = get('keywords').map('display_name') path = author_name value = get('authorships').map("author.display_name") -#[E] On récupère uniquement les auteurs du laboratoire requêté. +# [E] On récupère uniquement les auteurs du laboratoire requêté. path = inist_filtered_author_name value = get("authorships").filter(obj => obj.institutions.some(obj => obj.id === `https://openalex.org/${self.lodexStamp.queryIdentifier}`)).flatMap(obj => obj.author.display_name) @@ -181,8 +192,8 @@ value = get("inist_iso2").map(d => new Intl.DisplayNames(['FR'], { type: 'region # On récupère un tableau d'objets, puis on itère sur chaque objet avec un template string pour en faire une chaîne de caractères. # Chaque chaîne est préfixée par "Goal", on récupère ensuite les derniers chiffres de la variable "id" qui correspond au numéro du goal. # On ajoute enfin la variable "display_name" qui est le nom du goal. -path=inist_sustainable_development_goals -value=get("sustainable_development_goals").map( item => `Goal ${item.id.match(/\/sdg\/(\d+)/)[1]} : ${item.display_name}`).thru(arr => _.isEmpty(arr) ? ["No sustainable development goal"] : arr) +path = inist_sustainable_development_goals +value = get("sustainable_development_goals").map( item => `Goal ${item.id.match(/\/sdg\/(\d+)/)[1]} : ${item.display_name}`).thru(arr => _.isEmpty(arr) ? ["No sustainable development goal"] : arr) path = inist_funder_display_name value = get("grants").map("funder_display_name").uniq() @@ -267,9 +278,10 @@ separator = fix('.') reverse = true safe = true -# Uncomment to see each data sent to the database +# Uncomment to see in server logs, each data sent to the database #[debug] [assign] path = uri value = get('uri').trim() +