config fix: switch unpaywall Web Service domaine from inist.fr to istex.fr 5 months ago
test feat: add ability to get OA info from OA-JSON file (science-miner / glutton-harvester) 1 month ago
.editorconfig chore(fomatting): fixed linter issues + added a .editorconfig file 1 year ago
.eslintrc.json chore(fomatting): fixed linter issues + added a .editorconfig file 1 year ago
.gitignore add retry option and remove lockfile from gitignone 1 year ago
README.md chore(fomatting): fixed linter issues + added a .editorconfig file 1 year ago
error-handler.js fix: try to throw errors better 1 year ago
index.js feat: add ability to get OA info from OA-JSON file (science-miner / glutton-harvester) 1 month ago
package-lock.json feat: add ability to get OA info from OA-JSON file (science-miner / glutton-harvester) 1 month ago
package.json feat: 1st attempt of Istex-compatible version 1 year ago
README.md

Présentation

Le module LI-ADD-UNPAYWALL permet d’ajouter des enrichissement ‘Unpaywall’ celui-ci étant récupéré par le web service ‘biblio-tools/v1/unpaywall/corhal’. L'objectif est de récupérer la ou les URL(s) pointant vers le fulltext si celui-ci est librement disponible sur Internet, URL(s) accompagnée(s) des informations détaillées (is_oa, oa_status, oa_type, etc.)

Fonctionnement

Le module effectue les opérations suivantes :

  • Récupération en entrée d'un docObject, ainsi que d'une callback cb.
  • Vérifier si l'objet docObject.doi exist.
  • Envoyer au webservice unpaywallWsUrl définit dans le fichier config.js le doi pour chercher les enrichissement unpaywall.
  • Ajouter le résultat de la recherche a l'objet 'enrichments.openAccess.unpaywall'

Arborescence

.
├── node_modules
│   └── ...
├── config/
│   └── config.js           // Configuration pour l'environnement de production
├── test
│   └── run.js              // Ensemble des tests à effectuer
├── .eslintrc.json          // Configuration pour eslint
├── .gitignore
├── README.md               // Le fichier que vous lisez actuellement
├── index.js                // Script principal contenant la méthode doTheJob
└── package.json            // Fichier contenant les dépendances NPM

Annexes

Options via NPM

  • npm install Installe les dépendances NPM présente dans le ./package.json
  • npm test Lance l'ensemble des tests unitaires (écrits en JavaScript -mocha-)

Exemple d'un docObject accepté en entrée

{
…
doi: '10.15282/ijame.14.4.2017.7.0368'
}

Exemples du fichier json en sortie

Remarquez l'ajout de l'objets enrichments.

Exemple de modification de fichier json sans problème

{
…
doi: '10.15282/ijame.14.4.2017.7.0368',
enrichments: {
          openAccess: {
              unpaywall: [...]
          }
        },
},

Exemple de sortie du docObject avec problème

Remarquez l'ajout de errCode et errMessage dans le docObject :

{
    …
    doi: '10.15282/ijame.14.4.2017.7.0368',
    "errCode":"HTTPError",
    "_errMsg":"Erreur dans la requête du webservice ADD-UNPAYWALL"
}

Codes d'erreur : Lib GOT

Code Signification Note(s)
UnsupportedProtocolError Protocole du webservice ADD-UNPAYWALL non pris en charge.
HTTPError Erreur HTTP du webservice ADD-UNPAYWALL.
ParseError Erreur du parsing de résultat du webservice ADD-UNPAYWALL.
RequestError Erreur dans la requête du webservice ADD-UNPAYWALL.
TimeoutError Erreur de Timeout dans la requête du webservice ADD-UNPAYWALL
CancelError La requête du webservice ADD-UNPAYWALL a été annulée
BadResponse Le webservice ADD-UNPAYWALL renvoie une réponse incorrecte