paperetl


Namepaperetl JSON
Version 2.2.1 PyPI version JSON
download
home_pagehttps://github.com/neuml/paperetl
SummaryETL processes for medical and scientific papers
upload_time2023-09-18 21:19:15
maintainer
docs_urlNone
authorNeuML
requires_python>=3.8
licenseApache 2.0: http://www.apache.org/licenses/LICENSE-2.0
keywords etl parse covid-19 medical scientific papers
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            <p align="center">
    <img src="https://raw.githubusercontent.com/neuml/paperetl/master/logo.png"/>
</p>

<h3 align="center">
    <p>ETL processes for medical and scientific papers</p>
</h3>

<p align="center">
    <a href="https://github.com/neuml/paperetl/releases">
        <img src="https://img.shields.io/github/release/neuml/paperetl.svg?style=flat&color=success" alt="Version"/>
    </a>
    <a href="https://github.com/neuml/paperetl/releases">
        <img src="https://img.shields.io/github/release-date/neuml/paperetl.svg?style=flat&color=blue" alt="GitHub Release Date"/>
    </a>
    <a href="https://github.com/neuml/paperetl/issues">
        <img src="https://img.shields.io/github/issues/neuml/paperetl.svg?style=flat&color=success" alt="GitHub issues"/>
    </a>
    <a href="https://github.com/neuml/paperetl">
        <img src="https://img.shields.io/github/last-commit/neuml/paperetl.svg?style=flat&color=blue" alt="GitHub last commit"/>
    </a>
    <a href="https://github.com/neuml/paperetl/actions?query=workflow%3Abuild">
        <img src="https://github.com/neuml/paperetl/workflows/build/badge.svg" alt="Build Status"/>
    </a>
    <a href="https://coveralls.io/github/neuml/paperetl?branch=master">
        <img src="https://img.shields.io/coverallsCoverage/github/neuml/paperetl" alt="Coverage Status">
    </a>
</p>

-------------------------------------------------------------------------------------------------------------------------------------------------------

paperetl is an ETL library for processing medical and scientific papers.

