Skip to main content

ejp-csv-parser

EJP CSV parser for building article objects.

This library reads CSV files containing article manuscript data, creates objects defined in the elifearticle library, and sets object properties from the CSV data values.

Currently it reads CSV files for data including: title, abstract, DOI, editor, authors, group authors, license, received date, subjects, keywords, research organisms, datasets, funding, and ethics.

The settings.py module defines file names, column names, angle bracket escape sequence, folder names, and similar settings which can be adjusted slightly if required.

The parse.py module is a good starting place to invoke the library, if given an article ID value, it can read the CSV files for data, create objects and set their properties for that particular article.

The csv_data.py module contains the logic for reading the CSV files, linking rows from multiple files by their index columns, escaping and converting some character encoding, and accounting for comma characters that are not intende to delimit data fields.

The objects instantiated by this library are used to generate a JATS XML file for a Publish on Accept (PoA) research article.

Requirements and install

a) Install from pypi package index

pip install ejpcsvparser

b) Install locally

Clone the git repo

git clone https://github.com/elifesciences/ejp-csv-parser.git

Create a python virtual environment and activate it

python3 -m venv venv
source venv/bin/activate

Install it locally

pip install -r requirements.txt
python setup.py install

In order to run the transform function as written, it will require strip-coverletter to be installed and ready to run locally, which will also require Docker to be installed and running.

Example usage

This library is meant to be integrated into another operational system, where the CSV files are downloaded from an S3 bucket and then processed. The test scenarios may provide more details about how it could be invoked, and the following example is a simple way to see how it works using interactive Python and using files from the "tests/test_data/" folder as the CSV input:

>>> from ejpcsvparser import parse
>>> article, error_count, error_messages = parse.build_article(21598)
>>> print(article.doi)
10.7554/eLife.21598
>>> print(article.title)
Cryo-EM structures of the autoinhibited <italic>E. coli</italic> ATP synthase in three rotational states

Run code tests

Use pytest for testing, install it if missing:

pip install pytest

Run tests

pytest

Run tests with coverage (install it if missing):

coverage run -m pytest

then report on code coverage

coverage report -m

License

Licensed under MIT.

Metadata

Release files for ejpcsvparser 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ejpcsvparser 0.5.0
File Size Uploaded Provenance Actions
ejpcsvparser-0.5.0.tar.gz 23.9 kB Without provenance Details for ejpcsvparser-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ejpcsvparser 0.5.0
File Interpreter ABI Platform Actions
ejpcsvparser-0.5.0-py3-none-any.whl Python 3 none any Details for ejpcsvparser-0.5.0-py3-none-any.whl

Total release size: 39.4 kB

Release files / ejpcsvparser-0.5.0.tar.gz

Download URL ejpcsvparser-0.5.0.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f70e9bef2ac3cb24a06863b6d1d5777557d8d3fc7070f2239698026b580ef620
BLAKE2b-256 checksum
How to use checksums
195cf46823f8b484f3a9562b13025c271b20793578d82fa7f3882b7841ace2bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.10

Release files / ejpcsvparser-0.5.0-py3-none-any.whl

Download URL ejpcsvparser-0.5.0-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
124dde5ce2341758ad3190b65e25c70a3f1a06eef8986bcd26411fd236381bb0
BLAKE2b-256 checksum
How to use checksums
ca02c991e5dfaabb6a47bd2ce60a49ce53305339615589ca7775f3ee8cb5774b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.10

Security for ejpcsvparser 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page