GithubHelp home page GithubHelp logo

ezpaarse-project / ezunpaywall Goto Github PK

View Code? Open in Web Editor NEW
3.0 7.0 1.0 9.76 MB

ezUnpaywall is a mirror of Unpaywall data hosted at Inist-CNRS in France and developed by ezTEAM.

Home Page: https://unpaywall.inist.fr/

License: CeCILL Free Software License Agreement v2.1

Dockerfile 0.37% JavaScript 79.19% Shell 0.13% Vue 19.98% TypeScript 0.34%
cnrs unpaywall

ezunpaywall's Introduction

ezunpaywall

Ezunpaywall is an API and database that queries the Unpaywall database containing free scholarly articles.

Table of content

Structure

Unpaywall is made up of several services which are distributed in several docker containers. Structure

for apikey, enrich, graphql, health, mail and update service, a open api is available on frontend

Installation

git clone https://github.com/ezpaarse-project/ezunpaywall 

Development

Prerequisites

The tools you need to let ezunpaywall run are :

  • docker
  • npm

Command :

# install dependencies
npm i

# create volume for elastic
docker-compose -f docker-compose.debug.yml run --rm elastic chown -R elasticsearch /usr/share/elasticsearch/ 

Start

# Start ezunpaywall as daemon
docker-compose -f docker-compose.debug.yml up -d

# Stop ezunpaywall
docker-compose -f docker-compose.debug.yml stop

# Get the status of ezunpaywall services
docker-compose -f docker-compose.debug.yml ps

Tests

To run tests, you need ezunpaywall to be launched in dev mode with fakeUnpaywall. With that, you can run test on.

# there are alias on root folder
$ ~/ezunpaywall npm run test
$ ~/ezunpaywall npm run test:apikey
$ ~/ezunpaywall npm run test:enrich
$ ~/ezunpaywall npm run test:graphql
$ ~/ezunpaywall npm run test:update

# you can run test for each service
$ ~/ezunpaywall/src/apikey npm run test
$ ~/ezunpaywall/src/enrich npm run test
$ ~/ezunpaywall/src/graphql npm run test
$ ~/ezunpaywall/src/update npm run test

Deployment

Prerequisites

The tools you need to let ezunpaywall run are :

  • docker
  • unpaywall data measured about 130Gb it is necessary to provide the necessary place on the hard drive

Environment variables

Create an environment file named ezunpaywall.local.env.sh and export the following environment variables. You can then source ezunpaywall.env.sh, which contains a set of predefined variables and is overriden by ezunpaywall.local.env.sh.

Details :

Adjust system configuration for Elasticsearch

Elasticsearch has some system requirements that you should check.

To avoid memory exceptions, you may have to increase mmaps count. Edit /etc/sysctl.conf and add the following line :

# configuration needed for elastic search
vm.max_map_count=262144

Then apply the changes :

sysctl -p

Start/Stop/Status

Before you start ezunpaywall, make sure all necessary environment variables are set.

# Start ezunpaywall as daemon
docker-compose up -d

# Stop ezunpaywall
docker-compose stop

# Get the status of ezunpaywall services
docker-compose ps

Data update

You can update your data via update snapshots provided by unpaywall on a weekly or daily basis (if you have API key). in the update service, there is a cron that allows to automatically update the data from unpaywall, weekly or daily.

API Graphql

unpaywall

get unpaywall data with parameters.

Examples

GET

headers: {
    "x-api-key": "<YOUR_API_KEY>"
}

GET "<HOST>/api/graphql?query={unpaywall(dois:["10.1038/2211089b0","10.1038/nature12373"]){doi, is_oa, best_oa_location{ url }}}"

POST

POST "<HOST>/api/graphql"

headers: {
    "x-api-key": "<YOUR_API_KEY>"
},
body: {
    "query": "{unpaywall(dois:[\"10.1038/2211089b0\",\"10.1038/nature12373\"]){doi, is_oa, best_oa_location{ url }}}"
}

POST "<HOST>/api/graphql"

headers: {
    "x-api-key": "<YOUR_API_KEY>"
},
body: {
    "query": "query ($dois: [ID!]!){ unpaywall(dois: $dois){is_oa} }",
    "variables": { 
        "dois": ["10.1038/2211089b0","10.1038/nature12373"],
    }
}

Response Status: 200

{
    "data": {
        "unpaywall": [
            {
                "doi": "10.1038/2211089b0",
                "is_oa": true,
                "best_oa_location": {
                    "url": "http://www.nature.com/articles/2211089b0.pdf"
                }
            }
        ]
    }
}

Object structure

data-format

ezunpaywall's People

Contributors

dependabot[bot] avatar felixleo22 avatar nojhamster avatar oxypomme avatar pseudom avatar tporquet avatar wilmouths avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.