![architecture](https://raw.githubusercontent.com/neuml/paperetl/master/images/architecture.png#gh-light-mode-only)

paperetl supports the following sources:

- File formats:
    - PDF
    - XML (arXiv, PubMed, TEI)
    - CSV
- COVID-19 Research Dataset (CORD-19)

paperetl supports the following output options for storing articles:

- SQLite
- Elasticsearch
- JSON files
- YAML files

## Installation

The easiest way to install is via pip and PyPI

```
pip install paperetl
```

Python 3.7+ is supported. Using a Python [virtual environment](https://docs.python.org/3/library/venv.html) is recommended.

paperetl can also be installed directly from GitHub to access the latest, unreleased features.

```
pip install git+https://github.com/neuml/paperetl
```

### Additional dependencies

PDF parsing relies on an existing GROBID instance to be up and running. It is assumed that this is running locally on the ETL server. This is only
necessary for PDF files.

- [GROBID install instructions](https://grobid.readthedocs.io/en/latest/Install-Grobid/)
- [GROBID start service](https://grobid.readthedocs.io/en/latest/Grobid-service/)

### Docker

A Dockerfile with commands to install paperetl, all dependencies and scripts is available in this repository.

```
wget https://raw.githubusercontent.com/neuml/paperetl/master/docker/Dockerfile
docker build -t paperetl -f Dockerfile .
docker run --name paperetl --rm -it paperetl
```

This will bring up a paperetl command shell. Standard Docker commands can be used to copy files over or commands can be run directly in the shell to retrieve input content.

## Examples

### Notebooks

| Notebook  | Description  |       |
|:----------|:-------------|------:|
| [Introducing paperetl](https://github.com/neuml/paperetl/blob/master/examples/01_Introducing_paperetl.ipynb) | Overview of the functionality provided by paperetl | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuml/paperetl/blob/master/examples/01_Introducing_paperetl.ipynb) |

### Load Articles into SQLite

The following example shows how to use paperetl to load a set of medical/scientific articles into a SQLite database.

1. Download the desired medical/scientific articles in a local directory. For this example, it is assumed the articles are in a directory named `paperetl/data`

2. Build the database

    ```
    python -m paperetl.file paperetl/data paperetl/models
    ```

Once complete, there will be an articles.sqlite file in paperetl/models

### Load into Elasticsearch

Elasticsearch is also a supported datastore as shown below. This example assumes Elasticsearch is running locally, change the URL to a remote server as appropriate.

```
python -m paperetl.file paperetl/data http://localhost:9200
```

Once complete, there will be an articles index in Elasticsearch with the metadata and full text stored.

### Convert articles to JSON/YAML

paperetl can also be used to convert articles into JSON or YAML files. This is useful if the data is to be fed into another system or for manual inspection/debugging of a single file.

JSON:

```
python -m paperetl.file paperetl/data json://paperetl/json
```

YAML:

```
python -m paperetl.file paperetl/data yaml://paperetl/yaml
```

Converted files will be stored in paperetl/(json|yaml)

### Load CORD-19

_Note: The final version of CORD-19 was released on 2022-06-22. But this is still a large, valuable set of medical documents._

The following example shows how to use paperetl to load the CORD-19 dataset into a SQLite database.

1. Download and extract the dataset from [Allen Institute for AI CORD-19 Release Page](https://ai2-semanticscholar-cord-19.s3-us-west-2.amazonaws.com/historical_releases.html).

    ```
    scripts/getcord19.sh cord19/data
    ```

    The script above retrieves and unpacks the latest copy of CORD-19 into a directory named `cord19/data`. An optional second argument sets a specific date of the dataset in the format YYYY-MM-DD (ex. 2021-01-01) which defaults to the latest date.

2. Generate entry-dates.csv for current version of the dataset

    ```
    python -m paperetl.cord19.entry cord19/data
    ```

    An optional second argument sets a specific date of the dataset in the format YYYY-MM-DD (ex. 2021-01-01) which defaults of the latest
    date. This should match the date used in Step 1.

3. Build database

    ```
    python -m paperetl.cord19 cord19/data cord19/models
    ```

    Once complete, there will be an articles.sqlite file in cord19/models. As with earlier examples, the data can also be loaded into Elasticsearch.

    ```
    python -m paperetl.cord19 cord19/data http://localhost:9200
    ```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/neuml/paperetl",
    "name": "paperetl",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "etl parse covid-19 medical scientific papers",
    "author": "NeuML",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/2d/c7/319f65489b24789ce8b646095ed9043535608a3ccaf93b0f1c18789b4fdf/paperetl-2.2.1.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n    <img src=\"https://raw.githubusercontent.com/neuml/paperetl/master/logo.png\"/>\n</p>\n\n<h3 align=\"center\">\n    <p>ETL processes for medical and scientific papers</p>\n</h3>\n\n<p align=\"center\">\n    <a href=\"https://github.com/neuml/paperetl/releases\">\n        <img src=\"https://img.shields.io/github/release/neuml/paperetl.svg?style=flat&color=success\" alt=\"Version\"/>\n    </a>\n    <a href=\"https://github.com/neuml/paperetl/releases\">\n        <img src=\"https://img.shields.io/github/release-date/neuml/paperetl.svg?style=flat&color=blue\" alt=\"GitHub Release Date\"/>\n    </a>\n    <a href=\"https://github.com/neuml/paperetl/issues\">\n        <img src=\"https://img.shields.io/github/issues/neuml/paperetl.svg?style=flat&color=success\" alt=\"GitHub issues\"/>\n    </a>\n    <a href=\"https://github.com/neuml/paperetl\">\n        <img src=\"https://img.shields.io/github/last-commit/neuml/paperetl.svg?style=flat&color=blue\" alt=\"GitHub last commit\"/>\n    </a>\n    <a href=\"https://github.com/neuml/paperetl/actions?query=workflow%3Abuild\">\n        <img src=\"https://github.com/neuml/paperetl/workflows/build/badge.svg\" alt=\"Build Status\"/>\n    </a>\n    <a href=\"https://coveralls.io/github/neuml/paperetl?branch=master\">\n        <img src=\"https://img.shields.io/coverallsCoverage/github/neuml/paperetl\" alt=\"Coverage Status\">\n    </a>\n</p>\n\n-------------------------------------------------------------------------------------------------------------------------------------------------------\n\npaperetl is an ETL library for processing medical and scientific papers.\n\n![architecture](https://raw.githubusercontent.com/neuml/paperetl/master/images/architecture.png#gh-light-mode-only)\n\npaperetl supports the following sources:\n\n- File formats:\n    - PDF\n    - XML (arXiv, PubMed, TEI)\n    - CSV\n- COVID-19 Research Dataset (CORD-19)\n\npaperetl supports the following output options for storing articles:\n\n- SQLite\n- Elasticsearch\n- JSON files\n- YAML files\n\n## Installation\n\nThe easiest way to install is via pip and PyPI\n\n```\npip install paperetl\n```\n\nPython 3.7+ is supported. Using a Python [virtual environment](https://docs.python.org/3/library/venv.html) is recommended.\n\npaperetl can also be installed directly from GitHub to access the latest, unreleased features.\n\n```\npip install git+https://github.com/neuml/paperetl\n```\n\n### Additional dependencies\n\nPDF parsing relies on an existing GROBID instance to be up and running. It is assumed that this is running locally on the ETL server. This is only\nnecessary for PDF files.\n\n- [GROBID install instructions](https://grobid.readthedocs.io/en/latest/Install-Grobid/)\n- [GROBID start service](https://grobid.readthedocs.io/en/latest/Grobid-service/)\n\n### Docker\n\nA Dockerfile with commands to install paperetl, all dependencies and scripts is available in this repository.\n\n```\nwget https://raw.githubusercontent.com/neuml/paperetl/master/docker/Dockerfile\ndocker build -t paperetl -f Dockerfile .\ndocker run --name paperetl --rm -it paperetl\n```\n\nThis will bring up a paperetl command shell. Standard Docker commands can be used to copy files over or commands can be run directly in the shell to retrieve input content.\n\n## Examples\n\n### Notebooks\n\n| Notebook  | Description  |       |\n|:----------|:-------------|------:|\n| [Introducing paperetl](https://github.com/neuml/paperetl/blob/master/examples/01_Introducing_paperetl.ipynb) | Overview of the functionality provided by paperetl | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuml/paperetl/blob/master/examples/01_Introducing_paperetl.ipynb) |\n\n### Load Articles into SQLite\n\nThe following example shows how to use paperetl to load a set of medical/scientific articles into a SQLite database.\n\n1. Download the desired medical/scientific articles in a local directory. For this example, it is assumed the articles are in a directory named `paperetl/data`\n\n2. Build the database\n\n    ```\n    python -m paperetl.file paperetl/data paperetl/models\n    ```\n\nOnce complete, there will be an articles.sqlite file in paperetl/models\n\n### Load into Elasticsearch\n\nElasticsearch is also a supported datastore as shown below. This example assumes Elasticsearch is running locally, change the URL to a remote server as appropriate.\n\n```\npython -m paperetl.file paperetl/data http://localhost:9200\n```\n\nOnce complete, there will be an articles index in Elasticsearch with the metadata and full text stored.\n\n### Convert articles to JSON/YAML\n\npaperetl can also be used to convert articles into JSON or YAML files. This is useful if the data is to be fed into another system or for manual inspection/debugging of a single file.\n\nJSON:\n\n```\npython -m paperetl.file paperetl/data json://paperetl/json\n```\n\nYAML:\n\n```\npython -m paperetl.file paperetl/data yaml://paperetl/yaml\n```\n\nConverted files will be stored in paperetl/(json|yaml)\n\n### Load CORD-19\n\n_Note: The final version of CORD-19 was released on 2022-06-22. But this is still a large, valuable set of medical documents._\n\nThe following example shows how to use paperetl to load the CORD-19 dataset into a SQLite database.\n\n1. Download and extract the dataset from [Allen Institute for AI CORD-19 Release Page](https://ai2-semanticscholar-cord-19.s3-us-west-2.amazonaws.com/historical_releases.html).\n\n    ```\n    scripts/getcord19.sh cord19/data\n    ```\n\n    The script above retrieves and unpacks the latest copy of CORD-19 into a directory named `cord19/data`. An optional second argument sets a specific date of the dataset in the format YYYY-MM-DD (ex. 2021-01-01) which defaults to the latest date.\n\n2. Generate entry-dates.csv for current version of the dataset\n\n    ```\n    python -m paperetl.cord19.entry cord19/data\n    ```\n\n    An optional second argument sets a specific date of the dataset in the format YYYY-MM-DD (ex. 2021-01-01) which defaults of the latest\n    date. This should match the date used in Step 1.\n\n3. Build database\n\n    ```\n    python -m paperetl.cord19 cord19/data cord19/models\n    ```\n\n    Once complete, there will be an articles.sqlite file in cord19/models. As with earlier examples, the data can also be loaded into Elasticsearch.\n\n    ```\n    python -m paperetl.cord19 cord19/data http://localhost:9200\n    ```\n",
    "bugtrack_url": null,
    "license": "Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0",
    "summary": "ETL processes for medical and scientific papers",
    "version": "2.2.1",
    "project_urls": {
        "Documentation": "https://github.com/neuml/paperetl",
        "Homepage": "https://github.com/neuml/paperetl",
        "Issue Tracker": "https://github.com/neuml/paperetl/issues",
        "Source Code": "https://github.com/neuml/paperetl"
    },
    "split_keywords": [
        "etl",
        "parse",
        "covid-19",
        "medical",
        "scientific",
        "papers"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a058b972342f8e75c8d1cd137e905f43b5dfe49600b9e424f4f80d0b2b94e171",
                "md5": "e6212379ad7bffa86d4007cc8b97f013",
                "sha256": "2c518b98eeb08f35d5a5b12011b94fcc4adb4e737763c1bb1b1e60a235559f8b"
            },
            "downloads": -1,
            "filename": "paperetl-2.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e6212379ad7bffa86d4007cc8b97f013",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 32325,
            "upload_time": "2023-09-18T21:19:13",
            "upload_time_iso_8601": "2023-09-18T21:19:13.356435Z",
            "url": "https://files.pythonhosted.org/packages/a0/58/b972342f8e75c8d1cd137e905f43b5dfe49600b9e424f4f80d0b2b94e171/paperetl-2.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2dc7319f65489b24789ce8b646095ed9043535608a3ccaf93b0f1c18789b4fdf",
                "md5": "195a6680556d0bd6badc429e7632e684",
                "sha256": "6768f70081c80f8bf5a291a02763e853fff42c934f7dce1dcf3b0304db8b1f7d"
            },
            "downloads": -1,
            "filename": "paperetl-2.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "195a6680556d0bd6badc429e7632e684",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 27318,
            "upload_time": "2023-09-18T21:19:15",
            "upload_time_iso_8601": "2023-09-18T21:19:15.072784Z",
            "url": "https://files.pythonhosted.org/packages/2d/c7/319f65489b24789ce8b646095ed9043535608a3ccaf93b0f1c18789b4fdf/paperetl-2.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-18 21:19:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "neuml",
    "github_project": "paperetl",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "paperetl"
}
        
Elapsed time: 0.11653s