# npx ezs 02-download.ini
append = pack
[use]
plugin = basics
plugin = conditor
[TXTConcat]
[replace]
path = q
value = self().trim()
[CORHALFetch]
url = https://corhal-api.inist.fr
retries = 3
timeout = 60000
[assign]
# Récupère electronicPublicationDate et publicationDate
# Prend la plus ancienne (= la plus petite)
# Ne garde que l'année
path = ApilPublicationDate
value = get("host.electronicPublicationDate", "9999") \
.castArray() \
.concat(_.get(self, "host.publicationDate", "9999")) \
.min().toString() \
.thru(str => str.substring(0,4))
[assign]
path = ApilFinancement
value = get('funders').castArray().filter(Boolean).thru(arr => Boolean(arr.length))
# Quand les RNSR ne sont pas fournis dans authors.*.affiliations.*.rnsr
# on utilise les enrichissements et on les met au même niveau dans ApilRnsr
[map]
path = authors
[map/map]
path = affiliations
[map/map/assign]
path = ApilRnsr1
value = get("rnsr")
[map/map/swing]
test = get("ApilRnsr1").isEmpty()
[map/map/swing/assign]
path = ApilRnsr
value = get("enrichments.rnsr", []) \
.filter(rnsr => !["200612821P", "200018571R", "199812965F", "201523784S"].includes(rnsr))
# On rassemble tous les RNSR au niveau de la notice (ceux en provenance de
# authors.*.rnsr et ceux en provenance de authors.*.affiliations.*)
# dans allAuthorsRnsr
[assign]
path=ApilRnsr2
value= get("authors").map("rnsr").flatten()
[assign]
path = allApilRnsr1
; value= get("authors").map("affiliations").map("ApilRnsr1")
value= get("authors").flatMap("affiliations").flatMap("ApilRnsr1")
[assign]
path= ApilRnsr
value= get("allApilRnsr1").concat(self.ApilRnsr2).compact().uniq()
# Garde un identifiant
[assign]
path = sourceUidChain
value = get("business.sourceUidChain")
#On ajoute un objet pour attribuer 'OA - Inconnu' aux null ou undefined
path = enrichments.openAccess.unpaywall.oaLocations
value = get("enrichments.openAccess.unpaywall.oaLocations",[{"hostType":"OA - Inconnu"}])
# Supprime les champs inutiles pour les études bibliométriques
[exchange]
value = omit(['business','origins','technical','allApilRnsr1','ApilRnsr2'])