diff --git a/openalex-dumps/02-download.ini b/openalex-dumps/02-download.ini index 3726ffe..1e74c09 100644 --- a/openalex-dumps/02-download.ini +++ b/openalex-dumps/02-download.ini @@ -10,7 +10,7 @@ [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 = env('mail', 'you@example.com') +value = env('mail', 'you@exemple.com') ; before change see https://docs.openalex.org/how-to-use-the-api/get-lists-of-entities/paging path = per-page diff --git a/openalex-dumps/03-enrich.ini b/openalex-dumps/03-enrich.ini index 3c3f1e6..96f65bf 100644 --- a/openalex-dumps/03-enrich.ini +++ b/openalex-dumps/03-enrich.ini @@ -79,7 +79,7 @@ ; On récupère ici un code langue, auquel on applique un constructeur Javascript, qui verbalise et traduit le code. "fr" devient "français". path = language -value = get("language").thru(d => new Intl.DisplayNames(['FR'], { type: 'language'}).of(d)) +value = get("language").thru(d => d ? new Intl.DisplayNames(['FR'], { type: 'language'}).of(d) : 'n/a') [assign] ;On récupère des tableaux de codes Iso2, on enlève le code de la France. Puis on teste chaque tableau, s'il n'est pas vide on remplace par "Oui" (il y a d'autres pays donc collaboration), sinon par "Non". diff --git a/wos-dumps/01-query/wos-test.txt b/wos-dumps/01-query/wos-test.txt deleted file mode 100644 index 1bbb73a..0000000 --- a/wos-dumps/01-query/wos-test.txt +++ /dev/null @@ -1 +0,0 @@ -CU=France AND PY=2018 AND DO=(10.1063/1.5066074) diff --git a/wos-dumps/01-query/wostest.txt b/wos-dumps/01-query/wostest.txt new file mode 100644 index 0000000..d03a68e --- /dev/null +++ b/wos-dumps/01-query/wostest.txt @@ -0,0 +1 @@ +DO=(10.1029/2020gl087215) diff --git a/wos-dumps/02-download.ini b/wos-dumps/02-download.ini index 8a54374..d772f9e 100644 --- a/wos-dumps/02-download.ini +++ b/wos-dumps/02-download.ini @@ -86,13 +86,14 @@ .thru(addresses => { \ let authorsData = {}; \ [].concat(addresses || []).forEach(addr => { \ - [].concat(addr.names?.name || []).filter(a => a.role === "author").forEach(author => { \ - let key = author.wos_standard || author.full_name || "Unknown"; \ + let names = [].concat(addr.names?.name || []); \ + if (names.length === 0) { \ + let key = "Unknown"; \ if (!authorsData[key]) { \ authorsData[key] = { \ - wos_standard: author.wos_standard || "Unknown", \ - full_name: author.preferred_name?.full_name || author.full_name || "Unknown", \ - full_name_deburred: _.deburr(author.preferred_name?.full_name || author.full_name || "Unknown"), \ + wos_standard: "Unknown", \ + full_name: "Unknown", \ + full_name_deburred: "UNKNOWN", \ addresses: [] \ }; \ } \ @@ -103,34 +104,57 @@ .filter(org => org.pref === "Y") \ .map(org => org.content); \ authorsData[key].addresses.push({ full_address, country, city, organizations }); \ - }); \ + } else { \ + names.filter(a => a.role === "author").forEach(author => { \ + let key = author.wos_standard || author.full_name || "Unknown"; \ + if (!authorsData[key]) { \ + authorsData[key] = { \ + wos_standard: author.wos_standard || "Unknown", \ + full_name: author.preferred_name?.full_name || author.full_name || "Unknown", \ + full_name_deburred: _.deburr(author.preferred_name?.full_name || author.full_name || "Unknown"), \ + addresses: [] \ + }; \ + } \ + let full_address = addr.address_spec?.full_address || "Unknown address"; \ + let country = addr.address_spec?.country || "Unknown country"; \ + let city = addr.address_spec?.city || "Unknown city"; \ + let organizations = _.castArray(addr.address_spec?.organizations?.organization || []) \ + .filter(org => org.pref === "Y") \ + .map(org => org.content); \ + authorsData[key].addresses.push({ full_address, country, city, organizations }); \ + }); \ + } \ }); \ return Object.values(authorsData); \ }) - path = ReprintAddresses value = get("static_data.fullrecord_metadata.reprint_addresses.address_name", []) \ .thru(reprints => { \ let authorsData = {}; \ [].concat(reprints || []).forEach(addr => { \ - let author = addr.names?.name || {}; \ - let key = author.wos_standard || author.full_name || "Unknown"; \ - if (!authorsData[key]) { \ - authorsData[key] = { \ - wos_standard: author.wos_standard || "Unknown", \ - full_name: author.full_name || "Unknown", \ - full_name_deburred: _.deburr(author.full_name || "Unknown"), \ - addresses: [] \ - }; \ + let authors = [].concat(addr.names?.name || []); \ + if (authors.length === 0) { \ + authors = [{ full_name: "Unknown", wos_standard: "Unknown" }]; \ } \ - authorsData[key].addresses.push({ \ - full_address: addr.address_spec?.full_address || "Unknown address", \ - country: addr.address_spec?.country || "Unknown country", \ - city: addr.address_spec?.city || "Unknown city", \ - organizations: _.castArray(addr.address_spec?.organizations?.organization || []) \ - .filter(org => org.pref === "Y") \ - .map(org => org.content) \ + authors.forEach(author => { \ + let key = author.wos_standard || author.full_name || "Unknown"; \ + if (!authorsData[key]) { \ + authorsData[key] = { \ + wos_standard: author.wos_standard || "Unknown", \ + full_name: author.full_name || "Unknown", \ + full_name_deburred: _.deburr(author.full_name || "Unknown"), \ + addresses: [] \ + }; \ + } \ + authorsData[key].addresses.push({ \ + full_address: addr.address_spec?.full_address || "Unknown address", \ + country: addr.address_spec?.country || "Unknown country", \ + city: addr.address_spec?.city || "Unknown city", \ + organizations: _.castArray(addr.address_spec?.organizations?.organization || []) \ + .filter(org => org.pref === "Y") \ + .map(org => org.content) \ + }); \ }); \ }); \ return Object.values(authorsData); \ diff --git a/wos-dumps/03-enrich.ini b/wos-dumps/03-enrich.ini index a4dbcf7..62daa79 100644 --- a/wos-dumps/03-enrich.ini +++ b/wos-dumps/03-enrich.ini @@ -125,25 +125,33 @@ [assign] path = AuthorsToPut -value = get("AuthorsNamesOnly").xor(self.AuthorsHasAddress).map(auth =>`${auth}: Unknown` ) +value = get("AuthorsNamesOnly") \ + .xor(self.AuthorsHasAddress) \ + .map(auth => `${auth}: Unknown`) [assign] -path = AuthorsWithAddressesHtml +path = AuthorsWithAddressesDisplay value = get("AuthorsWithAddress") \ - .groupBy("full_name") \ - .map((entries, author) => ({ \ - author: `${author}:`, \ - addresses: entries.flatMap(e => e.addresses.map(a => _.get(a, 'full_address', 'Unknown address'))).join("
- ")})) \ - .map(e => `${e.author} ${e.addresses}`).concat(self.AuthorsToPut) + .groupBy("full_name") \ + .map((entries, author) => ({ \ + author, \ + addresses: entries \ + .flatMap(e => e.addresses.map(a => _.get(a, 'full_address', 'Unknown address'))) \ + .join(" || ") \ + })) \ + .map(e => `${e.author}: ${e.addresses}`) \ + .concat(self.AuthorsToPut) [assign] -path = ReprintAddressesHtml +path = ReprintAddressesDisplay value = get("ReprintAddresses") \ - .map(entry => ({ \ - author: `${entry.full_name}:`, \ - addresses: entry.addresses.map(a => _.get(a, 'full_address', 'Unknown address')).join("
- ") \ - })) \ - .map(e => `${e.author} ${e.addresses}`) + .map(entry => ({ \ + author: entry.full_name, \ + addresses: entry.addresses \ + .map(a => _.get(a, 'full_address', 'Unknown address')) \ + .join(" || ") \ + })) \ + .map(e => `${e.author}: ${e.addresses}`) [exchange] value = omit(["Unpaywall","AuthorsNamesOnly","AuthorsHasAddress","AuthorsToPut"])