Tools for ezunpaywall
Table of content
The tools you need to let node-ezunpaywall run are :
- git >= 2.27.0
- npm >= 6.14.8
- NodeJS >= 14.15.0
$ git clone https://github.com/ezpaarse-project/node-ezunpaywall.git
$ cd node-ezunaywall
$ npm i -g .$ git clone https://github.com/ezpaarse-project/node-ezunpaywall.git
$ cd node-ezunpaywall
$ npm iYou can get help for any command by typing ezu <command> --help.
The module provides an ezunpaywall command (aliased ezu).
| Name | Description |
|---|---|
| config [options] | config management command to establish the connection between the command and ezunpaywall |
| ping | check if services are available |
| update-job-file [options] | insert the content of changefile installed on ezunpaywall |
| update-job-period [options] | start an unpaywall data update process |
| update-job-snapshot [options] | download and insert the current snapshot |
| update-report [options] | get report of update process |
| update-status [options] | get status of update process |
| enrich [options] | enrich file with unpaywall attributes |
| apikey-create [options] | create new apikey |
| apikey-update [options] | update apikey |
| apikey-delete [options] | delete apikey |
| apikey-get [options] | get config of apikey |
| help [command] | display help for command |
Manage config to fetch ezunpyawall.
| Name | Description |
|---|---|
| --get | display the configuration |
| --set <key> <value> | update config |
| -L --list | list of attributes required for configuration |
| -h, --help | display help for command |
$ ezunpaywall config -LbaseURL
apikey
apikey
ezunpaywall config --set baseURL https://localhost.test.fr{
"baseURL": "https://localhost.test.fr",
"apikey": "changeme",
}
info: from /home/user/.config/ezunpaywall.jsonCheck if services are available.
| Name | Description |
|---|---|
| -u --use | Use a custom config |
ezunpaywall ping
info: Ping graphql service: OK
info: Ping update service: OK
info: Ping enrich service: OK
info: Ping apikey service: OK
info: ezmeta: OK
info: You have access to graphql, enrich, update service(s)insert the content of changefile installed on ezunpaywall
| Name | Description |
|---|---|
| --file | snapshot's file installed on ezunpaywall |
| --offset | line where processing will start |
| --limit | line where processing will end |
| -L --list | list of snapshot installed on ezunpaywall |
| -I --index | name of the index to which the data is inserted |
| -h, --help | display help for command |
ezu update-job-file --file fake1.jsonl.gz
info: Insert "fake1.jsonl.gz"start an unpaywall data update process
| Name | Description |
|---|---|
| --force | force update without check if is already installed |
| --startDate <startDate> | start date to download and insert updates from unpaywall |
| --endDate <endDate> | end date to download and insert updates from unpaywall |
| --interval <interval> | interval of update (day or week) |
| -L --list | list of snapshot installed on ezunpaywall |
| -I --index | name of the index to which the data is inserted |
ezu update-job-period --startDate 2021-12-01 --endDate 2021-12-07
info: Insert "day" changefiles between "2021-12-01" and "2021-12-07"ezu update-job-period --period week --startDate 2021-12-01 --endDate 2021-12-07
info: Insert "week" changefiles between "2021-12-01" and "2021-12-07"download and insert the current snapshot
| Name | Description |
|---|---|
| -I --index | name of the index to which the data is inserted |
ezu update-job-snapshot
info: Insert current snapshotget report of update process
| Name | Description |
|---|---|
| --file <interval> | changefile installed on ezunpaywall |
| --latest | latest report |
| -L --list | list of snapshot installed on ezunpaywall |
| -I --index | name of the index to which the data is inserted |
ezu update report -L
? reports (Use arrow keys)
❯ report1.json
report2.json
report3.json
{
"done": true,
"createdAt": "2021-07-23T08:13:40.802Z",
"endAt": "2021-07-23T08:13:40.902Z",
"steps": [
{
"task": "insert",
"file": "fake1.jsonl.gz",
"linesRead": 50,
"percent": 100,
"took": 0.084,
"status": "success"
}
],
"error": false,
"took": 0.100
}ezu update report --latest
{
"done": true,
"createdAt": "2021-07-23T08:13:40.802Z",
"endAt": "2021-07-23T08:13:40.902Z",
"steps": [
{
"task": "insert",
"file": "fake1.jsonl.gz",
"linesRead": 50,
"percent": 100,
"took": 0.084,
"status": "success"
}
],
"error": false,
"took": 0.100
}get status of update process
| Name | Description |
|---|---|
| --verbose | show with load bard |
ezu update status
info: An update is being done
{
"state": {
"done": false,
"createdAt": "2021-07-23T08:13:38.334Z",
"endAt": null,
"steps": [
{
"task": "getChangefiles",
"took": 0.012,
"status": "success"
},
{
"task": "insert",
"file": "fake3.jsonl.gz",
"linesRead": 0,
"percent": 0,
"took": 0,
"status": "inProgress"
}
],
"error": false
}
}or
ezu update status
info: No update is in progress
info: Use ezu update report --latest to see the latest reportenrich file with unpaywall attributes
| Name | Description |
|---|---|
| --file <file> | file wich must be enriched |
| --separator | separator of csv file |
| --attributes | attributes which must be enriched in graphql format. By default all attributes are added |
| --out | name of enriched file. By default, the output file is named: out.jsonl / out.csv |
| --verbose | display loadbar and exit if process end |
| -I --index | name of the index to which the data is inserted |
ezu enrich job --file mustBeEnrich.csv --separator ";"
ezu enrich job --file mustBeEnrich.jsonl --separator ";" --attributes "{ is_oa, best_oa_location { license }, z_authors{ family } }"create new apikey
| Name | Description |
|---|---|
| --keyname | name of apikey |
| --access | name of access services of apikey seperated by comma. By default it set at ['graphql'] |
| --attributes | unpaywall attributes seperated apikey seperated by comma. By default it set at '*' |
| --allowed | indicates if the key is authorized or not. "true" or "false" only. By default it set at true |
ezu apikey-create --keyname user1
{
"apikey": "abcd1",
"config": {
"name": "user1",
"access": [
"graphql"
],
"attributes": ["*"],
"allowed": true
}
}ezu apikey-create --keyname user2 --access graphql,enrich,update --allowed false --attributes doi,is_oa
{
"apikey": "abcd2",
"config": {
"name": "user2",
"access": [
"graphql",
"enrich",
"update"
],
"attributes": ["doi", "is_oa"],
"allowed": false
}
}update apikey
| Name | Description |
|---|---|
| --apikey | apikey |
| --keyname | name of apikey |
| --access | name of access services of apikey seperated by comma. By default it set at ['graphql'] |
| --attributes | unpaywall attributes seperated apikey seperated by comma. By default it set at '*' |
| --allowed | indicates if the key is authorized or not. "true" or "false" only. By default it set at true |
ezu apikey-update --apikey demo --keyname updated-demo --access graphql --attributes doi,is_oa
{
"apikey": "demo",
"config": {
"name": "updated-demo",
"access": [
"graphql"
],
"attributes": ["doi","is_oa"],
"allowed": true
}
}delete apikey
| Name | Description |
|---|---|
| --apikey | apikey |
apikey-delete --apikey demo
info: apikey [demo] is deleted successfullyget config of apikey
| Name | Description |
|---|---|
| --apikey | apikey |
| --all | get all apikey |
ezu apikey-get --apikey demo
{
"name": "user3",
"access": [
"enrich",
"graphql"
],
"attributes": "*",
"allowed": true
}load the content of JSON file of apikey
| Name | Description |
|---|---|
| --file | filepath of JSON file of apikey |
ezu apikey-load --file ./keys.json
info: Your apikey file are loaded successfullyTo see all available unpaywall attributes, click here.
Make sure you have ezunpaywall start in dev mode
$ npm run test