Skip to content

Commit

Permalink
fix new parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
touv committed Jul 26, 2024
1 parent c603f79 commit 79ef128
Showing 1 changed file with 28 additions and 16 deletions.
44 changes: 28 additions & 16 deletions workers/loaders/query-openalex.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [email protected]

; 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

Expand All @@ -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 = [email protected]
path = mailto
value = env('mailto')

path = cursor
value = *
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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/', '')

Expand All @@ -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)

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()

0 comments on commit 79ef128

Please sign in to comment.